@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
|
@@ -7001,20 +7001,22 @@ var OpKind;
|
|
|
7001
7001
|
OpKind2[OpKind2["ExtractedAttribute"] = 25] = "ExtractedAttribute";
|
|
7002
7002
|
OpKind2[OpKind2["Defer"] = 26] = "Defer";
|
|
7003
7003
|
OpKind2[OpKind2["DeferOn"] = 27] = "DeferOn";
|
|
7004
|
-
OpKind2[OpKind2["
|
|
7005
|
-
OpKind2[OpKind2["
|
|
7006
|
-
OpKind2[OpKind2["
|
|
7007
|
-
OpKind2[OpKind2["
|
|
7008
|
-
OpKind2[OpKind2["
|
|
7009
|
-
OpKind2[OpKind2["
|
|
7010
|
-
OpKind2[OpKind2["
|
|
7011
|
-
OpKind2[OpKind2["
|
|
7012
|
-
OpKind2[OpKind2["
|
|
7013
|
-
OpKind2[OpKind2["
|
|
7014
|
-
OpKind2[OpKind2["
|
|
7015
|
-
OpKind2[OpKind2["
|
|
7016
|
-
OpKind2[OpKind2["
|
|
7017
|
-
OpKind2[OpKind2["
|
|
7004
|
+
OpKind2[OpKind2["DeferWhen"] = 28] = "DeferWhen";
|
|
7005
|
+
OpKind2[OpKind2["I18nMessage"] = 29] = "I18nMessage";
|
|
7006
|
+
OpKind2[OpKind2["HostProperty"] = 30] = "HostProperty";
|
|
7007
|
+
OpKind2[OpKind2["Namespace"] = 31] = "Namespace";
|
|
7008
|
+
OpKind2[OpKind2["ProjectionDef"] = 32] = "ProjectionDef";
|
|
7009
|
+
OpKind2[OpKind2["Projection"] = 33] = "Projection";
|
|
7010
|
+
OpKind2[OpKind2["RepeaterCreate"] = 34] = "RepeaterCreate";
|
|
7011
|
+
OpKind2[OpKind2["Repeater"] = 35] = "Repeater";
|
|
7012
|
+
OpKind2[OpKind2["I18nStart"] = 36] = "I18nStart";
|
|
7013
|
+
OpKind2[OpKind2["I18n"] = 37] = "I18n";
|
|
7014
|
+
OpKind2[OpKind2["I18nEnd"] = 38] = "I18nEnd";
|
|
7015
|
+
OpKind2[OpKind2["I18nExpression"] = 39] = "I18nExpression";
|
|
7016
|
+
OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
|
|
7017
|
+
OpKind2[OpKind2["Icu"] = 41] = "Icu";
|
|
7018
|
+
OpKind2[OpKind2["IcuUpdate"] = 42] = "IcuUpdate";
|
|
7019
|
+
OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
|
|
7018
7020
|
})(OpKind || (OpKind = {}));
|
|
7019
7021
|
var ExpressionKind;
|
|
7020
7022
|
(function(ExpressionKind2) {
|
|
@@ -7295,23 +7297,32 @@ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
|
|
|
7295
7297
|
sourceSpan
|
|
7296
7298
|
}, NEW_OP);
|
|
7297
7299
|
}
|
|
7298
|
-
function
|
|
7300
|
+
function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
|
|
7301
|
+
return __spreadValues(__spreadValues({
|
|
7302
|
+
kind: OpKind.DeferWhen,
|
|
7303
|
+
target,
|
|
7304
|
+
expr,
|
|
7305
|
+
prefetch,
|
|
7306
|
+
sourceSpan
|
|
7307
|
+
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
7308
|
+
}
|
|
7309
|
+
function createI18nExpressionOp(context, target, handle, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
|
|
7299
7310
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
7300
7311
|
kind: OpKind.I18nExpression,
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7312
|
+
context,
|
|
7313
|
+
target,
|
|
7314
|
+
handle,
|
|
7304
7315
|
expression,
|
|
7305
7316
|
i18nPlaceholder,
|
|
7306
7317
|
resolutionTime,
|
|
7307
7318
|
sourceSpan
|
|
7308
7319
|
}, NEW_OP), TRAIT_CONSUMES_VARS), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
7309
7320
|
}
|
|
7310
|
-
function createI18nApplyOp(target,
|
|
7321
|
+
function createI18nApplyOp(target, handle, sourceSpan) {
|
|
7311
7322
|
return __spreadValues({
|
|
7312
7323
|
kind: OpKind.I18nApply,
|
|
7313
7324
|
target,
|
|
7314
|
-
|
|
7325
|
+
handle,
|
|
7315
7326
|
sourceSpan
|
|
7316
7327
|
}, NEW_OP);
|
|
7317
7328
|
}
|
|
@@ -8059,6 +8070,17 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8059
8070
|
op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
|
|
8060
8071
|
}
|
|
8061
8072
|
break;
|
|
8073
|
+
case OpKind.I18nMessage:
|
|
8074
|
+
for (const [placeholder, expr] of op.params) {
|
|
8075
|
+
op.params.set(placeholder, transformExpressionsInExpression(expr, transform2, flags));
|
|
8076
|
+
}
|
|
8077
|
+
for (const [placeholder, expr] of op.postprocessingParams) {
|
|
8078
|
+
op.postprocessingParams.set(placeholder, transformExpressionsInExpression(expr, transform2, flags));
|
|
8079
|
+
}
|
|
8080
|
+
break;
|
|
8081
|
+
case OpKind.DeferWhen:
|
|
8082
|
+
op.expr = transformExpressionsInExpression(op.expr, transform2, flags);
|
|
8083
|
+
break;
|
|
8062
8084
|
case OpKind.Advance:
|
|
8063
8085
|
case OpKind.Container:
|
|
8064
8086
|
case OpKind.ContainerEnd:
|
|
@@ -8069,9 +8091,9 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8069
8091
|
case OpKind.ElementEnd:
|
|
8070
8092
|
case OpKind.ElementStart:
|
|
8071
8093
|
case OpKind.EnableBindings:
|
|
8072
|
-
case OpKind.ExtractedMessage:
|
|
8073
8094
|
case OpKind.I18n:
|
|
8074
8095
|
case OpKind.I18nApply:
|
|
8096
|
+
case OpKind.I18nContext:
|
|
8075
8097
|
case OpKind.I18nEnd:
|
|
8076
8098
|
case OpKind.I18nStart:
|
|
8077
8099
|
case OpKind.Icu:
|
|
@@ -8512,7 +8534,7 @@ function createExtractedAttributeOp(target, bindingKind, name, expression) {
|
|
|
8512
8534
|
expression
|
|
8513
8535
|
}, NEW_OP);
|
|
8514
8536
|
}
|
|
8515
|
-
function createDeferOp(xref, main, mainSlot, sourceSpan) {
|
|
8537
|
+
function createDeferOp(xref, main, mainSlot, metadata, sourceSpan) {
|
|
8516
8538
|
return __spreadProps(__spreadValues(__spreadValues({
|
|
8517
8539
|
kind: OpKind.Defer,
|
|
8518
8540
|
xref,
|
|
@@ -8530,6 +8552,8 @@ function createDeferOp(xref, main, mainSlot, sourceSpan) {
|
|
|
8530
8552
|
placeholderMinimumTime: null,
|
|
8531
8553
|
errorView: null,
|
|
8532
8554
|
errorSlot: null,
|
|
8555
|
+
metadata,
|
|
8556
|
+
resolverFn: null,
|
|
8533
8557
|
sourceSpan
|
|
8534
8558
|
}, NEW_OP), TRAIT_CONSUMES_SLOT), {
|
|
8535
8559
|
numSlotsUsed: 2
|
|
@@ -8544,17 +8568,17 @@ function createDeferOnOp(defer2, trigger, prefetch, sourceSpan) {
|
|
|
8544
8568
|
sourceSpan
|
|
8545
8569
|
}, NEW_OP);
|
|
8546
8570
|
}
|
|
8547
|
-
function
|
|
8571
|
+
function createI18nMessageOp(xref, i18nBlock, message, messagePlaceholder, params, postprocessingParams, needsPostprocessing) {
|
|
8548
8572
|
return __spreadValues({
|
|
8549
|
-
kind: OpKind.
|
|
8550
|
-
|
|
8573
|
+
kind: OpKind.I18nMessage,
|
|
8574
|
+
xref,
|
|
8575
|
+
i18nBlock,
|
|
8551
8576
|
message,
|
|
8552
|
-
|
|
8553
|
-
params
|
|
8554
|
-
postprocessingParams
|
|
8555
|
-
needsPostprocessing
|
|
8556
|
-
|
|
8557
|
-
formattedPostprocessingParams: null
|
|
8577
|
+
messagePlaceholder,
|
|
8578
|
+
params,
|
|
8579
|
+
postprocessingParams,
|
|
8580
|
+
needsPostprocessing,
|
|
8581
|
+
subMessages: []
|
|
8558
8582
|
}, NEW_OP);
|
|
8559
8583
|
}
|
|
8560
8584
|
function createI18nStartOp(xref, message, root) {
|
|
@@ -8565,7 +8589,8 @@ function createI18nStartOp(xref, message, root) {
|
|
|
8565
8589
|
root: root != null ? root : xref,
|
|
8566
8590
|
message,
|
|
8567
8591
|
messageIndex: null,
|
|
8568
|
-
subTemplateIndex: null
|
|
8592
|
+
subTemplateIndex: null,
|
|
8593
|
+
context: null
|
|
8569
8594
|
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
8570
8595
|
}
|
|
8571
8596
|
function createI18nEndOp(xref) {
|
|
@@ -8574,14 +8599,28 @@ function createI18nEndOp(xref) {
|
|
|
8574
8599
|
xref
|
|
8575
8600
|
}, NEW_OP);
|
|
8576
8601
|
}
|
|
8577
|
-
function createIcuOp(xref, message, sourceSpan) {
|
|
8602
|
+
function createIcuOp(xref, message, icu, messagePlaceholder, sourceSpan) {
|
|
8578
8603
|
return __spreadValues({
|
|
8579
8604
|
kind: OpKind.Icu,
|
|
8580
8605
|
xref,
|
|
8581
8606
|
message,
|
|
8607
|
+
icu,
|
|
8608
|
+
messagePlaceholder,
|
|
8609
|
+
context: null,
|
|
8582
8610
|
sourceSpan
|
|
8583
8611
|
}, NEW_OP);
|
|
8584
8612
|
}
|
|
8613
|
+
function createI18nContextOp(xref, i18nBlock, message, sourceSpan) {
|
|
8614
|
+
return __spreadValues({
|
|
8615
|
+
kind: OpKind.I18nContext,
|
|
8616
|
+
xref,
|
|
8617
|
+
i18nBlock,
|
|
8618
|
+
message,
|
|
8619
|
+
sourceSpan,
|
|
8620
|
+
params: /* @__PURE__ */ new Map(),
|
|
8621
|
+
postprocessingParams: /* @__PURE__ */ new Map()
|
|
8622
|
+
}, NEW_OP);
|
|
8623
|
+
}
|
|
8585
8624
|
|
|
8586
8625
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
|
|
8587
8626
|
function createHostPropertyOp(name, expression, isAnimationTrigger, sourceSpan) {
|
|
@@ -8617,10 +8656,11 @@ var CompilationJob = class {
|
|
|
8617
8656
|
}
|
|
8618
8657
|
};
|
|
8619
8658
|
var ComponentCompilationJob = class extends CompilationJob {
|
|
8620
|
-
constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds) {
|
|
8659
|
+
constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
|
|
8621
8660
|
super(componentName, pool, compatibility);
|
|
8622
8661
|
this.relativeContextFilePath = relativeContextFilePath;
|
|
8623
8662
|
this.i18nUseExternalIds = i18nUseExternalIds;
|
|
8663
|
+
this.deferBlocksMeta = deferBlocksMeta;
|
|
8624
8664
|
this.kind = CompilationJobKind.Tmpl;
|
|
8625
8665
|
this.fnSuffix = "Template";
|
|
8626
8666
|
this.views = /* @__PURE__ */ new Map();
|
|
@@ -8726,7 +8766,7 @@ function applyI18nExpressions(job) {
|
|
|
8726
8766
|
for (const unit of job.units) {
|
|
8727
8767
|
for (const op of unit.update) {
|
|
8728
8768
|
if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
|
|
8729
|
-
OpList.insertAfter(createI18nApplyOp(op.
|
|
8769
|
+
OpList.insertAfter(createI18nApplyOp(op.target, op.handle, null), op);
|
|
8730
8770
|
}
|
|
8731
8771
|
}
|
|
8732
8772
|
}
|
|
@@ -8736,7 +8776,7 @@ function needsApplication(op) {
|
|
|
8736
8776
|
if (((_a2 = op.next) == null ? void 0 : _a2.kind) !== OpKind.I18nExpression) {
|
|
8737
8777
|
return true;
|
|
8738
8778
|
}
|
|
8739
|
-
if (op.next.
|
|
8779
|
+
if (op.next.context !== op.context) {
|
|
8740
8780
|
return true;
|
|
8741
8781
|
}
|
|
8742
8782
|
return false;
|
|
@@ -8745,19 +8785,31 @@ function needsApplication(op) {
|
|
|
8745
8785
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
|
|
8746
8786
|
function assignI18nSlotDependencies(job) {
|
|
8747
8787
|
const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
|
|
8788
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
8748
8789
|
let lastSlotConsumer = null;
|
|
8790
|
+
let currentI18nOp = null;
|
|
8749
8791
|
for (const unit of job.units) {
|
|
8750
8792
|
for (const op of unit.create) {
|
|
8751
|
-
if (op.kind === OpKind.I18nEnd) {
|
|
8752
|
-
i18nLastSlotConsumers.set(op.xref, lastSlotConsumer);
|
|
8753
|
-
}
|
|
8754
8793
|
if (hasConsumesSlotTrait(op)) {
|
|
8755
8794
|
lastSlotConsumer = op.xref;
|
|
8756
8795
|
}
|
|
8796
|
+
switch (op.kind) {
|
|
8797
|
+
case OpKind.I18nStart:
|
|
8798
|
+
currentI18nOp = op;
|
|
8799
|
+
break;
|
|
8800
|
+
case OpKind.I18nEnd:
|
|
8801
|
+
i18nLastSlotConsumers.set(currentI18nOp.xref, lastSlotConsumer);
|
|
8802
|
+
currentI18nOp = null;
|
|
8803
|
+
break;
|
|
8804
|
+
case OpKind.I18nContext:
|
|
8805
|
+
i18nContexts.set(op.xref, op);
|
|
8806
|
+
break;
|
|
8807
|
+
}
|
|
8757
8808
|
}
|
|
8758
8809
|
for (const op of unit.update) {
|
|
8759
8810
|
if (op.kind === OpKind.I18nExpression) {
|
|
8760
|
-
|
|
8811
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
8812
|
+
op.target = i18nLastSlotConsumers.get(i18nContext.i18nBlock);
|
|
8761
8813
|
}
|
|
8762
8814
|
}
|
|
8763
8815
|
}
|
|
@@ -9224,6 +9276,113 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
|
|
|
9224
9276
|
return literalArr(attrArray);
|
|
9225
9277
|
}
|
|
9226
9278
|
|
|
9279
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_defer_deps_fns.mjs
|
|
9280
|
+
function createDeferDepsFns(job) {
|
|
9281
|
+
for (const unit of job.units) {
|
|
9282
|
+
for (const op of unit.create) {
|
|
9283
|
+
if (op.kind === OpKind.Defer) {
|
|
9284
|
+
if (op.metadata.deps.length === 0) {
|
|
9285
|
+
continue;
|
|
9286
|
+
}
|
|
9287
|
+
const dependencies = [];
|
|
9288
|
+
for (const dep of op.metadata.deps) {
|
|
9289
|
+
if (dep.isDeferrable) {
|
|
9290
|
+
const innerFn = arrowFn([new FnParam("m", DYNAMIC_TYPE)], variable("m").prop(dep.symbolName));
|
|
9291
|
+
const importExpr2 = new DynamicImportExpr(dep.importPath).prop("then").callFn([innerFn]);
|
|
9292
|
+
dependencies.push(importExpr2);
|
|
9293
|
+
} else {
|
|
9294
|
+
dependencies.push(dep.type);
|
|
9295
|
+
}
|
|
9296
|
+
}
|
|
9297
|
+
const depsFnExpr = arrowFn([], literalArr(dependencies));
|
|
9298
|
+
if (op.handle.slot === null) {
|
|
9299
|
+
throw new Error("AssertionError: slot must be assigned bfore extracting defer deps functions");
|
|
9300
|
+
}
|
|
9301
|
+
op.resolverFn = job.pool.getSharedFunctionReference(depsFnExpr, `${job.componentName}_Defer_${op.handle.slot}_DepsFn`);
|
|
9302
|
+
}
|
|
9303
|
+
}
|
|
9304
|
+
}
|
|
9305
|
+
}
|
|
9306
|
+
|
|
9307
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_contexts.mjs
|
|
9308
|
+
function createI18nContexts(job) {
|
|
9309
|
+
let currentI18nOp = null;
|
|
9310
|
+
let xref;
|
|
9311
|
+
for (const unit of job.units) {
|
|
9312
|
+
for (const op of unit.create) {
|
|
9313
|
+
switch (op.kind) {
|
|
9314
|
+
case OpKind.I18nStart:
|
|
9315
|
+
xref = job.allocateXrefId();
|
|
9316
|
+
unit.create.push(createI18nContextOp(xref, op.xref, op.message, null));
|
|
9317
|
+
op.context = xref;
|
|
9318
|
+
currentI18nOp = op;
|
|
9319
|
+
break;
|
|
9320
|
+
case OpKind.I18nEnd:
|
|
9321
|
+
currentI18nOp = null;
|
|
9322
|
+
break;
|
|
9323
|
+
case OpKind.Icu:
|
|
9324
|
+
if (currentI18nOp === null) {
|
|
9325
|
+
throw Error("Unexpected ICU outside of an i18n block.");
|
|
9326
|
+
}
|
|
9327
|
+
if (op.message.id !== currentI18nOp.message.id) {
|
|
9328
|
+
xref = job.allocateXrefId();
|
|
9329
|
+
unit.create.push(createI18nContextOp(xref, currentI18nOp.xref, op.message, null));
|
|
9330
|
+
op.context = xref;
|
|
9331
|
+
} else {
|
|
9332
|
+
op.context = currentI18nOp.context;
|
|
9333
|
+
}
|
|
9334
|
+
break;
|
|
9335
|
+
}
|
|
9336
|
+
}
|
|
9337
|
+
}
|
|
9338
|
+
}
|
|
9339
|
+
|
|
9340
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_icu_expressions.mjs
|
|
9341
|
+
function createI18nIcuExpressions(job) {
|
|
9342
|
+
const icus = /* @__PURE__ */ new Map();
|
|
9343
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
9344
|
+
const i18nBlocks = /* @__PURE__ */ new Map();
|
|
9345
|
+
for (const unit of job.units) {
|
|
9346
|
+
for (const op of unit.create) {
|
|
9347
|
+
switch (op.kind) {
|
|
9348
|
+
case OpKind.Icu:
|
|
9349
|
+
icus.set(op.xref, op);
|
|
9350
|
+
break;
|
|
9351
|
+
case OpKind.I18nContext:
|
|
9352
|
+
i18nContexts.set(op.xref, op);
|
|
9353
|
+
break;
|
|
9354
|
+
case OpKind.I18nStart:
|
|
9355
|
+
i18nBlocks.set(op.xref, op);
|
|
9356
|
+
break;
|
|
9357
|
+
}
|
|
9358
|
+
}
|
|
9359
|
+
for (const op of unit.update) {
|
|
9360
|
+
switch (op.kind) {
|
|
9361
|
+
case OpKind.IcuUpdate:
|
|
9362
|
+
const icuOp = icus.get(op.xref);
|
|
9363
|
+
if ((icuOp == null ? void 0 : icuOp.icu.expressionPlaceholder) === void 0) {
|
|
9364
|
+
throw Error("ICU should have an i18n placeholder");
|
|
9365
|
+
}
|
|
9366
|
+
if (icuOp.context === null) {
|
|
9367
|
+
throw Error("ICU should have its i18n context set");
|
|
9368
|
+
}
|
|
9369
|
+
const i18nContext = i18nContexts.get(icuOp.context);
|
|
9370
|
+
const i18nBlock = i18nBlocks.get(i18nContext.i18nBlock);
|
|
9371
|
+
OpList.replace(op, createI18nExpressionOp(
|
|
9372
|
+
i18nContext.xref,
|
|
9373
|
+
i18nBlock.xref,
|
|
9374
|
+
i18nBlock.handle,
|
|
9375
|
+
new LexicalReadExpr(icuOp.icu.expression),
|
|
9376
|
+
icuOp.icu.expressionPlaceholder,
|
|
9377
|
+
I18nParamResolutionTime.Postproccessing,
|
|
9378
|
+
null
|
|
9379
|
+
));
|
|
9380
|
+
break;
|
|
9381
|
+
}
|
|
9382
|
+
}
|
|
9383
|
+
}
|
|
9384
|
+
}
|
|
9385
|
+
|
|
9227
9386
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_configs.mjs
|
|
9228
9387
|
function configureDeferInstructions(job) {
|
|
9229
9388
|
for (const unit of job.units) {
|
|
@@ -9276,6 +9435,22 @@ function resolveDeferTargetNames(job) {
|
|
|
9276
9435
|
case DeferTriggerKind.Interaction:
|
|
9277
9436
|
case DeferTriggerKind.Viewport:
|
|
9278
9437
|
if (op.trigger.targetName === null) {
|
|
9438
|
+
if (placeholderView === null) {
|
|
9439
|
+
throw new Error("defer on trigger with no target name must have a placeholder block");
|
|
9440
|
+
}
|
|
9441
|
+
const placeholder = job.views.get(placeholderView);
|
|
9442
|
+
if (placeholder == void 0) {
|
|
9443
|
+
throw new Error("AssertionError: could not find placeholder view for defer on trigger");
|
|
9444
|
+
}
|
|
9445
|
+
for (const placeholderOp of placeholder.create) {
|
|
9446
|
+
if (hasConsumesSlotTrait(placeholderOp) && (isElementOrContainerOp(placeholderOp) || placeholderOp.kind === OpKind.Projection)) {
|
|
9447
|
+
op.trigger.targetXref = placeholderOp.xref;
|
|
9448
|
+
op.trigger.targetView = placeholderView;
|
|
9449
|
+
op.trigger.targetSlotViewSteps = -1;
|
|
9450
|
+
op.trigger.targetSlot = placeholderOp.handle;
|
|
9451
|
+
return;
|
|
9452
|
+
}
|
|
9453
|
+
}
|
|
9279
9454
|
return;
|
|
9280
9455
|
}
|
|
9281
9456
|
let view = placeholderView !== null ? job.views.get(placeholderView) : deferOwnerView;
|
|
@@ -9482,7 +9657,7 @@ function ternaryTransform(e) {
|
|
|
9482
9657
|
return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
|
|
9483
9658
|
}
|
|
9484
9659
|
|
|
9485
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/
|
|
9660
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/extract_i18n_messages.mjs
|
|
9486
9661
|
var ESCAPE = "\uFFFD";
|
|
9487
9662
|
var ELEMENT_MARKER = "#";
|
|
9488
9663
|
var TEMPLATE_MARKER = "*";
|
|
@@ -9491,24 +9666,61 @@ var CONTEXT_MARKER = ":";
|
|
|
9491
9666
|
var LIST_START_MARKER = "[";
|
|
9492
9667
|
var LIST_END_MARKER = "]";
|
|
9493
9668
|
var LIST_DELIMITER = "|";
|
|
9494
|
-
function
|
|
9669
|
+
function extractI18nMessages(job) {
|
|
9670
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
9671
|
+
const i18nBlockContexts = /* @__PURE__ */ new Set();
|
|
9495
9672
|
for (const unit of job.units) {
|
|
9496
9673
|
for (const op of unit.create) {
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
op.
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9674
|
+
switch (op.kind) {
|
|
9675
|
+
case OpKind.I18nContext:
|
|
9676
|
+
i18nContexts.set(op.xref, op);
|
|
9677
|
+
break;
|
|
9678
|
+
case OpKind.I18nStart:
|
|
9679
|
+
i18nBlockContexts.add(op.context);
|
|
9680
|
+
break;
|
|
9681
|
+
}
|
|
9682
|
+
}
|
|
9683
|
+
}
|
|
9684
|
+
const i18nBlockMessages = /* @__PURE__ */ new Map();
|
|
9685
|
+
for (const unit of job.units) {
|
|
9686
|
+
for (const op of unit.create) {
|
|
9687
|
+
if (op.kind === OpKind.I18nStart && op.xref === op.root) {
|
|
9688
|
+
if (!op.context) {
|
|
9689
|
+
throw Error("I18n start op should have its context set.");
|
|
9690
|
+
}
|
|
9691
|
+
const i18nMessageOp = createI18nMessage(job, i18nContexts.get(op.context));
|
|
9692
|
+
i18nBlockMessages.set(op.xref, i18nMessageOp);
|
|
9693
|
+
unit.create.push(i18nMessageOp);
|
|
9694
|
+
}
|
|
9695
|
+
}
|
|
9696
|
+
}
|
|
9697
|
+
for (const unit of job.units) {
|
|
9698
|
+
for (const op of unit.create) {
|
|
9699
|
+
if (op.kind === OpKind.Icu) {
|
|
9700
|
+
if (!op.context) {
|
|
9701
|
+
throw Error("ICU op should have its context set.");
|
|
9702
|
+
}
|
|
9703
|
+
if (!i18nBlockContexts.has(op.context)) {
|
|
9704
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
9705
|
+
const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
|
|
9706
|
+
unit.create.push(subMessage);
|
|
9707
|
+
const parentMessage = i18nBlockMessages.get(i18nContext.i18nBlock);
|
|
9708
|
+
parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
|
|
9507
9709
|
}
|
|
9710
|
+
OpList.remove(op);
|
|
9508
9711
|
}
|
|
9509
9712
|
}
|
|
9510
9713
|
}
|
|
9511
9714
|
}
|
|
9715
|
+
function createI18nMessage(job, context, messagePlaceholder) {
|
|
9716
|
+
let needsPostprocessing = context.postprocessingParams.size > 0;
|
|
9717
|
+
for (const values of context.params.values()) {
|
|
9718
|
+
if (values.length > 1) {
|
|
9719
|
+
needsPostprocessing = true;
|
|
9720
|
+
}
|
|
9721
|
+
}
|
|
9722
|
+
return createI18nMessageOp(job.allocateXrefId(), context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formatParams(context.params), formatParams(context.postprocessingParams), needsPostprocessing);
|
|
9723
|
+
}
|
|
9512
9724
|
function formatParams(params) {
|
|
9513
9725
|
const result = /* @__PURE__ */ new Map();
|
|
9514
9726
|
for (const [placeholder, placeholderValues] of [...params].sort()) {
|
|
@@ -15416,8 +15628,8 @@ var I18nMetaVisitor = class {
|
|
|
15416
15628
|
}
|
|
15417
15629
|
_generateI18nMessage(nodes, meta = "", visitNodeFn) {
|
|
15418
15630
|
const { meaning, description, customId } = this._parseMetadata(meta);
|
|
15419
|
-
const
|
|
15420
|
-
const message =
|
|
15631
|
+
const createI18nMessage2 = createI18nMessageFactory(this.interpolationConfig);
|
|
15632
|
+
const message = createI18nMessage2(nodes, meaning, description, customId, visitNodeFn);
|
|
15421
15633
|
this._setMessageId(message, meta);
|
|
15422
15634
|
this._setLegacyIds(message, meta);
|
|
15423
15635
|
return message;
|
|
@@ -15689,28 +15901,21 @@ var TRANSLATION_VAR_PREFIX2 = "i18n_";
|
|
|
15689
15901
|
function collectI18nConsts(job) {
|
|
15690
15902
|
const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
|
|
15691
15903
|
const messageConstIndices = /* @__PURE__ */ new Map();
|
|
15904
|
+
const messages = /* @__PURE__ */ new Map();
|
|
15692
15905
|
for (const unit of job.units) {
|
|
15693
15906
|
for (const op of unit.create) {
|
|
15694
|
-
if (op.kind === OpKind.
|
|
15695
|
-
|
|
15696
|
-
assertAllParamsResolved(op);
|
|
15697
|
-
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
|
|
15698
|
-
const closureVar = i18nGenerateClosureVar(job.pool, op.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
15699
|
-
let transformFn = void 0;
|
|
15700
|
-
if (op.needsPostprocessing) {
|
|
15701
|
-
const extraTransformFnParams = [];
|
|
15702
|
-
if (op.formattedPostprocessingParams.size > 0) {
|
|
15703
|
-
extraTransformFnParams.push(literalMap([...op.formattedPostprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
|
|
15704
|
-
}
|
|
15705
|
-
transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
|
|
15706
|
-
}
|
|
15707
|
-
const statements = getTranslationDeclStmts(op.message, mainVar, closureVar, op.formattedParams, transformFn);
|
|
15708
|
-
messageConstIndices.set(op.owner, job.addConst(mainVar, statements));
|
|
15709
|
-
}
|
|
15907
|
+
if (op.kind === OpKind.I18nMessage) {
|
|
15908
|
+
messages.set(op.xref, op);
|
|
15710
15909
|
OpList.remove(op);
|
|
15711
15910
|
}
|
|
15712
15911
|
}
|
|
15713
15912
|
}
|
|
15913
|
+
for (const op of messages.values()) {
|
|
15914
|
+
if (op.kind === OpKind.I18nMessage && op.messagePlaceholder === null) {
|
|
15915
|
+
const { mainVar, statements } = collectMessage(job, fileBasedI18nSuffix, messages, op);
|
|
15916
|
+
messageConstIndices.set(op.i18nBlock, job.addConst(mainVar, statements));
|
|
15917
|
+
}
|
|
15918
|
+
}
|
|
15714
15919
|
for (const unit of job.units) {
|
|
15715
15920
|
for (const op of unit.create) {
|
|
15716
15921
|
if (op.kind === OpKind.I18nStart) {
|
|
@@ -15719,6 +15924,28 @@ function collectI18nConsts(job) {
|
|
|
15719
15924
|
}
|
|
15720
15925
|
}
|
|
15721
15926
|
}
|
|
15927
|
+
function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
15928
|
+
const statements = [];
|
|
15929
|
+
for (const subMessageId of messageOp.subMessages) {
|
|
15930
|
+
const subMessage = messages.get(subMessageId);
|
|
15931
|
+
const { mainVar: subMessageVar, statements: subMessageStatements } = collectMessage(job, fileBasedI18nSuffix, messages, subMessage);
|
|
15932
|
+
statements.push(...subMessageStatements);
|
|
15933
|
+
messageOp.params.set(subMessage.messagePlaceholder, subMessageVar);
|
|
15934
|
+
}
|
|
15935
|
+
assertAllParamsResolved(messageOp);
|
|
15936
|
+
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
|
|
15937
|
+
const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
15938
|
+
let transformFn = void 0;
|
|
15939
|
+
if (messageOp.needsPostprocessing) {
|
|
15940
|
+
const extraTransformFnParams = [];
|
|
15941
|
+
if (messageOp.postprocessingParams.size > 0) {
|
|
15942
|
+
extraTransformFnParams.push(literalMap([...messageOp.postprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
|
|
15943
|
+
}
|
|
15944
|
+
transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
|
|
15945
|
+
}
|
|
15946
|
+
statements.push(...getTranslationDeclStmts(messageOp.message, mainVar, closureVar, messageOp.params, transformFn));
|
|
15947
|
+
return { mainVar, statements };
|
|
15948
|
+
}
|
|
15722
15949
|
function getTranslationDeclStmts(message, variable2, closureVar, params, transformFn) {
|
|
15723
15950
|
const paramsObject = Object.fromEntries(params);
|
|
15724
15951
|
const statements = [
|
|
@@ -15747,52 +15974,38 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
|
|
|
15747
15974
|
return variable(name);
|
|
15748
15975
|
}
|
|
15749
15976
|
function assertAllParamsResolved(op) {
|
|
15750
|
-
if (op.formattedParams === null || op.formattedPostprocessingParams === null) {
|
|
15751
|
-
throw Error("Params should have been formatted.");
|
|
15752
|
-
}
|
|
15753
15977
|
for (const placeholder in op.message.placeholders) {
|
|
15754
|
-
if (!op.
|
|
15978
|
+
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
15755
15979
|
throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
|
|
15756
15980
|
}
|
|
15757
15981
|
}
|
|
15758
15982
|
for (const placeholder in op.message.placeholderToMessage) {
|
|
15759
|
-
if (!op.
|
|
15983
|
+
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
15760
15984
|
throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
|
|
15761
15985
|
}
|
|
15762
15986
|
}
|
|
15763
15987
|
}
|
|
15764
15988
|
|
|
15765
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_message_extraction.mjs
|
|
15766
|
-
function extractI18nMessages(job) {
|
|
15767
|
-
for (const unit of job.units) {
|
|
15768
|
-
for (const op of unit.create) {
|
|
15769
|
-
if (op.kind === OpKind.I18nStart) {
|
|
15770
|
-
unit.create.push(createExtractedMessageOp(op.xref, op.message, op.xref === op.root));
|
|
15771
|
-
}
|
|
15772
|
-
}
|
|
15773
|
-
}
|
|
15774
|
-
}
|
|
15775
|
-
|
|
15776
15989
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
|
|
15777
15990
|
function extractI18nText(job) {
|
|
15778
15991
|
var _a2;
|
|
15779
15992
|
for (const unit of job.units) {
|
|
15780
|
-
let
|
|
15781
|
-
|
|
15782
|
-
const textNodes = /* @__PURE__ */ new Map();
|
|
15993
|
+
let currentI18n = null;
|
|
15994
|
+
const textNodeI18nBlocks = /* @__PURE__ */ new Map();
|
|
15783
15995
|
for (const op of unit.create) {
|
|
15784
15996
|
switch (op.kind) {
|
|
15785
15997
|
case OpKind.I18nStart:
|
|
15786
|
-
|
|
15787
|
-
|
|
15998
|
+
if (op.context === null) {
|
|
15999
|
+
throw Error("I18n op should have its context set.");
|
|
16000
|
+
}
|
|
16001
|
+
currentI18n = op;
|
|
15788
16002
|
break;
|
|
15789
16003
|
case OpKind.I18nEnd:
|
|
15790
|
-
|
|
15791
|
-
currentI18nSlot = null;
|
|
16004
|
+
currentI18n = null;
|
|
15792
16005
|
break;
|
|
15793
16006
|
case OpKind.Text:
|
|
15794
|
-
if (
|
|
15795
|
-
|
|
16007
|
+
if (currentI18n !== null) {
|
|
16008
|
+
textNodeI18nBlocks.set(op.xref, currentI18n);
|
|
15796
16009
|
OpList.remove(op);
|
|
15797
16010
|
}
|
|
15798
16011
|
break;
|
|
@@ -15801,17 +16014,15 @@ function extractI18nText(job) {
|
|
|
15801
16014
|
for (const op of unit.update) {
|
|
15802
16015
|
switch (op.kind) {
|
|
15803
16016
|
case OpKind.InterpolateText:
|
|
15804
|
-
if (!
|
|
16017
|
+
if (!textNodeI18nBlocks.has(op.target)) {
|
|
15805
16018
|
continue;
|
|
15806
16019
|
}
|
|
15807
|
-
const
|
|
16020
|
+
const i18nOp = textNodeI18nBlocks.get(op.target);
|
|
15808
16021
|
const ops = [];
|
|
15809
16022
|
for (let i = 0; i < op.interpolation.expressions.length; i++) {
|
|
15810
16023
|
const expr = op.interpolation.expressions[i];
|
|
15811
16024
|
const placeholder = op.i18nPlaceholders[i];
|
|
15812
|
-
ops.push(createI18nExpressionOp(
|
|
15813
|
-
}
|
|
15814
|
-
if (ops.length > 0) {
|
|
16025
|
+
ops.push(createI18nExpressionOp(i18nOp.context, i18nOp.xref, i18nOp.handle, expr, placeholder.name, I18nParamResolutionTime.Creation, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
|
|
15815
16026
|
}
|
|
15816
16027
|
OpList.replaceWithMany(op, ops);
|
|
15817
16028
|
break;
|
|
@@ -15820,49 +16031,6 @@ function extractI18nText(job) {
|
|
|
15820
16031
|
}
|
|
15821
16032
|
}
|
|
15822
16033
|
|
|
15823
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/icu_extraction.mjs
|
|
15824
|
-
function extractI18nICUs(job) {
|
|
15825
|
-
for (const unit of job.units) {
|
|
15826
|
-
const icus = /* @__PURE__ */ new Map();
|
|
15827
|
-
let currentI18nId = null;
|
|
15828
|
-
let currentI18nSlot = null;
|
|
15829
|
-
for (const op of unit.create) {
|
|
15830
|
-
switch (op.kind) {
|
|
15831
|
-
case OpKind.I18nStart:
|
|
15832
|
-
currentI18nId = op.xref;
|
|
15833
|
-
currentI18nSlot = op.handle;
|
|
15834
|
-
break;
|
|
15835
|
-
case OpKind.I18nEnd:
|
|
15836
|
-
currentI18nId = null;
|
|
15837
|
-
currentI18nSlot = null;
|
|
15838
|
-
break;
|
|
15839
|
-
case OpKind.Icu:
|
|
15840
|
-
if (currentI18nId === null) {
|
|
15841
|
-
throw Error("Unexpected ICU outside of an i18n block.");
|
|
15842
|
-
}
|
|
15843
|
-
icus.set(op.xref, { message: op.message, i18nBlockId: currentI18nId, i18nBlockSlot: currentI18nSlot });
|
|
15844
|
-
OpList.remove(op);
|
|
15845
|
-
break;
|
|
15846
|
-
}
|
|
15847
|
-
}
|
|
15848
|
-
for (const op of unit.update) {
|
|
15849
|
-
switch (op.kind) {
|
|
15850
|
-
case OpKind.IcuUpdate:
|
|
15851
|
-
const { message, i18nBlockId, i18nBlockSlot } = icus.get(op.xref);
|
|
15852
|
-
const icuNode = message.nodes.find((n) => n instanceof Icu2);
|
|
15853
|
-
if (icuNode === void 0) {
|
|
15854
|
-
throw Error("Could not find ICU in i18n AST");
|
|
15855
|
-
}
|
|
15856
|
-
if (icuNode.expressionPlaceholder === void 0) {
|
|
15857
|
-
throw Error("ICU is missing an i18n placeholder");
|
|
15858
|
-
}
|
|
15859
|
-
OpList.replace(op, createI18nExpressionOp(i18nBlockId, i18nBlockSlot, new LexicalReadExpr(icuNode.expression), icuNode.expressionPlaceholder, I18nParamResolutionTime.Postproccessing, null));
|
|
15860
|
-
break;
|
|
15861
|
-
}
|
|
15862
|
-
}
|
|
15863
|
-
}
|
|
15864
|
-
}
|
|
15865
|
-
|
|
15866
16034
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
|
|
15867
16035
|
function liftLocalRefs(job) {
|
|
15868
16036
|
for (const unit of job.units) {
|
|
@@ -15893,6 +16061,47 @@ function serializeLocalRefs(refs) {
|
|
|
15893
16061
|
return literalArr(constRefs);
|
|
15894
16062
|
}
|
|
15895
16063
|
|
|
16064
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/merge_i18n_contexts.mjs
|
|
16065
|
+
function mergeI18nContexts(job) {
|
|
16066
|
+
const i18nOps = /* @__PURE__ */ new Map();
|
|
16067
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
16068
|
+
for (const unit of job.units) {
|
|
16069
|
+
for (const op of unit.create) {
|
|
16070
|
+
switch (op.kind) {
|
|
16071
|
+
case OpKind.I18nStart:
|
|
16072
|
+
if (!op.context) {
|
|
16073
|
+
throw Error("I18n op should have its context set.");
|
|
16074
|
+
}
|
|
16075
|
+
i18nOps.set(op.xref, op);
|
|
16076
|
+
break;
|
|
16077
|
+
case OpKind.I18nContext:
|
|
16078
|
+
i18nContexts.set(op.xref, op);
|
|
16079
|
+
break;
|
|
16080
|
+
}
|
|
16081
|
+
}
|
|
16082
|
+
}
|
|
16083
|
+
for (const childI18nOp of i18nOps.values()) {
|
|
16084
|
+
if (childI18nOp.xref !== childI18nOp.root) {
|
|
16085
|
+
const childContext = i18nContexts.get(childI18nOp.context);
|
|
16086
|
+
const rootI18nOp = i18nOps.get(childI18nOp.root);
|
|
16087
|
+
const rootContext = i18nContexts.get(rootI18nOp.context);
|
|
16088
|
+
mergeParams(rootContext.params, childContext.params);
|
|
16089
|
+
mergeParams(rootContext.postprocessingParams, childContext.postprocessingParams);
|
|
16090
|
+
}
|
|
16091
|
+
}
|
|
16092
|
+
}
|
|
16093
|
+
function mergeParams(to, from) {
|
|
16094
|
+
for (const [placeholder, fromValues] of from) {
|
|
16095
|
+
const toValues = to.get(placeholder) || [];
|
|
16096
|
+
const flags = fromValues[0].flags;
|
|
16097
|
+
if (flags & I18nParamValueFlags.CloseTag && !(flags & I18nParamValueFlags.OpenTag)) {
|
|
16098
|
+
to.set(placeholder, [...fromValues, ...toValues]);
|
|
16099
|
+
} else {
|
|
16100
|
+
to.set(placeholder, [...toValues, ...fromValues]);
|
|
16101
|
+
}
|
|
16102
|
+
}
|
|
16103
|
+
}
|
|
16104
|
+
|
|
15896
16105
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/namespace.mjs
|
|
15897
16106
|
function emitNamespaceChanges(job) {
|
|
15898
16107
|
for (const unit of job.units) {
|
|
@@ -16417,49 +16626,6 @@ function wrapTemplateWithI18n(unit, parentI18n) {
|
|
|
16417
16626
|
}
|
|
16418
16627
|
}
|
|
16419
16628
|
|
|
16420
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_placeholders.mjs
|
|
16421
|
-
function propogateI18nPlaceholders(job) {
|
|
16422
|
-
const i18nOps = /* @__PURE__ */ new Map();
|
|
16423
|
-
const extractedMessageOps = /* @__PURE__ */ new Map();
|
|
16424
|
-
for (const unit of job.units) {
|
|
16425
|
-
for (const op of unit.create) {
|
|
16426
|
-
switch (op.kind) {
|
|
16427
|
-
case OpKind.I18nStart:
|
|
16428
|
-
i18nOps.set(op.xref, op);
|
|
16429
|
-
break;
|
|
16430
|
-
case OpKind.ExtractedMessage:
|
|
16431
|
-
extractedMessageOps.set(op.owner, op);
|
|
16432
|
-
break;
|
|
16433
|
-
}
|
|
16434
|
-
}
|
|
16435
|
-
}
|
|
16436
|
-
for (const [xref, childExtractedMessageOp] of extractedMessageOps) {
|
|
16437
|
-
if (!childExtractedMessageOp.isRoot) {
|
|
16438
|
-
const i18nOp = i18nOps.get(xref);
|
|
16439
|
-
if (i18nOp === void 0) {
|
|
16440
|
-
throw Error("Could not find owner i18n block for extracted message.");
|
|
16441
|
-
}
|
|
16442
|
-
const rootExtractedMessageOp = extractedMessageOps.get(i18nOp.root);
|
|
16443
|
-
if (rootExtractedMessageOp === void 0) {
|
|
16444
|
-
throw Error("Could not find extracted message op for root i18n block.");
|
|
16445
|
-
}
|
|
16446
|
-
mergeParams(rootExtractedMessageOp.params, childExtractedMessageOp.params);
|
|
16447
|
-
mergeParams(rootExtractedMessageOp.postprocessingParams, childExtractedMessageOp.postprocessingParams);
|
|
16448
|
-
}
|
|
16449
|
-
}
|
|
16450
|
-
}
|
|
16451
|
-
function mergeParams(to, from) {
|
|
16452
|
-
for (const [placeholder, fromValues] of from) {
|
|
16453
|
-
const toValues = to.get(placeholder) || [];
|
|
16454
|
-
const flags = fromValues[0].flags;
|
|
16455
|
-
if (flags & I18nParamValueFlags.CloseTag && !(flags & I18nParamValueFlags.OpenTag)) {
|
|
16456
|
-
to.set(placeholder, [...fromValues, ...toValues]);
|
|
16457
|
-
} else {
|
|
16458
|
-
to.set(placeholder, [...toValues, ...fromValues]);
|
|
16459
|
-
}
|
|
16460
|
-
}
|
|
16461
|
-
}
|
|
16462
|
-
|
|
16463
16629
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
|
|
16464
16630
|
function extractPureFunctions(job) {
|
|
16465
16631
|
for (const view of job.units) {
|
|
@@ -16583,13 +16749,21 @@ function elementContainer(slot, constIndex, localRefIndex, sourceSpan) {
|
|
|
16583
16749
|
function elementContainerEnd() {
|
|
16584
16750
|
return call(Identifiers.elementContainerEnd, [], null);
|
|
16585
16751
|
}
|
|
16586
|
-
function template(slot, templateFnRef, decls, vars, tag, constIndex, sourceSpan) {
|
|
16587
|
-
const args = [
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16752
|
+
function template(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
16753
|
+
const args = [
|
|
16754
|
+
literal(slot),
|
|
16755
|
+
templateFnRef,
|
|
16756
|
+
literal(decls),
|
|
16757
|
+
literal(vars),
|
|
16758
|
+
literal(tag),
|
|
16759
|
+
literal(constIndex)
|
|
16760
|
+
];
|
|
16761
|
+
if (localRefs !== null) {
|
|
16762
|
+
args.push(literal(localRefs));
|
|
16763
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
16764
|
+
}
|
|
16765
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
16766
|
+
args.pop();
|
|
16593
16767
|
}
|
|
16594
16768
|
return call(Identifiers.templateCreate, args, sourceSpan);
|
|
16595
16769
|
}
|
|
@@ -16663,7 +16837,7 @@ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeho
|
|
|
16663
16837
|
const args = [
|
|
16664
16838
|
literal(selfSlot),
|
|
16665
16839
|
literal(primarySlot),
|
|
16666
|
-
literal(
|
|
16840
|
+
dependencyResolverFn != null ? dependencyResolverFn : literal(null),
|
|
16667
16841
|
literal(loadingSlot),
|
|
16668
16842
|
literal(placeholderSlot),
|
|
16669
16843
|
literal(errorSlot),
|
|
@@ -16743,6 +16917,9 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
|
|
|
16743
16917
|
function repeater(metadataSlot, collection, sourceSpan) {
|
|
16744
16918
|
return call(Identifiers.repeater, [literal(metadataSlot), collection], sourceSpan);
|
|
16745
16919
|
}
|
|
16920
|
+
function deferWhen(prefetch, expr, sourceSpan) {
|
|
16921
|
+
return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
|
|
16922
|
+
}
|
|
16746
16923
|
function i18n(slot, constIndex, subTemplateIndex) {
|
|
16747
16924
|
const args = [literal(slot), literal(constIndex)];
|
|
16748
16925
|
if (subTemplateIndex) {
|
|
@@ -17103,8 +17280,11 @@ function reifyCreateOperations(unit, ops) {
|
|
|
17103
17280
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
17104
17281
|
throw new Error(`AssertionError: must be compiling a component`);
|
|
17105
17282
|
}
|
|
17283
|
+
if (Array.isArray(op.localRefs)) {
|
|
17284
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
17285
|
+
}
|
|
17106
17286
|
const childView = unit.job.views.get(op.xref);
|
|
17107
|
-
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.sourceSpan));
|
|
17287
|
+
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.sourceSpan));
|
|
17108
17288
|
break;
|
|
17109
17289
|
case OpKind.DisableBindings:
|
|
17110
17290
|
OpList.replace(op, disableBindings2());
|
|
@@ -17141,7 +17321,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
17141
17321
|
break;
|
|
17142
17322
|
case OpKind.Defer:
|
|
17143
17323
|
const timerScheduling = !!op.loadingMinimumTime || !!op.loadingAfterTime || !!op.placeholderMinimumTime;
|
|
17144
|
-
OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot,
|
|
17324
|
+
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));
|
|
17145
17325
|
break;
|
|
17146
17326
|
case OpKind.DeferOn:
|
|
17147
17327
|
let args = [];
|
|
@@ -17254,7 +17434,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
17254
17434
|
OpList.replace(op, i18nExp(op.expression, op.sourceSpan));
|
|
17255
17435
|
break;
|
|
17256
17436
|
case OpKind.I18nApply:
|
|
17257
|
-
OpList.replace(op, i18nApply(op.
|
|
17437
|
+
OpList.replace(op, i18nApply(op.handle.slot, op.sourceSpan));
|
|
17258
17438
|
break;
|
|
17259
17439
|
case OpKind.InterpolateText:
|
|
17260
17440
|
OpList.replace(op, textInterpolate(op.interpolation.strings, op.interpolation.expressions, op.sourceSpan));
|
|
@@ -17295,6 +17475,9 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
17295
17475
|
case OpKind.Repeater:
|
|
17296
17476
|
OpList.replace(op, repeater(op.targetSlot.slot, op.collection, op.sourceSpan));
|
|
17297
17477
|
break;
|
|
17478
|
+
case OpKind.DeferWhen:
|
|
17479
|
+
OpList.replace(op, deferWhen(op.prefetch, op.expr, op.sourceSpan));
|
|
17480
|
+
break;
|
|
17298
17481
|
case OpKind.Statement:
|
|
17299
17482
|
break;
|
|
17300
17483
|
default:
|
|
@@ -17393,6 +17576,22 @@ function removeEmptyBindings(job) {
|
|
|
17393
17576
|
}
|
|
17394
17577
|
}
|
|
17395
17578
|
|
|
17579
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_i18n_contexts.mjs
|
|
17580
|
+
function removeI18nContexts(job) {
|
|
17581
|
+
for (const unit of job.units) {
|
|
17582
|
+
for (const op of unit.create) {
|
|
17583
|
+
switch (op.kind) {
|
|
17584
|
+
case OpKind.I18nContext:
|
|
17585
|
+
OpList.remove(op);
|
|
17586
|
+
break;
|
|
17587
|
+
case OpKind.I18nStart:
|
|
17588
|
+
op.context = null;
|
|
17589
|
+
break;
|
|
17590
|
+
}
|
|
17591
|
+
}
|
|
17592
|
+
}
|
|
17593
|
+
}
|
|
17594
|
+
|
|
17396
17595
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
|
|
17397
17596
|
function generateRepeaterDerivedVars(job) {
|
|
17398
17597
|
const repeaters = /* @__PURE__ */ new Map();
|
|
@@ -17489,13 +17688,13 @@ function transformDollarEvent(unit, ops) {
|
|
|
17489
17688
|
|
|
17490
17689
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_element_placeholders.mjs
|
|
17491
17690
|
function resolveI18nElementPlaceholders(job) {
|
|
17492
|
-
const
|
|
17691
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
17493
17692
|
const elements = /* @__PURE__ */ new Map();
|
|
17494
17693
|
for (const unit of job.units) {
|
|
17495
17694
|
for (const op of unit.create) {
|
|
17496
17695
|
switch (op.kind) {
|
|
17497
|
-
case OpKind.
|
|
17498
|
-
|
|
17696
|
+
case OpKind.I18nContext:
|
|
17697
|
+
i18nContexts.set(op.xref, op);
|
|
17499
17698
|
break;
|
|
17500
17699
|
case OpKind.ElementStart:
|
|
17501
17700
|
elements.set(op.xref, op);
|
|
@@ -17508,10 +17707,10 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
17508
17707
|
for (const op of unit.create) {
|
|
17509
17708
|
switch (op.kind) {
|
|
17510
17709
|
case OpKind.I18nStart:
|
|
17511
|
-
if (!
|
|
17512
|
-
throw Error("Could not find
|
|
17710
|
+
if (!op.context) {
|
|
17711
|
+
throw Error("Could not find i18n context for i18n op");
|
|
17513
17712
|
}
|
|
17514
|
-
currentOps = {
|
|
17713
|
+
currentOps = { i18nBlock: op, i18nContext: i18nContexts.get(op.context) };
|
|
17515
17714
|
break;
|
|
17516
17715
|
case OpKind.I18nEnd:
|
|
17517
17716
|
currentOps = null;
|
|
@@ -17526,7 +17725,7 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
17526
17725
|
if (closeName === "") {
|
|
17527
17726
|
flags |= I18nParamValueFlags.CloseTag;
|
|
17528
17727
|
}
|
|
17529
|
-
addParam(currentOps.
|
|
17728
|
+
addParam(currentOps.i18nContext.params, startName, op.handle.slot, currentOps.i18nBlock.subTemplateIndex, flags);
|
|
17530
17729
|
}
|
|
17531
17730
|
break;
|
|
17532
17731
|
case OpKind.ElementEnd:
|
|
@@ -17537,7 +17736,7 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
17537
17736
|
}
|
|
17538
17737
|
const { closeName } = startOp.i18nPlaceholder;
|
|
17539
17738
|
if (closeName !== "") {
|
|
17540
|
-
addParam(currentOps.
|
|
17739
|
+
addParam(currentOps.i18nContext.params, closeName, startOp.handle.slot, currentOps.i18nBlock.subTemplateIndex, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
|
|
17541
17740
|
}
|
|
17542
17741
|
}
|
|
17543
17742
|
break;
|
|
@@ -17546,9 +17745,9 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
17546
17745
|
if (currentOps === null) {
|
|
17547
17746
|
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
17548
17747
|
}
|
|
17549
|
-
const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.
|
|
17550
|
-
addParam(currentOps.
|
|
17551
|
-
addParam(currentOps.
|
|
17748
|
+
const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.i18nBlock, op);
|
|
17749
|
+
addParam(currentOps.i18nContext.params, op.i18nPlaceholder.startName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag);
|
|
17750
|
+
addParam(currentOps.i18nContext.params, op.i18nPlaceholder.closeName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
|
|
17552
17751
|
}
|
|
17553
17752
|
break;
|
|
17554
17753
|
}
|
|
@@ -17572,16 +17771,16 @@ function addParam(params, placeholder, value, subTemplateIndex, flags = I18nPara
|
|
|
17572
17771
|
|
|
17573
17772
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs
|
|
17574
17773
|
function resolveI18nExpressionPlaceholders(job) {
|
|
17575
|
-
const
|
|
17576
|
-
const
|
|
17774
|
+
const subTemplateIndicies = /* @__PURE__ */ new Map();
|
|
17775
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
17577
17776
|
for (const unit of job.units) {
|
|
17578
17777
|
for (const op of unit.create) {
|
|
17579
17778
|
switch (op.kind) {
|
|
17580
17779
|
case OpKind.I18nStart:
|
|
17581
|
-
|
|
17780
|
+
subTemplateIndicies.set(op.xref, op.subTemplateIndex);
|
|
17582
17781
|
break;
|
|
17583
|
-
case OpKind.
|
|
17584
|
-
|
|
17782
|
+
case OpKind.I18nContext:
|
|
17783
|
+
i18nContexts.set(op.xref, op);
|
|
17585
17784
|
break;
|
|
17586
17785
|
}
|
|
17587
17786
|
}
|
|
@@ -17590,24 +17789,14 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
17590
17789
|
for (const unit of job.units) {
|
|
17591
17790
|
for (const op of unit.update) {
|
|
17592
17791
|
if (op.kind === OpKind.I18nExpression) {
|
|
17593
|
-
const
|
|
17594
|
-
|
|
17595
|
-
|
|
17596
|
-
|
|
17597
|
-
}
|
|
17598
|
-
const extractedMessageOp = extractedMessageOps.get(i18nOp.xref);
|
|
17599
|
-
if (!extractedMessageOp) {
|
|
17600
|
-
throw Error("Cannot find extracted message for i18n block");
|
|
17601
|
-
}
|
|
17602
|
-
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? extractedMessageOp.params : extractedMessageOp.postprocessingParams;
|
|
17792
|
+
const index = expressionIndices.get(op.context) || 0;
|
|
17793
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
17794
|
+
const subTemplateIndex = subTemplateIndicies.get(i18nContext.i18nBlock);
|
|
17795
|
+
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
|
|
17603
17796
|
const values = params.get(op.i18nPlaceholder) || [];
|
|
17604
|
-
values.push({
|
|
17605
|
-
value: index,
|
|
17606
|
-
subTemplateIndex: i18nOp.subTemplateIndex,
|
|
17607
|
-
flags: I18nParamValueFlags.None
|
|
17608
|
-
});
|
|
17797
|
+
values.push({ value: index, subTemplateIndex, flags: I18nParamValueFlags.None });
|
|
17609
17798
|
params.set(op.i18nPlaceholder, values);
|
|
17610
|
-
expressionIndices.set(op.
|
|
17799
|
+
expressionIndices.set(op.context, index + 1);
|
|
17611
17800
|
}
|
|
17612
17801
|
}
|
|
17613
17802
|
}
|
|
@@ -18358,6 +18547,7 @@ var phases = [
|
|
|
18358
18547
|
{ kind: CompilationJobKind.Both, fn: specializeBindings },
|
|
18359
18548
|
{ kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
|
|
18360
18549
|
{ kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
|
|
18550
|
+
{ kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
|
|
18361
18551
|
{ kind: CompilationJobKind.Both, fn: extractAttributes },
|
|
18362
18552
|
{ kind: CompilationJobKind.Both, fn: parseExtractedStyles },
|
|
18363
18553
|
{ kind: CompilationJobKind.Tmpl, fn: removeEmptyBindings },
|
|
@@ -18367,7 +18557,7 @@ var phases = [
|
|
|
18367
18557
|
{ kind: CompilationJobKind.Tmpl, fn: createPipes },
|
|
18368
18558
|
{ kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
|
|
18369
18559
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nText },
|
|
18370
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
18560
|
+
{ kind: CompilationJobKind.Tmpl, fn: createI18nIcuExpressions },
|
|
18371
18561
|
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
18372
18562
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
18373
18563
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
@@ -18388,16 +18578,17 @@ var phases = [
|
|
|
18388
18578
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
18389
18579
|
{ kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
|
|
18390
18580
|
{ kind: CompilationJobKind.Tmpl, fn: allocateSlots },
|
|
18391
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
18581
|
+
{ kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
|
|
18392
18582
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
18393
18583
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
18394
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
18395
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
18584
|
+
{ kind: CompilationJobKind.Tmpl, fn: mergeI18nContexts },
|
|
18585
|
+
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
18396
18586
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
|
|
18397
18587
|
{ kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
|
|
18398
18588
|
{ kind: CompilationJobKind.Tmpl, fn: collectConstExpressions },
|
|
18399
18589
|
{ kind: CompilationJobKind.Both, fn: collectElementConsts },
|
|
18400
18590
|
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
18591
|
+
{ kind: CompilationJobKind.Tmpl, fn: removeI18nContexts },
|
|
18401
18592
|
{ kind: CompilationJobKind.Both, fn: countVariables },
|
|
18402
18593
|
{ kind: CompilationJobKind.Tmpl, fn: generateAdvance },
|
|
18403
18594
|
{ kind: CompilationJobKind.Both, fn: optimizeVariables },
|
|
@@ -18514,8 +18705,8 @@ function emitHostBindingFunction(job) {
|
|
|
18514
18705
|
|
|
18515
18706
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
|
|
18516
18707
|
var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
|
|
18517
|
-
function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds) {
|
|
18518
|
-
const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds);
|
|
18708
|
+
function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
|
|
18709
|
+
const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta);
|
|
18519
18710
|
ingestNodes(job.root, template2);
|
|
18520
18711
|
return job;
|
|
18521
18712
|
}
|
|
@@ -18598,6 +18789,7 @@ function ingestNodes(unit, template2) {
|
|
|
18598
18789
|
}
|
|
18599
18790
|
}
|
|
18600
18791
|
function ingestElement(unit, element2) {
|
|
18792
|
+
var _a2;
|
|
18601
18793
|
if (element2.i18n !== void 0 && !(element2.i18n instanceof Message || element2.i18n instanceof TagPlaceholder)) {
|
|
18602
18794
|
throw Error(`Unhandled i18n metadata type for element: ${element2.i18n.constructor.name}`);
|
|
18603
18795
|
}
|
|
@@ -18608,7 +18800,7 @@ function ingestElement(unit, element2) {
|
|
|
18608
18800
|
ingestBindings(unit, startOp, element2);
|
|
18609
18801
|
ingestReferences(startOp, element2);
|
|
18610
18802
|
ingestNodes(unit, element2.children);
|
|
18611
|
-
const endOp = createElementEndOp(id, element2.endSourceSpan);
|
|
18803
|
+
const endOp = createElementEndOp(id, (_a2 = element2.endSourceSpan) != null ? _a2 : element2.startSourceSpan);
|
|
18612
18804
|
unit.create.push(endOp);
|
|
18613
18805
|
if (element2.i18n instanceof Message) {
|
|
18614
18806
|
const i18nBlockId = unit.job.allocateXrefId();
|
|
@@ -18731,12 +18923,16 @@ function ingestDeferView(unit, suffix, children, sourceSpan) {
|
|
|
18731
18923
|
}
|
|
18732
18924
|
function ingestDeferBlock(unit, deferBlock) {
|
|
18733
18925
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
18926
|
+
const blockMeta = unit.job.deferBlocksMeta.get(deferBlock);
|
|
18927
|
+
if (blockMeta === void 0) {
|
|
18928
|
+
throw new Error(`AssertionError: unable to find metadata for deferred block`);
|
|
18929
|
+
}
|
|
18734
18930
|
const main = ingestDeferView(unit, "", deferBlock.children, deferBlock.sourceSpan);
|
|
18735
18931
|
const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.children, (_b2 = deferBlock.loading) == null ? void 0 : _b2.sourceSpan);
|
|
18736
18932
|
const placeholder = ingestDeferView(unit, "Placeholder", (_c2 = deferBlock.placeholder) == null ? void 0 : _c2.children, (_d2 = deferBlock.placeholder) == null ? void 0 : _d2.sourceSpan);
|
|
18737
18933
|
const error2 = ingestDeferView(unit, "Error", (_e2 = deferBlock.error) == null ? void 0 : _e2.children, (_f2 = deferBlock.error) == null ? void 0 : _f2.sourceSpan);
|
|
18738
18934
|
const deferXref = unit.job.allocateXrefId();
|
|
18739
|
-
const deferOp = createDeferOp(deferXref, main.xref, main.handle, deferBlock.sourceSpan);
|
|
18935
|
+
const deferOp = createDeferOp(deferXref, main.xref, main.handle, blockMeta, deferBlock.sourceSpan);
|
|
18740
18936
|
deferOp.placeholderView = (_g = placeholder == null ? void 0 : placeholder.xref) != null ? _g : null;
|
|
18741
18937
|
deferOp.placeholderSlot = (_h = placeholder == null ? void 0 : placeholder.handle) != null ? _h : null;
|
|
18742
18938
|
deferOp.loadingSlot = (_i = loading == null ? void 0 : loading.handle) != null ? _i : null;
|
|
@@ -18747,17 +18943,18 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
18747
18943
|
unit.create.push(deferOp);
|
|
18748
18944
|
let prefetch = false;
|
|
18749
18945
|
let deferOnOps = [];
|
|
18946
|
+
let deferWhenOps = [];
|
|
18750
18947
|
for (const triggers of [deferBlock.triggers, deferBlock.prefetchTriggers]) {
|
|
18751
18948
|
if (triggers.idle !== void 0) {
|
|
18752
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, prefetch,
|
|
18949
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, prefetch, triggers.idle.sourceSpan);
|
|
18753
18950
|
deferOnOps.push(deferOnOp);
|
|
18754
18951
|
}
|
|
18755
18952
|
if (triggers.immediate !== void 0) {
|
|
18756
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, prefetch,
|
|
18953
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, prefetch, triggers.immediate.sourceSpan);
|
|
18757
18954
|
deferOnOps.push(deferOnOp);
|
|
18758
18955
|
}
|
|
18759
18956
|
if (triggers.timer !== void 0) {
|
|
18760
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, prefetch,
|
|
18957
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, prefetch, triggers.timer.sourceSpan);
|
|
18761
18958
|
deferOnOps.push(deferOnOp);
|
|
18762
18959
|
}
|
|
18763
18960
|
if (triggers.hover !== 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.hover.sourceSpan);
|
|
18772
18969
|
deferOnOps.push(deferOnOp);
|
|
18773
18970
|
}
|
|
18774
18971
|
if (triggers.interaction !== void 0) {
|
|
@@ -18779,7 +18976,7 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
18779
18976
|
targetSlot: null,
|
|
18780
18977
|
targetView: null,
|
|
18781
18978
|
targetSlotViewSteps: null
|
|
18782
|
-
}, prefetch,
|
|
18979
|
+
}, prefetch, triggers.interaction.sourceSpan);
|
|
18783
18980
|
deferOnOps.push(deferOnOp);
|
|
18784
18981
|
}
|
|
18785
18982
|
if (triggers.viewport !== void 0) {
|
|
@@ -18790,21 +18987,26 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
18790
18987
|
targetSlot: null,
|
|
18791
18988
|
targetView: null,
|
|
18792
18989
|
targetSlotViewSteps: null
|
|
18793
|
-
}, prefetch,
|
|
18990
|
+
}, prefetch, triggers.viewport.sourceSpan);
|
|
18794
18991
|
deferOnOps.push(deferOnOp);
|
|
18795
18992
|
}
|
|
18796
|
-
if (
|
|
18993
|
+
if (triggers.when !== void 0) {
|
|
18994
|
+
const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
|
|
18995
|
+
deferWhenOps.push(deferOnOp);
|
|
18996
|
+
}
|
|
18997
|
+
if (deferOnOps.length === 0 && deferWhenOps.length === 0) {
|
|
18797
18998
|
deferOnOps.push(createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, false, null));
|
|
18798
18999
|
}
|
|
18799
19000
|
prefetch = true;
|
|
18800
19001
|
}
|
|
18801
19002
|
unit.create.push(deferOnOps);
|
|
19003
|
+
unit.update.push(deferWhenOps);
|
|
18802
19004
|
}
|
|
18803
19005
|
function ingestIcu(unit, icu) {
|
|
18804
19006
|
var _a2;
|
|
18805
|
-
if (icu.i18n instanceof Message) {
|
|
19007
|
+
if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
|
|
18806
19008
|
const xref = unit.job.allocateXrefId();
|
|
18807
|
-
unit.create.push(createIcuOp(xref, icu.i18n, null));
|
|
19009
|
+
unit.create.push(createIcuOp(xref, icu.i18n, icu.i18n.nodes[0], icuFromI18nMessage(icu.i18n).name, null));
|
|
18808
19010
|
unit.update.push(createIcuUpdateOp(xref, null));
|
|
18809
19011
|
} else {
|
|
18810
19012
|
throw Error(`Unhandled i18n metadata type for ICU: ${(_a2 = icu.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
@@ -18862,6 +19064,15 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
18862
19064
|
return new ReadPropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, null, convertSourceSpan(ast.span, baseSourceSpan));
|
|
18863
19065
|
}
|
|
18864
19066
|
} else if (ast instanceof PropertyWrite) {
|
|
19067
|
+
if (ast.receiver instanceof ImplicitReceiver) {
|
|
19068
|
+
return new WritePropExpr(
|
|
19069
|
+
new ContextExpr(job.root.xref),
|
|
19070
|
+
ast.name,
|
|
19071
|
+
convertAst(ast.value, job, baseSourceSpan),
|
|
19072
|
+
null,
|
|
19073
|
+
convertSourceSpan(ast.span, baseSourceSpan)
|
|
19074
|
+
);
|
|
19075
|
+
}
|
|
18865
19076
|
return new WritePropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, convertAst(ast.value, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
18866
19077
|
} else if (ast instanceof KeyedWrite) {
|
|
18867
19078
|
return new WriteKeyExpr(convertAst(ast.receiver, job, baseSourceSpan), convertAst(ast.key, job, baseSourceSpan), convertAst(ast.value, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
@@ -18911,7 +19122,7 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
18911
19122
|
} else if (ast instanceof EmptyExpr) {
|
|
18912
19123
|
return new EmptyExpr2(convertSourceSpan(ast.span, baseSourceSpan));
|
|
18913
19124
|
} else {
|
|
18914
|
-
throw new Error(`Unhandled expression type
|
|
19125
|
+
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
|
|
18915
19126
|
}
|
|
18916
19127
|
}
|
|
18917
19128
|
function isPlainTemplate(tmpl) {
|
|
@@ -19049,7 +19260,8 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
19049
19260
|
for (const attr of root.attributes) {
|
|
19050
19261
|
ingestBinding(unit, xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue);
|
|
19051
19262
|
}
|
|
19052
|
-
|
|
19263
|
+
const tagName = root instanceof Element ? root.name : root.tagName;
|
|
19264
|
+
return tagName === "ng-template" ? null : tagName;
|
|
19053
19265
|
}
|
|
19054
19266
|
return null;
|
|
19055
19267
|
}
|
|
@@ -21947,7 +22159,8 @@ var TemplateDefinitionBuilder = class {
|
|
|
21947
22159
|
}
|
|
21948
22160
|
}
|
|
21949
22161
|
if (root !== null) {
|
|
21950
|
-
|
|
22162
|
+
const name = root instanceof Element ? root.name : root.tagName;
|
|
22163
|
+
tagName = name === NG_TEMPLATE_TAG_NAME ? null : name;
|
|
21951
22164
|
attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, root.attributes, root.inputs, []);
|
|
21952
22165
|
}
|
|
21953
22166
|
return { tagName, attrsExprs };
|
|
@@ -22897,7 +23110,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
22897
23110
|
}
|
|
22898
23111
|
definitionMap.set("template", templateFunctionExpression);
|
|
22899
23112
|
} else {
|
|
22900
|
-
const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds);
|
|
23113
|
+
const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.deferBlocks);
|
|
22901
23114
|
transform(tpl, CompilationJobKind.Tmpl);
|
|
22902
23115
|
const templateFn = emitTemplateFn(tpl, constantPool);
|
|
22903
23116
|
if (tpl.contentSelectors !== null) {
|
|
@@ -24548,7 +24761,7 @@ function publishFacade(global) {
|
|
|
24548
24761
|
}
|
|
24549
24762
|
|
|
24550
24763
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
|
|
24551
|
-
var VERSION2 = new Version("17.0.0
|
|
24764
|
+
var VERSION2 = new Version("17.0.0");
|
|
24552
24765
|
|
|
24553
24766
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
24554
24767
|
var _VisitorMode;
|
|
@@ -24607,6 +24820,15 @@ var switchcase = "*ngSwitchCase";
|
|
|
24607
24820
|
var nakedcase = "ngSwitchCase";
|
|
24608
24821
|
var switchdefault = "*ngSwitchDefault";
|
|
24609
24822
|
var nakeddefault = "ngSwitchDefault";
|
|
24823
|
+
var commaSeparatedSyntax = /* @__PURE__ */ new Map([
|
|
24824
|
+
["(", ")"],
|
|
24825
|
+
["{", "}"],
|
|
24826
|
+
["[", "]"]
|
|
24827
|
+
]);
|
|
24828
|
+
var stringPairs = /* @__PURE__ */ new Map([
|
|
24829
|
+
[`"`, `"`],
|
|
24830
|
+
[`'`, `'`]
|
|
24831
|
+
]);
|
|
24610
24832
|
var attributesToMigrate = [
|
|
24611
24833
|
ngif,
|
|
24612
24834
|
nakedngif,
|
|
@@ -24777,7 +24999,7 @@ function migrateTemplate(template2) {
|
|
|
24777
24999
|
const visitor = new ElementCollector();
|
|
24778
25000
|
visitAll2(visitor, parsed.rootNodes);
|
|
24779
25001
|
for (let [key, tmpl] of visitor.templates) {
|
|
24780
|
-
const regex = new RegExp(
|
|
25002
|
+
const regex = new RegExp(`[^a-zA-Z0-9-<]+${key.slice(1)}\\W`, "gm");
|
|
24781
25003
|
const matches = template2.match(regex);
|
|
24782
25004
|
tmpl.count = (_a2 = matches == null ? void 0 : matches.length) != null ? _a2 : 0;
|
|
24783
25005
|
tmpl.generateContents(template2);
|
|
@@ -24851,8 +25073,8 @@ function migrateTemplate(template2) {
|
|
|
24851
25073
|
return { migrated: result, errors };
|
|
24852
25074
|
}
|
|
24853
25075
|
function migrateNgIf(etm, ngTemplates, tmpl, offset) {
|
|
24854
|
-
const matchThen = etm.attr.value.match(/;\s
|
|
24855
|
-
const matchElse = etm.attr.value.match(/;\s
|
|
25076
|
+
const matchThen = etm.attr.value.match(/;\s*then/gm);
|
|
25077
|
+
const matchElse = etm.attr.value.match(/;\s*else/gm);
|
|
24856
25078
|
if (matchThen && matchThen.length > 0) {
|
|
24857
25079
|
return buildIfThenElseBlock(etm, ngTemplates, tmpl, matchThen[0], matchElse[0], offset);
|
|
24858
25080
|
} else if (matchElse && matchElse.length > 0) {
|
|
@@ -24919,7 +25141,7 @@ function migrateNgFor(etm, tmpl, offset) {
|
|
|
24919
25141
|
const aliases = [];
|
|
24920
25142
|
const lbString = etm.hasLineBreaks ? lb : "";
|
|
24921
25143
|
const lbSpaces = etm.hasLineBreaks ? `${lb} ` : "";
|
|
24922
|
-
const parts = etm.attr.value
|
|
25144
|
+
const parts = getNgForParts(etm.attr.value);
|
|
24923
25145
|
const originals = getOriginals(etm, tmpl, offset);
|
|
24924
25146
|
const condition = parts[0].replace("let ", "");
|
|
24925
25147
|
const loopVar = condition.split(" of ")[0];
|
|
@@ -24935,7 +25157,7 @@ function migrateNgFor(etm, tmpl, offset) {
|
|
|
24935
25157
|
const aliasParts = part.split("=");
|
|
24936
25158
|
aliases.push(` ${aliasParts[0].trim()} = $${aliasParts[1].trim()}`);
|
|
24937
25159
|
if (aliasParts[1].trim() === "index") {
|
|
24938
|
-
aliasedIndex = aliasParts[0].
|
|
25160
|
+
aliasedIndex = aliasParts[0].replace("let", "").trim();
|
|
24939
25161
|
}
|
|
24940
25162
|
}
|
|
24941
25163
|
if (part.match(aliasWithAsRegexp)) {
|
|
@@ -24959,6 +25181,37 @@ function migrateNgFor(etm, tmpl, offset) {
|
|
|
24959
25181
|
const post = originals.end.length - endBlock.length;
|
|
24960
25182
|
return { tmpl: updatedTmpl, offsets: { pre, post } };
|
|
24961
25183
|
}
|
|
25184
|
+
function getNgForParts(expression) {
|
|
25185
|
+
const parts = [];
|
|
25186
|
+
const commaSeparatedStack = [];
|
|
25187
|
+
const stringStack = [];
|
|
25188
|
+
let current = "";
|
|
25189
|
+
for (let i = 0; i < expression.length; i++) {
|
|
25190
|
+
const char = expression[i];
|
|
25191
|
+
const isInString = stringStack.length === 0;
|
|
25192
|
+
const isInCommaSeparated = commaSeparatedStack.length === 0;
|
|
25193
|
+
if (isInString && current.length > 0 && (char === ";" || char === "," && isInCommaSeparated)) {
|
|
25194
|
+
parts.push(current);
|
|
25195
|
+
current = "";
|
|
25196
|
+
continue;
|
|
25197
|
+
}
|
|
25198
|
+
if (stringPairs.has(char)) {
|
|
25199
|
+
stringStack.push(stringPairs.get(char));
|
|
25200
|
+
} else if (stringStack.length > 0 && stringStack[stringStack.length - 1] === char) {
|
|
25201
|
+
stringStack.pop();
|
|
25202
|
+
}
|
|
25203
|
+
if (commaSeparatedSyntax.has(char)) {
|
|
25204
|
+
commaSeparatedStack.push(commaSeparatedSyntax.get(char));
|
|
25205
|
+
} else if (commaSeparatedStack.length > 0 && commaSeparatedStack[commaSeparatedStack.length - 1] === char) {
|
|
25206
|
+
commaSeparatedStack.pop();
|
|
25207
|
+
}
|
|
25208
|
+
current += char;
|
|
25209
|
+
}
|
|
25210
|
+
if (current.length > 0) {
|
|
25211
|
+
parts.push(current);
|
|
25212
|
+
}
|
|
25213
|
+
return parts;
|
|
25214
|
+
}
|
|
24962
25215
|
function getOriginals(etm, tmpl, offset) {
|
|
24963
25216
|
if (etm.el.children.length > 0) {
|
|
24964
25217
|
const start2 = tmpl.slice(etm.el.sourceSpan.start.offset - offset, etm.el.children[0].sourceSpan.start.offset - offset);
|