@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
|
@@ -7855,20 +7855,22 @@ var OpKind;
|
|
|
7855
7855
|
OpKind2[OpKind2["ExtractedAttribute"] = 25] = "ExtractedAttribute";
|
|
7856
7856
|
OpKind2[OpKind2["Defer"] = 26] = "Defer";
|
|
7857
7857
|
OpKind2[OpKind2["DeferOn"] = 27] = "DeferOn";
|
|
7858
|
-
OpKind2[OpKind2["
|
|
7859
|
-
OpKind2[OpKind2["
|
|
7860
|
-
OpKind2[OpKind2["
|
|
7861
|
-
OpKind2[OpKind2["
|
|
7862
|
-
OpKind2[OpKind2["
|
|
7863
|
-
OpKind2[OpKind2["
|
|
7864
|
-
OpKind2[OpKind2["
|
|
7865
|
-
OpKind2[OpKind2["
|
|
7866
|
-
OpKind2[OpKind2["
|
|
7867
|
-
OpKind2[OpKind2["
|
|
7868
|
-
OpKind2[OpKind2["
|
|
7869
|
-
OpKind2[OpKind2["
|
|
7870
|
-
OpKind2[OpKind2["
|
|
7871
|
-
OpKind2[OpKind2["
|
|
7858
|
+
OpKind2[OpKind2["DeferWhen"] = 28] = "DeferWhen";
|
|
7859
|
+
OpKind2[OpKind2["I18nMessage"] = 29] = "I18nMessage";
|
|
7860
|
+
OpKind2[OpKind2["HostProperty"] = 30] = "HostProperty";
|
|
7861
|
+
OpKind2[OpKind2["Namespace"] = 31] = "Namespace";
|
|
7862
|
+
OpKind2[OpKind2["ProjectionDef"] = 32] = "ProjectionDef";
|
|
7863
|
+
OpKind2[OpKind2["Projection"] = 33] = "Projection";
|
|
7864
|
+
OpKind2[OpKind2["RepeaterCreate"] = 34] = "RepeaterCreate";
|
|
7865
|
+
OpKind2[OpKind2["Repeater"] = 35] = "Repeater";
|
|
7866
|
+
OpKind2[OpKind2["I18nStart"] = 36] = "I18nStart";
|
|
7867
|
+
OpKind2[OpKind2["I18n"] = 37] = "I18n";
|
|
7868
|
+
OpKind2[OpKind2["I18nEnd"] = 38] = "I18nEnd";
|
|
7869
|
+
OpKind2[OpKind2["I18nExpression"] = 39] = "I18nExpression";
|
|
7870
|
+
OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
|
|
7871
|
+
OpKind2[OpKind2["Icu"] = 41] = "Icu";
|
|
7872
|
+
OpKind2[OpKind2["IcuUpdate"] = 42] = "IcuUpdate";
|
|
7873
|
+
OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
|
|
7872
7874
|
})(OpKind || (OpKind = {}));
|
|
7873
7875
|
var ExpressionKind;
|
|
7874
7876
|
(function(ExpressionKind2) {
|
|
@@ -8149,23 +8151,32 @@ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
|
|
|
8149
8151
|
sourceSpan
|
|
8150
8152
|
}, NEW_OP);
|
|
8151
8153
|
}
|
|
8152
|
-
function
|
|
8154
|
+
function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
|
|
8155
|
+
return __spreadValues(__spreadValues({
|
|
8156
|
+
kind: OpKind.DeferWhen,
|
|
8157
|
+
target,
|
|
8158
|
+
expr,
|
|
8159
|
+
prefetch,
|
|
8160
|
+
sourceSpan
|
|
8161
|
+
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
8162
|
+
}
|
|
8163
|
+
function createI18nExpressionOp(context, target, handle, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
|
|
8153
8164
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
8154
8165
|
kind: OpKind.I18nExpression,
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8166
|
+
context,
|
|
8167
|
+
target,
|
|
8168
|
+
handle,
|
|
8158
8169
|
expression,
|
|
8159
8170
|
i18nPlaceholder,
|
|
8160
8171
|
resolutionTime,
|
|
8161
8172
|
sourceSpan
|
|
8162
8173
|
}, NEW_OP), TRAIT_CONSUMES_VARS), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
8163
8174
|
}
|
|
8164
|
-
function createI18nApplyOp(target,
|
|
8175
|
+
function createI18nApplyOp(target, handle, sourceSpan) {
|
|
8165
8176
|
return __spreadValues({
|
|
8166
8177
|
kind: OpKind.I18nApply,
|
|
8167
8178
|
target,
|
|
8168
|
-
|
|
8179
|
+
handle,
|
|
8169
8180
|
sourceSpan
|
|
8170
8181
|
}, NEW_OP);
|
|
8171
8182
|
}
|
|
@@ -8913,6 +8924,17 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8913
8924
|
op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
|
|
8914
8925
|
}
|
|
8915
8926
|
break;
|
|
8927
|
+
case OpKind.I18nMessage:
|
|
8928
|
+
for (const [placeholder, expr] of op.params) {
|
|
8929
|
+
op.params.set(placeholder, transformExpressionsInExpression(expr, transform2, flags));
|
|
8930
|
+
}
|
|
8931
|
+
for (const [placeholder, expr] of op.postprocessingParams) {
|
|
8932
|
+
op.postprocessingParams.set(placeholder, transformExpressionsInExpression(expr, transform2, flags));
|
|
8933
|
+
}
|
|
8934
|
+
break;
|
|
8935
|
+
case OpKind.DeferWhen:
|
|
8936
|
+
op.expr = transformExpressionsInExpression(op.expr, transform2, flags);
|
|
8937
|
+
break;
|
|
8916
8938
|
case OpKind.Advance:
|
|
8917
8939
|
case OpKind.Container:
|
|
8918
8940
|
case OpKind.ContainerEnd:
|
|
@@ -8923,9 +8945,9 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8923
8945
|
case OpKind.ElementEnd:
|
|
8924
8946
|
case OpKind.ElementStart:
|
|
8925
8947
|
case OpKind.EnableBindings:
|
|
8926
|
-
case OpKind.ExtractedMessage:
|
|
8927
8948
|
case OpKind.I18n:
|
|
8928
8949
|
case OpKind.I18nApply:
|
|
8950
|
+
case OpKind.I18nContext:
|
|
8929
8951
|
case OpKind.I18nEnd:
|
|
8930
8952
|
case OpKind.I18nStart:
|
|
8931
8953
|
case OpKind.Icu:
|
|
@@ -9366,7 +9388,7 @@ function createExtractedAttributeOp(target, bindingKind, name, expression) {
|
|
|
9366
9388
|
expression
|
|
9367
9389
|
}, NEW_OP);
|
|
9368
9390
|
}
|
|
9369
|
-
function createDeferOp(xref, main, mainSlot, sourceSpan) {
|
|
9391
|
+
function createDeferOp(xref, main, mainSlot, metadata, sourceSpan) {
|
|
9370
9392
|
return __spreadProps(__spreadValues(__spreadValues({
|
|
9371
9393
|
kind: OpKind.Defer,
|
|
9372
9394
|
xref,
|
|
@@ -9384,6 +9406,8 @@ function createDeferOp(xref, main, mainSlot, sourceSpan) {
|
|
|
9384
9406
|
placeholderMinimumTime: null,
|
|
9385
9407
|
errorView: null,
|
|
9386
9408
|
errorSlot: null,
|
|
9409
|
+
metadata,
|
|
9410
|
+
resolverFn: null,
|
|
9387
9411
|
sourceSpan
|
|
9388
9412
|
}, NEW_OP), TRAIT_CONSUMES_SLOT), {
|
|
9389
9413
|
numSlotsUsed: 2
|
|
@@ -9398,17 +9422,17 @@ function createDeferOnOp(defer2, trigger, prefetch, sourceSpan) {
|
|
|
9398
9422
|
sourceSpan
|
|
9399
9423
|
}, NEW_OP);
|
|
9400
9424
|
}
|
|
9401
|
-
function
|
|
9425
|
+
function createI18nMessageOp(xref, i18nBlock, message, messagePlaceholder, params, postprocessingParams, needsPostprocessing) {
|
|
9402
9426
|
return __spreadValues({
|
|
9403
|
-
kind: OpKind.
|
|
9404
|
-
|
|
9427
|
+
kind: OpKind.I18nMessage,
|
|
9428
|
+
xref,
|
|
9429
|
+
i18nBlock,
|
|
9405
9430
|
message,
|
|
9406
|
-
|
|
9407
|
-
params
|
|
9408
|
-
postprocessingParams
|
|
9409
|
-
needsPostprocessing
|
|
9410
|
-
|
|
9411
|
-
formattedPostprocessingParams: null
|
|
9431
|
+
messagePlaceholder,
|
|
9432
|
+
params,
|
|
9433
|
+
postprocessingParams,
|
|
9434
|
+
needsPostprocessing,
|
|
9435
|
+
subMessages: []
|
|
9412
9436
|
}, NEW_OP);
|
|
9413
9437
|
}
|
|
9414
9438
|
function createI18nStartOp(xref, message, root) {
|
|
@@ -9419,7 +9443,8 @@ function createI18nStartOp(xref, message, root) {
|
|
|
9419
9443
|
root: root != null ? root : xref,
|
|
9420
9444
|
message,
|
|
9421
9445
|
messageIndex: null,
|
|
9422
|
-
subTemplateIndex: null
|
|
9446
|
+
subTemplateIndex: null,
|
|
9447
|
+
context: null
|
|
9423
9448
|
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
9424
9449
|
}
|
|
9425
9450
|
function createI18nEndOp(xref) {
|
|
@@ -9428,14 +9453,28 @@ function createI18nEndOp(xref) {
|
|
|
9428
9453
|
xref
|
|
9429
9454
|
}, NEW_OP);
|
|
9430
9455
|
}
|
|
9431
|
-
function createIcuOp(xref, message, sourceSpan) {
|
|
9456
|
+
function createIcuOp(xref, message, icu, messagePlaceholder, sourceSpan) {
|
|
9432
9457
|
return __spreadValues({
|
|
9433
9458
|
kind: OpKind.Icu,
|
|
9434
9459
|
xref,
|
|
9435
9460
|
message,
|
|
9461
|
+
icu,
|
|
9462
|
+
messagePlaceholder,
|
|
9463
|
+
context: null,
|
|
9436
9464
|
sourceSpan
|
|
9437
9465
|
}, NEW_OP);
|
|
9438
9466
|
}
|
|
9467
|
+
function createI18nContextOp(xref, i18nBlock, message, sourceSpan) {
|
|
9468
|
+
return __spreadValues({
|
|
9469
|
+
kind: OpKind.I18nContext,
|
|
9470
|
+
xref,
|
|
9471
|
+
i18nBlock,
|
|
9472
|
+
message,
|
|
9473
|
+
sourceSpan,
|
|
9474
|
+
params: /* @__PURE__ */ new Map(),
|
|
9475
|
+
postprocessingParams: /* @__PURE__ */ new Map()
|
|
9476
|
+
}, NEW_OP);
|
|
9477
|
+
}
|
|
9439
9478
|
|
|
9440
9479
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
|
|
9441
9480
|
function createHostPropertyOp(name, expression, isAnimationTrigger, sourceSpan) {
|
|
@@ -9471,10 +9510,11 @@ var CompilationJob = class {
|
|
|
9471
9510
|
}
|
|
9472
9511
|
};
|
|
9473
9512
|
var ComponentCompilationJob = class extends CompilationJob {
|
|
9474
|
-
constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds) {
|
|
9513
|
+
constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
|
|
9475
9514
|
super(componentName, pool, compatibility);
|
|
9476
9515
|
this.relativeContextFilePath = relativeContextFilePath;
|
|
9477
9516
|
this.i18nUseExternalIds = i18nUseExternalIds;
|
|
9517
|
+
this.deferBlocksMeta = deferBlocksMeta;
|
|
9478
9518
|
this.kind = CompilationJobKind.Tmpl;
|
|
9479
9519
|
this.fnSuffix = "Template";
|
|
9480
9520
|
this.views = /* @__PURE__ */ new Map();
|
|
@@ -9580,7 +9620,7 @@ function applyI18nExpressions(job) {
|
|
|
9580
9620
|
for (const unit of job.units) {
|
|
9581
9621
|
for (const op of unit.update) {
|
|
9582
9622
|
if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
|
|
9583
|
-
OpList.insertAfter(createI18nApplyOp(op.
|
|
9623
|
+
OpList.insertAfter(createI18nApplyOp(op.target, op.handle, null), op);
|
|
9584
9624
|
}
|
|
9585
9625
|
}
|
|
9586
9626
|
}
|
|
@@ -9590,7 +9630,7 @@ function needsApplication(op) {
|
|
|
9590
9630
|
if (((_a2 = op.next) == null ? void 0 : _a2.kind) !== OpKind.I18nExpression) {
|
|
9591
9631
|
return true;
|
|
9592
9632
|
}
|
|
9593
|
-
if (op.next.
|
|
9633
|
+
if (op.next.context !== op.context) {
|
|
9594
9634
|
return true;
|
|
9595
9635
|
}
|
|
9596
9636
|
return false;
|
|
@@ -9599,19 +9639,31 @@ function needsApplication(op) {
|
|
|
9599
9639
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
|
|
9600
9640
|
function assignI18nSlotDependencies(job) {
|
|
9601
9641
|
const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
|
|
9642
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
9602
9643
|
let lastSlotConsumer = null;
|
|
9644
|
+
let currentI18nOp = null;
|
|
9603
9645
|
for (const unit of job.units) {
|
|
9604
9646
|
for (const op of unit.create) {
|
|
9605
|
-
if (op.kind === OpKind.I18nEnd) {
|
|
9606
|
-
i18nLastSlotConsumers.set(op.xref, lastSlotConsumer);
|
|
9607
|
-
}
|
|
9608
9647
|
if (hasConsumesSlotTrait(op)) {
|
|
9609
9648
|
lastSlotConsumer = op.xref;
|
|
9610
9649
|
}
|
|
9650
|
+
switch (op.kind) {
|
|
9651
|
+
case OpKind.I18nStart:
|
|
9652
|
+
currentI18nOp = op;
|
|
9653
|
+
break;
|
|
9654
|
+
case OpKind.I18nEnd:
|
|
9655
|
+
i18nLastSlotConsumers.set(currentI18nOp.xref, lastSlotConsumer);
|
|
9656
|
+
currentI18nOp = null;
|
|
9657
|
+
break;
|
|
9658
|
+
case OpKind.I18nContext:
|
|
9659
|
+
i18nContexts.set(op.xref, op);
|
|
9660
|
+
break;
|
|
9661
|
+
}
|
|
9611
9662
|
}
|
|
9612
9663
|
for (const op of unit.update) {
|
|
9613
9664
|
if (op.kind === OpKind.I18nExpression) {
|
|
9614
|
-
|
|
9665
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
9666
|
+
op.target = i18nLastSlotConsumers.get(i18nContext.i18nBlock);
|
|
9615
9667
|
}
|
|
9616
9668
|
}
|
|
9617
9669
|
}
|
|
@@ -10078,6 +10130,113 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
|
|
|
10078
10130
|
return literalArr(attrArray);
|
|
10079
10131
|
}
|
|
10080
10132
|
|
|
10133
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_defer_deps_fns.mjs
|
|
10134
|
+
function createDeferDepsFns(job) {
|
|
10135
|
+
for (const unit of job.units) {
|
|
10136
|
+
for (const op of unit.create) {
|
|
10137
|
+
if (op.kind === OpKind.Defer) {
|
|
10138
|
+
if (op.metadata.deps.length === 0) {
|
|
10139
|
+
continue;
|
|
10140
|
+
}
|
|
10141
|
+
const dependencies = [];
|
|
10142
|
+
for (const dep of op.metadata.deps) {
|
|
10143
|
+
if (dep.isDeferrable) {
|
|
10144
|
+
const innerFn = arrowFn([new FnParam("m", DYNAMIC_TYPE)], variable("m").prop(dep.symbolName));
|
|
10145
|
+
const importExpr2 = new DynamicImportExpr(dep.importPath).prop("then").callFn([innerFn]);
|
|
10146
|
+
dependencies.push(importExpr2);
|
|
10147
|
+
} else {
|
|
10148
|
+
dependencies.push(dep.type);
|
|
10149
|
+
}
|
|
10150
|
+
}
|
|
10151
|
+
const depsFnExpr = arrowFn([], literalArr(dependencies));
|
|
10152
|
+
if (op.handle.slot === null) {
|
|
10153
|
+
throw new Error("AssertionError: slot must be assigned bfore extracting defer deps functions");
|
|
10154
|
+
}
|
|
10155
|
+
op.resolverFn = job.pool.getSharedFunctionReference(depsFnExpr, `${job.componentName}_Defer_${op.handle.slot}_DepsFn`);
|
|
10156
|
+
}
|
|
10157
|
+
}
|
|
10158
|
+
}
|
|
10159
|
+
}
|
|
10160
|
+
|
|
10161
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_contexts.mjs
|
|
10162
|
+
function createI18nContexts(job) {
|
|
10163
|
+
let currentI18nOp = null;
|
|
10164
|
+
let xref;
|
|
10165
|
+
for (const unit of job.units) {
|
|
10166
|
+
for (const op of unit.create) {
|
|
10167
|
+
switch (op.kind) {
|
|
10168
|
+
case OpKind.I18nStart:
|
|
10169
|
+
xref = job.allocateXrefId();
|
|
10170
|
+
unit.create.push(createI18nContextOp(xref, op.xref, op.message, null));
|
|
10171
|
+
op.context = xref;
|
|
10172
|
+
currentI18nOp = op;
|
|
10173
|
+
break;
|
|
10174
|
+
case OpKind.I18nEnd:
|
|
10175
|
+
currentI18nOp = null;
|
|
10176
|
+
break;
|
|
10177
|
+
case OpKind.Icu:
|
|
10178
|
+
if (currentI18nOp === null) {
|
|
10179
|
+
throw Error("Unexpected ICU outside of an i18n block.");
|
|
10180
|
+
}
|
|
10181
|
+
if (op.message.id !== currentI18nOp.message.id) {
|
|
10182
|
+
xref = job.allocateXrefId();
|
|
10183
|
+
unit.create.push(createI18nContextOp(xref, currentI18nOp.xref, op.message, null));
|
|
10184
|
+
op.context = xref;
|
|
10185
|
+
} else {
|
|
10186
|
+
op.context = currentI18nOp.context;
|
|
10187
|
+
}
|
|
10188
|
+
break;
|
|
10189
|
+
}
|
|
10190
|
+
}
|
|
10191
|
+
}
|
|
10192
|
+
}
|
|
10193
|
+
|
|
10194
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_icu_expressions.mjs
|
|
10195
|
+
function createI18nIcuExpressions(job) {
|
|
10196
|
+
const icus = /* @__PURE__ */ new Map();
|
|
10197
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
10198
|
+
const i18nBlocks = /* @__PURE__ */ new Map();
|
|
10199
|
+
for (const unit of job.units) {
|
|
10200
|
+
for (const op of unit.create) {
|
|
10201
|
+
switch (op.kind) {
|
|
10202
|
+
case OpKind.Icu:
|
|
10203
|
+
icus.set(op.xref, op);
|
|
10204
|
+
break;
|
|
10205
|
+
case OpKind.I18nContext:
|
|
10206
|
+
i18nContexts.set(op.xref, op);
|
|
10207
|
+
break;
|
|
10208
|
+
case OpKind.I18nStart:
|
|
10209
|
+
i18nBlocks.set(op.xref, op);
|
|
10210
|
+
break;
|
|
10211
|
+
}
|
|
10212
|
+
}
|
|
10213
|
+
for (const op of unit.update) {
|
|
10214
|
+
switch (op.kind) {
|
|
10215
|
+
case OpKind.IcuUpdate:
|
|
10216
|
+
const icuOp = icus.get(op.xref);
|
|
10217
|
+
if ((icuOp == null ? void 0 : icuOp.icu.expressionPlaceholder) === void 0) {
|
|
10218
|
+
throw Error("ICU should have an i18n placeholder");
|
|
10219
|
+
}
|
|
10220
|
+
if (icuOp.context === null) {
|
|
10221
|
+
throw Error("ICU should have its i18n context set");
|
|
10222
|
+
}
|
|
10223
|
+
const i18nContext = i18nContexts.get(icuOp.context);
|
|
10224
|
+
const i18nBlock = i18nBlocks.get(i18nContext.i18nBlock);
|
|
10225
|
+
OpList.replace(op, createI18nExpressionOp(
|
|
10226
|
+
i18nContext.xref,
|
|
10227
|
+
i18nBlock.xref,
|
|
10228
|
+
i18nBlock.handle,
|
|
10229
|
+
new LexicalReadExpr(icuOp.icu.expression),
|
|
10230
|
+
icuOp.icu.expressionPlaceholder,
|
|
10231
|
+
I18nParamResolutionTime.Postproccessing,
|
|
10232
|
+
null
|
|
10233
|
+
));
|
|
10234
|
+
break;
|
|
10235
|
+
}
|
|
10236
|
+
}
|
|
10237
|
+
}
|
|
10238
|
+
}
|
|
10239
|
+
|
|
10081
10240
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_configs.mjs
|
|
10082
10241
|
function configureDeferInstructions(job) {
|
|
10083
10242
|
for (const unit of job.units) {
|
|
@@ -10130,6 +10289,22 @@ function resolveDeferTargetNames(job) {
|
|
|
10130
10289
|
case DeferTriggerKind.Interaction:
|
|
10131
10290
|
case DeferTriggerKind.Viewport:
|
|
10132
10291
|
if (op.trigger.targetName === null) {
|
|
10292
|
+
if (placeholderView === null) {
|
|
10293
|
+
throw new Error("defer on trigger with no target name must have a placeholder block");
|
|
10294
|
+
}
|
|
10295
|
+
const placeholder = job.views.get(placeholderView);
|
|
10296
|
+
if (placeholder == void 0) {
|
|
10297
|
+
throw new Error("AssertionError: could not find placeholder view for defer on trigger");
|
|
10298
|
+
}
|
|
10299
|
+
for (const placeholderOp of placeholder.create) {
|
|
10300
|
+
if (hasConsumesSlotTrait(placeholderOp) && (isElementOrContainerOp(placeholderOp) || placeholderOp.kind === OpKind.Projection)) {
|
|
10301
|
+
op.trigger.targetXref = placeholderOp.xref;
|
|
10302
|
+
op.trigger.targetView = placeholderView;
|
|
10303
|
+
op.trigger.targetSlotViewSteps = -1;
|
|
10304
|
+
op.trigger.targetSlot = placeholderOp.handle;
|
|
10305
|
+
return;
|
|
10306
|
+
}
|
|
10307
|
+
}
|
|
10133
10308
|
return;
|
|
10134
10309
|
}
|
|
10135
10310
|
let view = placeholderView !== null ? job.views.get(placeholderView) : deferOwnerView;
|
|
@@ -10336,7 +10511,7 @@ function ternaryTransform(e) {
|
|
|
10336
10511
|
return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
|
|
10337
10512
|
}
|
|
10338
10513
|
|
|
10339
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/
|
|
10514
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/extract_i18n_messages.mjs
|
|
10340
10515
|
var ESCAPE = "\uFFFD";
|
|
10341
10516
|
var ELEMENT_MARKER = "#";
|
|
10342
10517
|
var TEMPLATE_MARKER = "*";
|
|
@@ -10345,24 +10520,61 @@ var CONTEXT_MARKER = ":";
|
|
|
10345
10520
|
var LIST_START_MARKER = "[";
|
|
10346
10521
|
var LIST_END_MARKER = "]";
|
|
10347
10522
|
var LIST_DELIMITER = "|";
|
|
10348
|
-
function
|
|
10523
|
+
function extractI18nMessages(job) {
|
|
10524
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
10525
|
+
const i18nBlockContexts = /* @__PURE__ */ new Set();
|
|
10349
10526
|
for (const unit of job.units) {
|
|
10350
10527
|
for (const op of unit.create) {
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
op.
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10528
|
+
switch (op.kind) {
|
|
10529
|
+
case OpKind.I18nContext:
|
|
10530
|
+
i18nContexts.set(op.xref, op);
|
|
10531
|
+
break;
|
|
10532
|
+
case OpKind.I18nStart:
|
|
10533
|
+
i18nBlockContexts.add(op.context);
|
|
10534
|
+
break;
|
|
10535
|
+
}
|
|
10536
|
+
}
|
|
10537
|
+
}
|
|
10538
|
+
const i18nBlockMessages = /* @__PURE__ */ new Map();
|
|
10539
|
+
for (const unit of job.units) {
|
|
10540
|
+
for (const op of unit.create) {
|
|
10541
|
+
if (op.kind === OpKind.I18nStart && op.xref === op.root) {
|
|
10542
|
+
if (!op.context) {
|
|
10543
|
+
throw Error("I18n start op should have its context set.");
|
|
10361
10544
|
}
|
|
10545
|
+
const i18nMessageOp = createI18nMessage(job, i18nContexts.get(op.context));
|
|
10546
|
+
i18nBlockMessages.set(op.xref, i18nMessageOp);
|
|
10547
|
+
unit.create.push(i18nMessageOp);
|
|
10548
|
+
}
|
|
10549
|
+
}
|
|
10550
|
+
}
|
|
10551
|
+
for (const unit of job.units) {
|
|
10552
|
+
for (const op of unit.create) {
|
|
10553
|
+
if (op.kind === OpKind.Icu) {
|
|
10554
|
+
if (!op.context) {
|
|
10555
|
+
throw Error("ICU op should have its context set.");
|
|
10556
|
+
}
|
|
10557
|
+
if (!i18nBlockContexts.has(op.context)) {
|
|
10558
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
10559
|
+
const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
|
|
10560
|
+
unit.create.push(subMessage);
|
|
10561
|
+
const parentMessage = i18nBlockMessages.get(i18nContext.i18nBlock);
|
|
10562
|
+
parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
|
|
10563
|
+
}
|
|
10564
|
+
OpList.remove(op);
|
|
10362
10565
|
}
|
|
10363
10566
|
}
|
|
10364
10567
|
}
|
|
10365
10568
|
}
|
|
10569
|
+
function createI18nMessage(job, context, messagePlaceholder) {
|
|
10570
|
+
let needsPostprocessing = context.postprocessingParams.size > 0;
|
|
10571
|
+
for (const values of context.params.values()) {
|
|
10572
|
+
if (values.length > 1) {
|
|
10573
|
+
needsPostprocessing = true;
|
|
10574
|
+
}
|
|
10575
|
+
}
|
|
10576
|
+
return createI18nMessageOp(job.allocateXrefId(), context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formatParams(context.params), formatParams(context.postprocessingParams), needsPostprocessing);
|
|
10577
|
+
}
|
|
10366
10578
|
function formatParams(params) {
|
|
10367
10579
|
const result = /* @__PURE__ */ new Map();
|
|
10368
10580
|
for (const [placeholder, placeholderValues] of [...params].sort()) {
|
|
@@ -16229,8 +16441,8 @@ var I18nMetaVisitor = class {
|
|
|
16229
16441
|
}
|
|
16230
16442
|
_generateI18nMessage(nodes, meta = "", visitNodeFn) {
|
|
16231
16443
|
const { meaning, description, customId } = this._parseMetadata(meta);
|
|
16232
|
-
const
|
|
16233
|
-
const message =
|
|
16444
|
+
const createI18nMessage2 = createI18nMessageFactory(this.interpolationConfig);
|
|
16445
|
+
const message = createI18nMessage2(nodes, meaning, description, customId, visitNodeFn);
|
|
16234
16446
|
this._setMessageId(message, meta);
|
|
16235
16447
|
this._setLegacyIds(message, meta);
|
|
16236
16448
|
return message;
|
|
@@ -16502,28 +16714,21 @@ var TRANSLATION_VAR_PREFIX2 = "i18n_";
|
|
|
16502
16714
|
function collectI18nConsts(job) {
|
|
16503
16715
|
const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
|
|
16504
16716
|
const messageConstIndices = /* @__PURE__ */ new Map();
|
|
16717
|
+
const messages = /* @__PURE__ */ new Map();
|
|
16505
16718
|
for (const unit of job.units) {
|
|
16506
16719
|
for (const op of unit.create) {
|
|
16507
|
-
if (op.kind === OpKind.
|
|
16508
|
-
|
|
16509
|
-
assertAllParamsResolved(op);
|
|
16510
|
-
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
|
|
16511
|
-
const closureVar = i18nGenerateClosureVar(job.pool, op.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
16512
|
-
let transformFn = void 0;
|
|
16513
|
-
if (op.needsPostprocessing) {
|
|
16514
|
-
const extraTransformFnParams = [];
|
|
16515
|
-
if (op.formattedPostprocessingParams.size > 0) {
|
|
16516
|
-
extraTransformFnParams.push(literalMap([...op.formattedPostprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
|
|
16517
|
-
}
|
|
16518
|
-
transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
|
|
16519
|
-
}
|
|
16520
|
-
const statements = getTranslationDeclStmts(op.message, mainVar, closureVar, op.formattedParams, transformFn);
|
|
16521
|
-
messageConstIndices.set(op.owner, job.addConst(mainVar, statements));
|
|
16522
|
-
}
|
|
16720
|
+
if (op.kind === OpKind.I18nMessage) {
|
|
16721
|
+
messages.set(op.xref, op);
|
|
16523
16722
|
OpList.remove(op);
|
|
16524
16723
|
}
|
|
16525
16724
|
}
|
|
16526
16725
|
}
|
|
16726
|
+
for (const op of messages.values()) {
|
|
16727
|
+
if (op.kind === OpKind.I18nMessage && op.messagePlaceholder === null) {
|
|
16728
|
+
const { mainVar, statements } = collectMessage(job, fileBasedI18nSuffix, messages, op);
|
|
16729
|
+
messageConstIndices.set(op.i18nBlock, job.addConst(mainVar, statements));
|
|
16730
|
+
}
|
|
16731
|
+
}
|
|
16527
16732
|
for (const unit of job.units) {
|
|
16528
16733
|
for (const op of unit.create) {
|
|
16529
16734
|
if (op.kind === OpKind.I18nStart) {
|
|
@@ -16532,6 +16737,28 @@ function collectI18nConsts(job) {
|
|
|
16532
16737
|
}
|
|
16533
16738
|
}
|
|
16534
16739
|
}
|
|
16740
|
+
function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
16741
|
+
const statements = [];
|
|
16742
|
+
for (const subMessageId of messageOp.subMessages) {
|
|
16743
|
+
const subMessage = messages.get(subMessageId);
|
|
16744
|
+
const { mainVar: subMessageVar, statements: subMessageStatements } = collectMessage(job, fileBasedI18nSuffix, messages, subMessage);
|
|
16745
|
+
statements.push(...subMessageStatements);
|
|
16746
|
+
messageOp.params.set(subMessage.messagePlaceholder, subMessageVar);
|
|
16747
|
+
}
|
|
16748
|
+
assertAllParamsResolved(messageOp);
|
|
16749
|
+
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
|
|
16750
|
+
const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
16751
|
+
let transformFn = void 0;
|
|
16752
|
+
if (messageOp.needsPostprocessing) {
|
|
16753
|
+
const extraTransformFnParams = [];
|
|
16754
|
+
if (messageOp.postprocessingParams.size > 0) {
|
|
16755
|
+
extraTransformFnParams.push(literalMap([...messageOp.postprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
|
|
16756
|
+
}
|
|
16757
|
+
transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
|
|
16758
|
+
}
|
|
16759
|
+
statements.push(...getTranslationDeclStmts(messageOp.message, mainVar, closureVar, messageOp.params, transformFn));
|
|
16760
|
+
return { mainVar, statements };
|
|
16761
|
+
}
|
|
16535
16762
|
function getTranslationDeclStmts(message, variable2, closureVar, params, transformFn) {
|
|
16536
16763
|
const paramsObject = Object.fromEntries(params);
|
|
16537
16764
|
const statements = [
|
|
@@ -16560,52 +16787,38 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
|
|
|
16560
16787
|
return variable(name);
|
|
16561
16788
|
}
|
|
16562
16789
|
function assertAllParamsResolved(op) {
|
|
16563
|
-
if (op.formattedParams === null || op.formattedPostprocessingParams === null) {
|
|
16564
|
-
throw Error("Params should have been formatted.");
|
|
16565
|
-
}
|
|
16566
16790
|
for (const placeholder in op.message.placeholders) {
|
|
16567
|
-
if (!op.
|
|
16791
|
+
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
16568
16792
|
throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
|
|
16569
16793
|
}
|
|
16570
16794
|
}
|
|
16571
16795
|
for (const placeholder in op.message.placeholderToMessage) {
|
|
16572
|
-
if (!op.
|
|
16796
|
+
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
16573
16797
|
throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
|
|
16574
16798
|
}
|
|
16575
16799
|
}
|
|
16576
16800
|
}
|
|
16577
16801
|
|
|
16578
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_message_extraction.mjs
|
|
16579
|
-
function extractI18nMessages(job) {
|
|
16580
|
-
for (const unit of job.units) {
|
|
16581
|
-
for (const op of unit.create) {
|
|
16582
|
-
if (op.kind === OpKind.I18nStart) {
|
|
16583
|
-
unit.create.push(createExtractedMessageOp(op.xref, op.message, op.xref === op.root));
|
|
16584
|
-
}
|
|
16585
|
-
}
|
|
16586
|
-
}
|
|
16587
|
-
}
|
|
16588
|
-
|
|
16589
16802
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
|
|
16590
16803
|
function extractI18nText(job) {
|
|
16591
16804
|
var _a2;
|
|
16592
16805
|
for (const unit of job.units) {
|
|
16593
|
-
let
|
|
16594
|
-
|
|
16595
|
-
const textNodes = /* @__PURE__ */ new Map();
|
|
16806
|
+
let currentI18n = null;
|
|
16807
|
+
const textNodeI18nBlocks = /* @__PURE__ */ new Map();
|
|
16596
16808
|
for (const op of unit.create) {
|
|
16597
16809
|
switch (op.kind) {
|
|
16598
16810
|
case OpKind.I18nStart:
|
|
16599
|
-
|
|
16600
|
-
|
|
16811
|
+
if (op.context === null) {
|
|
16812
|
+
throw Error("I18n op should have its context set.");
|
|
16813
|
+
}
|
|
16814
|
+
currentI18n = op;
|
|
16601
16815
|
break;
|
|
16602
16816
|
case OpKind.I18nEnd:
|
|
16603
|
-
|
|
16604
|
-
currentI18nSlot = null;
|
|
16817
|
+
currentI18n = null;
|
|
16605
16818
|
break;
|
|
16606
16819
|
case OpKind.Text:
|
|
16607
|
-
if (
|
|
16608
|
-
|
|
16820
|
+
if (currentI18n !== null) {
|
|
16821
|
+
textNodeI18nBlocks.set(op.xref, currentI18n);
|
|
16609
16822
|
OpList.remove(op);
|
|
16610
16823
|
}
|
|
16611
16824
|
break;
|
|
@@ -16614,17 +16827,15 @@ function extractI18nText(job) {
|
|
|
16614
16827
|
for (const op of unit.update) {
|
|
16615
16828
|
switch (op.kind) {
|
|
16616
16829
|
case OpKind.InterpolateText:
|
|
16617
|
-
if (!
|
|
16830
|
+
if (!textNodeI18nBlocks.has(op.target)) {
|
|
16618
16831
|
continue;
|
|
16619
16832
|
}
|
|
16620
|
-
const
|
|
16833
|
+
const i18nOp = textNodeI18nBlocks.get(op.target);
|
|
16621
16834
|
const ops = [];
|
|
16622
16835
|
for (let i = 0; i < op.interpolation.expressions.length; i++) {
|
|
16623
16836
|
const expr = op.interpolation.expressions[i];
|
|
16624
16837
|
const placeholder = op.i18nPlaceholders[i];
|
|
16625
|
-
ops.push(createI18nExpressionOp(
|
|
16626
|
-
}
|
|
16627
|
-
if (ops.length > 0) {
|
|
16838
|
+
ops.push(createI18nExpressionOp(i18nOp.context, i18nOp.xref, i18nOp.handle, expr, placeholder.name, I18nParamResolutionTime.Creation, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
|
|
16628
16839
|
}
|
|
16629
16840
|
OpList.replaceWithMany(op, ops);
|
|
16630
16841
|
break;
|
|
@@ -16633,49 +16844,6 @@ function extractI18nText(job) {
|
|
|
16633
16844
|
}
|
|
16634
16845
|
}
|
|
16635
16846
|
|
|
16636
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/icu_extraction.mjs
|
|
16637
|
-
function extractI18nICUs(job) {
|
|
16638
|
-
for (const unit of job.units) {
|
|
16639
|
-
const icus = /* @__PURE__ */ new Map();
|
|
16640
|
-
let currentI18nId = null;
|
|
16641
|
-
let currentI18nSlot = null;
|
|
16642
|
-
for (const op of unit.create) {
|
|
16643
|
-
switch (op.kind) {
|
|
16644
|
-
case OpKind.I18nStart:
|
|
16645
|
-
currentI18nId = op.xref;
|
|
16646
|
-
currentI18nSlot = op.handle;
|
|
16647
|
-
break;
|
|
16648
|
-
case OpKind.I18nEnd:
|
|
16649
|
-
currentI18nId = null;
|
|
16650
|
-
currentI18nSlot = null;
|
|
16651
|
-
break;
|
|
16652
|
-
case OpKind.Icu:
|
|
16653
|
-
if (currentI18nId === null) {
|
|
16654
|
-
throw Error("Unexpected ICU outside of an i18n block.");
|
|
16655
|
-
}
|
|
16656
|
-
icus.set(op.xref, { message: op.message, i18nBlockId: currentI18nId, i18nBlockSlot: currentI18nSlot });
|
|
16657
|
-
OpList.remove(op);
|
|
16658
|
-
break;
|
|
16659
|
-
}
|
|
16660
|
-
}
|
|
16661
|
-
for (const op of unit.update) {
|
|
16662
|
-
switch (op.kind) {
|
|
16663
|
-
case OpKind.IcuUpdate:
|
|
16664
|
-
const { message, i18nBlockId, i18nBlockSlot } = icus.get(op.xref);
|
|
16665
|
-
const icuNode = message.nodes.find((n) => n instanceof Icu2);
|
|
16666
|
-
if (icuNode === void 0) {
|
|
16667
|
-
throw Error("Could not find ICU in i18n AST");
|
|
16668
|
-
}
|
|
16669
|
-
if (icuNode.expressionPlaceholder === void 0) {
|
|
16670
|
-
throw Error("ICU is missing an i18n placeholder");
|
|
16671
|
-
}
|
|
16672
|
-
OpList.replace(op, createI18nExpressionOp(i18nBlockId, i18nBlockSlot, new LexicalReadExpr(icuNode.expression), icuNode.expressionPlaceholder, I18nParamResolutionTime.Postproccessing, null));
|
|
16673
|
-
break;
|
|
16674
|
-
}
|
|
16675
|
-
}
|
|
16676
|
-
}
|
|
16677
|
-
}
|
|
16678
|
-
|
|
16679
16847
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
|
|
16680
16848
|
function liftLocalRefs(job) {
|
|
16681
16849
|
for (const unit of job.units) {
|
|
@@ -16706,6 +16874,47 @@ function serializeLocalRefs(refs) {
|
|
|
16706
16874
|
return literalArr(constRefs);
|
|
16707
16875
|
}
|
|
16708
16876
|
|
|
16877
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/merge_i18n_contexts.mjs
|
|
16878
|
+
function mergeI18nContexts(job) {
|
|
16879
|
+
const i18nOps = /* @__PURE__ */ new Map();
|
|
16880
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
16881
|
+
for (const unit of job.units) {
|
|
16882
|
+
for (const op of unit.create) {
|
|
16883
|
+
switch (op.kind) {
|
|
16884
|
+
case OpKind.I18nStart:
|
|
16885
|
+
if (!op.context) {
|
|
16886
|
+
throw Error("I18n op should have its context set.");
|
|
16887
|
+
}
|
|
16888
|
+
i18nOps.set(op.xref, op);
|
|
16889
|
+
break;
|
|
16890
|
+
case OpKind.I18nContext:
|
|
16891
|
+
i18nContexts.set(op.xref, op);
|
|
16892
|
+
break;
|
|
16893
|
+
}
|
|
16894
|
+
}
|
|
16895
|
+
}
|
|
16896
|
+
for (const childI18nOp of i18nOps.values()) {
|
|
16897
|
+
if (childI18nOp.xref !== childI18nOp.root) {
|
|
16898
|
+
const childContext = i18nContexts.get(childI18nOp.context);
|
|
16899
|
+
const rootI18nOp = i18nOps.get(childI18nOp.root);
|
|
16900
|
+
const rootContext = i18nContexts.get(rootI18nOp.context);
|
|
16901
|
+
mergeParams(rootContext.params, childContext.params);
|
|
16902
|
+
mergeParams(rootContext.postprocessingParams, childContext.postprocessingParams);
|
|
16903
|
+
}
|
|
16904
|
+
}
|
|
16905
|
+
}
|
|
16906
|
+
function mergeParams(to, from) {
|
|
16907
|
+
for (const [placeholder, fromValues] of from) {
|
|
16908
|
+
const toValues = to.get(placeholder) || [];
|
|
16909
|
+
const flags = fromValues[0].flags;
|
|
16910
|
+
if (flags & I18nParamValueFlags.CloseTag && !(flags & I18nParamValueFlags.OpenTag)) {
|
|
16911
|
+
to.set(placeholder, [...fromValues, ...toValues]);
|
|
16912
|
+
} else {
|
|
16913
|
+
to.set(placeholder, [...toValues, ...fromValues]);
|
|
16914
|
+
}
|
|
16915
|
+
}
|
|
16916
|
+
}
|
|
16917
|
+
|
|
16709
16918
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/namespace.mjs
|
|
16710
16919
|
function emitNamespaceChanges(job) {
|
|
16711
16920
|
for (const unit of job.units) {
|
|
@@ -17230,49 +17439,6 @@ function wrapTemplateWithI18n(unit, parentI18n) {
|
|
|
17230
17439
|
}
|
|
17231
17440
|
}
|
|
17232
17441
|
|
|
17233
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_placeholders.mjs
|
|
17234
|
-
function propogateI18nPlaceholders(job) {
|
|
17235
|
-
const i18nOps = /* @__PURE__ */ new Map();
|
|
17236
|
-
const extractedMessageOps = /* @__PURE__ */ new Map();
|
|
17237
|
-
for (const unit of job.units) {
|
|
17238
|
-
for (const op of unit.create) {
|
|
17239
|
-
switch (op.kind) {
|
|
17240
|
-
case OpKind.I18nStart:
|
|
17241
|
-
i18nOps.set(op.xref, op);
|
|
17242
|
-
break;
|
|
17243
|
-
case OpKind.ExtractedMessage:
|
|
17244
|
-
extractedMessageOps.set(op.owner, op);
|
|
17245
|
-
break;
|
|
17246
|
-
}
|
|
17247
|
-
}
|
|
17248
|
-
}
|
|
17249
|
-
for (const [xref, childExtractedMessageOp] of extractedMessageOps) {
|
|
17250
|
-
if (!childExtractedMessageOp.isRoot) {
|
|
17251
|
-
const i18nOp = i18nOps.get(xref);
|
|
17252
|
-
if (i18nOp === void 0) {
|
|
17253
|
-
throw Error("Could not find owner i18n block for extracted message.");
|
|
17254
|
-
}
|
|
17255
|
-
const rootExtractedMessageOp = extractedMessageOps.get(i18nOp.root);
|
|
17256
|
-
if (rootExtractedMessageOp === void 0) {
|
|
17257
|
-
throw Error("Could not find extracted message op for root i18n block.");
|
|
17258
|
-
}
|
|
17259
|
-
mergeParams(rootExtractedMessageOp.params, childExtractedMessageOp.params);
|
|
17260
|
-
mergeParams(rootExtractedMessageOp.postprocessingParams, childExtractedMessageOp.postprocessingParams);
|
|
17261
|
-
}
|
|
17262
|
-
}
|
|
17263
|
-
}
|
|
17264
|
-
function mergeParams(to, from) {
|
|
17265
|
-
for (const [placeholder, fromValues] of from) {
|
|
17266
|
-
const toValues = to.get(placeholder) || [];
|
|
17267
|
-
const flags = fromValues[0].flags;
|
|
17268
|
-
if (flags & I18nParamValueFlags.CloseTag && !(flags & I18nParamValueFlags.OpenTag)) {
|
|
17269
|
-
to.set(placeholder, [...fromValues, ...toValues]);
|
|
17270
|
-
} else {
|
|
17271
|
-
to.set(placeholder, [...toValues, ...fromValues]);
|
|
17272
|
-
}
|
|
17273
|
-
}
|
|
17274
|
-
}
|
|
17275
|
-
|
|
17276
17442
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
|
|
17277
17443
|
function extractPureFunctions(job) {
|
|
17278
17444
|
for (const view of job.units) {
|
|
@@ -17396,13 +17562,21 @@ function elementContainer(slot, constIndex, localRefIndex, sourceSpan) {
|
|
|
17396
17562
|
function elementContainerEnd() {
|
|
17397
17563
|
return call(Identifiers.elementContainerEnd, [], null);
|
|
17398
17564
|
}
|
|
17399
|
-
function template(slot, templateFnRef, decls, vars, tag, constIndex, sourceSpan) {
|
|
17400
|
-
const args = [
|
|
17401
|
-
|
|
17402
|
-
|
|
17403
|
-
|
|
17404
|
-
|
|
17405
|
-
|
|
17565
|
+
function template(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
17566
|
+
const args = [
|
|
17567
|
+
literal(slot),
|
|
17568
|
+
templateFnRef,
|
|
17569
|
+
literal(decls),
|
|
17570
|
+
literal(vars),
|
|
17571
|
+
literal(tag),
|
|
17572
|
+
literal(constIndex)
|
|
17573
|
+
];
|
|
17574
|
+
if (localRefs !== null) {
|
|
17575
|
+
args.push(literal(localRefs));
|
|
17576
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
17577
|
+
}
|
|
17578
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
17579
|
+
args.pop();
|
|
17406
17580
|
}
|
|
17407
17581
|
return call(Identifiers.templateCreate, args, sourceSpan);
|
|
17408
17582
|
}
|
|
@@ -17476,7 +17650,7 @@ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeho
|
|
|
17476
17650
|
const args = [
|
|
17477
17651
|
literal(selfSlot),
|
|
17478
17652
|
literal(primarySlot),
|
|
17479
|
-
literal(
|
|
17653
|
+
dependencyResolverFn != null ? dependencyResolverFn : literal(null),
|
|
17480
17654
|
literal(loadingSlot),
|
|
17481
17655
|
literal(placeholderSlot),
|
|
17482
17656
|
literal(errorSlot),
|
|
@@ -17556,6 +17730,9 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
|
|
|
17556
17730
|
function repeater(metadataSlot, collection, sourceSpan) {
|
|
17557
17731
|
return call(Identifiers.repeater, [literal(metadataSlot), collection], sourceSpan);
|
|
17558
17732
|
}
|
|
17733
|
+
function deferWhen(prefetch, expr, sourceSpan) {
|
|
17734
|
+
return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
|
|
17735
|
+
}
|
|
17559
17736
|
function i18n(slot, constIndex, subTemplateIndex) {
|
|
17560
17737
|
const args = [literal(slot), literal(constIndex)];
|
|
17561
17738
|
if (subTemplateIndex) {
|
|
@@ -17916,8 +18093,11 @@ function reifyCreateOperations(unit, ops) {
|
|
|
17916
18093
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
17917
18094
|
throw new Error(`AssertionError: must be compiling a component`);
|
|
17918
18095
|
}
|
|
18096
|
+
if (Array.isArray(op.localRefs)) {
|
|
18097
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
18098
|
+
}
|
|
17919
18099
|
const childView = unit.job.views.get(op.xref);
|
|
17920
|
-
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.sourceSpan));
|
|
18100
|
+
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.sourceSpan));
|
|
17921
18101
|
break;
|
|
17922
18102
|
case OpKind.DisableBindings:
|
|
17923
18103
|
OpList.replace(op, disableBindings2());
|
|
@@ -17954,7 +18134,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
17954
18134
|
break;
|
|
17955
18135
|
case OpKind.Defer:
|
|
17956
18136
|
const timerScheduling = !!op.loadingMinimumTime || !!op.loadingAfterTime || !!op.placeholderMinimumTime;
|
|
17957
|
-
OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot,
|
|
18137
|
+
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));
|
|
17958
18138
|
break;
|
|
17959
18139
|
case OpKind.DeferOn:
|
|
17960
18140
|
let args = [];
|
|
@@ -18067,7 +18247,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
18067
18247
|
OpList.replace(op, i18nExp(op.expression, op.sourceSpan));
|
|
18068
18248
|
break;
|
|
18069
18249
|
case OpKind.I18nApply:
|
|
18070
|
-
OpList.replace(op, i18nApply(op.
|
|
18250
|
+
OpList.replace(op, i18nApply(op.handle.slot, op.sourceSpan));
|
|
18071
18251
|
break;
|
|
18072
18252
|
case OpKind.InterpolateText:
|
|
18073
18253
|
OpList.replace(op, textInterpolate(op.interpolation.strings, op.interpolation.expressions, op.sourceSpan));
|
|
@@ -18108,6 +18288,9 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
18108
18288
|
case OpKind.Repeater:
|
|
18109
18289
|
OpList.replace(op, repeater(op.targetSlot.slot, op.collection, op.sourceSpan));
|
|
18110
18290
|
break;
|
|
18291
|
+
case OpKind.DeferWhen:
|
|
18292
|
+
OpList.replace(op, deferWhen(op.prefetch, op.expr, op.sourceSpan));
|
|
18293
|
+
break;
|
|
18111
18294
|
case OpKind.Statement:
|
|
18112
18295
|
break;
|
|
18113
18296
|
default:
|
|
@@ -18206,6 +18389,22 @@ function removeEmptyBindings(job) {
|
|
|
18206
18389
|
}
|
|
18207
18390
|
}
|
|
18208
18391
|
|
|
18392
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_i18n_contexts.mjs
|
|
18393
|
+
function removeI18nContexts(job) {
|
|
18394
|
+
for (const unit of job.units) {
|
|
18395
|
+
for (const op of unit.create) {
|
|
18396
|
+
switch (op.kind) {
|
|
18397
|
+
case OpKind.I18nContext:
|
|
18398
|
+
OpList.remove(op);
|
|
18399
|
+
break;
|
|
18400
|
+
case OpKind.I18nStart:
|
|
18401
|
+
op.context = null;
|
|
18402
|
+
break;
|
|
18403
|
+
}
|
|
18404
|
+
}
|
|
18405
|
+
}
|
|
18406
|
+
}
|
|
18407
|
+
|
|
18209
18408
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
|
|
18210
18409
|
function generateRepeaterDerivedVars(job) {
|
|
18211
18410
|
const repeaters = /* @__PURE__ */ new Map();
|
|
@@ -18302,13 +18501,13 @@ function transformDollarEvent(unit, ops) {
|
|
|
18302
18501
|
|
|
18303
18502
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_element_placeholders.mjs
|
|
18304
18503
|
function resolveI18nElementPlaceholders(job) {
|
|
18305
|
-
const
|
|
18504
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
18306
18505
|
const elements = /* @__PURE__ */ new Map();
|
|
18307
18506
|
for (const unit of job.units) {
|
|
18308
18507
|
for (const op of unit.create) {
|
|
18309
18508
|
switch (op.kind) {
|
|
18310
|
-
case OpKind.
|
|
18311
|
-
|
|
18509
|
+
case OpKind.I18nContext:
|
|
18510
|
+
i18nContexts.set(op.xref, op);
|
|
18312
18511
|
break;
|
|
18313
18512
|
case OpKind.ElementStart:
|
|
18314
18513
|
elements.set(op.xref, op);
|
|
@@ -18321,10 +18520,10 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
18321
18520
|
for (const op of unit.create) {
|
|
18322
18521
|
switch (op.kind) {
|
|
18323
18522
|
case OpKind.I18nStart:
|
|
18324
|
-
if (!
|
|
18325
|
-
throw Error("Could not find
|
|
18523
|
+
if (!op.context) {
|
|
18524
|
+
throw Error("Could not find i18n context for i18n op");
|
|
18326
18525
|
}
|
|
18327
|
-
currentOps = {
|
|
18526
|
+
currentOps = { i18nBlock: op, i18nContext: i18nContexts.get(op.context) };
|
|
18328
18527
|
break;
|
|
18329
18528
|
case OpKind.I18nEnd:
|
|
18330
18529
|
currentOps = null;
|
|
@@ -18339,7 +18538,7 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
18339
18538
|
if (closeName === "") {
|
|
18340
18539
|
flags |= I18nParamValueFlags.CloseTag;
|
|
18341
18540
|
}
|
|
18342
|
-
addParam(currentOps.
|
|
18541
|
+
addParam(currentOps.i18nContext.params, startName, op.handle.slot, currentOps.i18nBlock.subTemplateIndex, flags);
|
|
18343
18542
|
}
|
|
18344
18543
|
break;
|
|
18345
18544
|
case OpKind.ElementEnd:
|
|
@@ -18350,7 +18549,7 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
18350
18549
|
}
|
|
18351
18550
|
const { closeName } = startOp.i18nPlaceholder;
|
|
18352
18551
|
if (closeName !== "") {
|
|
18353
|
-
addParam(currentOps.
|
|
18552
|
+
addParam(currentOps.i18nContext.params, closeName, startOp.handle.slot, currentOps.i18nBlock.subTemplateIndex, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
|
|
18354
18553
|
}
|
|
18355
18554
|
}
|
|
18356
18555
|
break;
|
|
@@ -18359,9 +18558,9 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
18359
18558
|
if (currentOps === null) {
|
|
18360
18559
|
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
18361
18560
|
}
|
|
18362
|
-
const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.
|
|
18363
|
-
addParam(currentOps.
|
|
18364
|
-
addParam(currentOps.
|
|
18561
|
+
const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.i18nBlock, op);
|
|
18562
|
+
addParam(currentOps.i18nContext.params, op.i18nPlaceholder.startName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag);
|
|
18563
|
+
addParam(currentOps.i18nContext.params, op.i18nPlaceholder.closeName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
|
|
18365
18564
|
}
|
|
18366
18565
|
break;
|
|
18367
18566
|
}
|
|
@@ -18385,16 +18584,16 @@ function addParam(params, placeholder, value, subTemplateIndex, flags = I18nPara
|
|
|
18385
18584
|
|
|
18386
18585
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs
|
|
18387
18586
|
function resolveI18nExpressionPlaceholders(job) {
|
|
18388
|
-
const
|
|
18389
|
-
const
|
|
18587
|
+
const subTemplateIndicies = /* @__PURE__ */ new Map();
|
|
18588
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
18390
18589
|
for (const unit of job.units) {
|
|
18391
18590
|
for (const op of unit.create) {
|
|
18392
18591
|
switch (op.kind) {
|
|
18393
18592
|
case OpKind.I18nStart:
|
|
18394
|
-
|
|
18593
|
+
subTemplateIndicies.set(op.xref, op.subTemplateIndex);
|
|
18395
18594
|
break;
|
|
18396
|
-
case OpKind.
|
|
18397
|
-
|
|
18595
|
+
case OpKind.I18nContext:
|
|
18596
|
+
i18nContexts.set(op.xref, op);
|
|
18398
18597
|
break;
|
|
18399
18598
|
}
|
|
18400
18599
|
}
|
|
@@ -18403,24 +18602,14 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
18403
18602
|
for (const unit of job.units) {
|
|
18404
18603
|
for (const op of unit.update) {
|
|
18405
18604
|
if (op.kind === OpKind.I18nExpression) {
|
|
18406
|
-
const
|
|
18407
|
-
|
|
18408
|
-
|
|
18409
|
-
|
|
18410
|
-
}
|
|
18411
|
-
const extractedMessageOp = extractedMessageOps.get(i18nOp.xref);
|
|
18412
|
-
if (!extractedMessageOp) {
|
|
18413
|
-
throw Error("Cannot find extracted message for i18n block");
|
|
18414
|
-
}
|
|
18415
|
-
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? extractedMessageOp.params : extractedMessageOp.postprocessingParams;
|
|
18605
|
+
const index = expressionIndices.get(op.context) || 0;
|
|
18606
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
18607
|
+
const subTemplateIndex = subTemplateIndicies.get(i18nContext.i18nBlock);
|
|
18608
|
+
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
|
|
18416
18609
|
const values = params.get(op.i18nPlaceholder) || [];
|
|
18417
|
-
values.push({
|
|
18418
|
-
value: index,
|
|
18419
|
-
subTemplateIndex: i18nOp.subTemplateIndex,
|
|
18420
|
-
flags: I18nParamValueFlags.None
|
|
18421
|
-
});
|
|
18610
|
+
values.push({ value: index, subTemplateIndex, flags: I18nParamValueFlags.None });
|
|
18422
18611
|
params.set(op.i18nPlaceholder, values);
|
|
18423
|
-
expressionIndices.set(op.
|
|
18612
|
+
expressionIndices.set(op.context, index + 1);
|
|
18424
18613
|
}
|
|
18425
18614
|
}
|
|
18426
18615
|
}
|
|
@@ -19171,6 +19360,7 @@ var phases = [
|
|
|
19171
19360
|
{ kind: CompilationJobKind.Both, fn: specializeBindings },
|
|
19172
19361
|
{ kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
|
|
19173
19362
|
{ kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
|
|
19363
|
+
{ kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
|
|
19174
19364
|
{ kind: CompilationJobKind.Both, fn: extractAttributes },
|
|
19175
19365
|
{ kind: CompilationJobKind.Both, fn: parseExtractedStyles },
|
|
19176
19366
|
{ kind: CompilationJobKind.Tmpl, fn: removeEmptyBindings },
|
|
@@ -19180,7 +19370,7 @@ var phases = [
|
|
|
19180
19370
|
{ kind: CompilationJobKind.Tmpl, fn: createPipes },
|
|
19181
19371
|
{ kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
|
|
19182
19372
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nText },
|
|
19183
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
19373
|
+
{ kind: CompilationJobKind.Tmpl, fn: createI18nIcuExpressions },
|
|
19184
19374
|
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
19185
19375
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
19186
19376
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
@@ -19201,16 +19391,17 @@ var phases = [
|
|
|
19201
19391
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
19202
19392
|
{ kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
|
|
19203
19393
|
{ kind: CompilationJobKind.Tmpl, fn: allocateSlots },
|
|
19204
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
19394
|
+
{ kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
|
|
19205
19395
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
19206
19396
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
19207
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
19208
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
19397
|
+
{ kind: CompilationJobKind.Tmpl, fn: mergeI18nContexts },
|
|
19398
|
+
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
19209
19399
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
|
|
19210
19400
|
{ kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
|
|
19211
19401
|
{ kind: CompilationJobKind.Tmpl, fn: collectConstExpressions },
|
|
19212
19402
|
{ kind: CompilationJobKind.Both, fn: collectElementConsts },
|
|
19213
19403
|
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
19404
|
+
{ kind: CompilationJobKind.Tmpl, fn: removeI18nContexts },
|
|
19214
19405
|
{ kind: CompilationJobKind.Both, fn: countVariables },
|
|
19215
19406
|
{ kind: CompilationJobKind.Tmpl, fn: generateAdvance },
|
|
19216
19407
|
{ kind: CompilationJobKind.Both, fn: optimizeVariables },
|
|
@@ -19327,8 +19518,8 @@ function emitHostBindingFunction(job) {
|
|
|
19327
19518
|
|
|
19328
19519
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
|
|
19329
19520
|
var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
|
|
19330
|
-
function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds) {
|
|
19331
|
-
const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds);
|
|
19521
|
+
function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
|
|
19522
|
+
const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta);
|
|
19332
19523
|
ingestNodes(job.root, template2);
|
|
19333
19524
|
return job;
|
|
19334
19525
|
}
|
|
@@ -19411,6 +19602,7 @@ function ingestNodes(unit, template2) {
|
|
|
19411
19602
|
}
|
|
19412
19603
|
}
|
|
19413
19604
|
function ingestElement(unit, element2) {
|
|
19605
|
+
var _a2;
|
|
19414
19606
|
if (element2.i18n !== void 0 && !(element2.i18n instanceof Message || element2.i18n instanceof TagPlaceholder)) {
|
|
19415
19607
|
throw Error(`Unhandled i18n metadata type for element: ${element2.i18n.constructor.name}`);
|
|
19416
19608
|
}
|
|
@@ -19421,7 +19613,7 @@ function ingestElement(unit, element2) {
|
|
|
19421
19613
|
ingestBindings(unit, startOp, element2);
|
|
19422
19614
|
ingestReferences(startOp, element2);
|
|
19423
19615
|
ingestNodes(unit, element2.children);
|
|
19424
|
-
const endOp = createElementEndOp(id, element2.endSourceSpan);
|
|
19616
|
+
const endOp = createElementEndOp(id, (_a2 = element2.endSourceSpan) != null ? _a2 : element2.startSourceSpan);
|
|
19425
19617
|
unit.create.push(endOp);
|
|
19426
19618
|
if (element2.i18n instanceof Message) {
|
|
19427
19619
|
const i18nBlockId = unit.job.allocateXrefId();
|
|
@@ -19544,12 +19736,16 @@ function ingestDeferView(unit, suffix, children, sourceSpan) {
|
|
|
19544
19736
|
}
|
|
19545
19737
|
function ingestDeferBlock(unit, deferBlock) {
|
|
19546
19738
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
19739
|
+
const blockMeta = unit.job.deferBlocksMeta.get(deferBlock);
|
|
19740
|
+
if (blockMeta === void 0) {
|
|
19741
|
+
throw new Error(`AssertionError: unable to find metadata for deferred block`);
|
|
19742
|
+
}
|
|
19547
19743
|
const main = ingestDeferView(unit, "", deferBlock.children, deferBlock.sourceSpan);
|
|
19548
19744
|
const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.children, (_b2 = deferBlock.loading) == null ? void 0 : _b2.sourceSpan);
|
|
19549
19745
|
const placeholder = ingestDeferView(unit, "Placeholder", (_c2 = deferBlock.placeholder) == null ? void 0 : _c2.children, (_d2 = deferBlock.placeholder) == null ? void 0 : _d2.sourceSpan);
|
|
19550
19746
|
const error2 = ingestDeferView(unit, "Error", (_e2 = deferBlock.error) == null ? void 0 : _e2.children, (_f2 = deferBlock.error) == null ? void 0 : _f2.sourceSpan);
|
|
19551
19747
|
const deferXref = unit.job.allocateXrefId();
|
|
19552
|
-
const deferOp = createDeferOp(deferXref, main.xref, main.handle, deferBlock.sourceSpan);
|
|
19748
|
+
const deferOp = createDeferOp(deferXref, main.xref, main.handle, blockMeta, deferBlock.sourceSpan);
|
|
19553
19749
|
deferOp.placeholderView = (_g = placeholder == null ? void 0 : placeholder.xref) != null ? _g : null;
|
|
19554
19750
|
deferOp.placeholderSlot = (_h = placeholder == null ? void 0 : placeholder.handle) != null ? _h : null;
|
|
19555
19751
|
deferOp.loadingSlot = (_i = loading == null ? void 0 : loading.handle) != null ? _i : null;
|
|
@@ -19560,17 +19756,18 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
19560
19756
|
unit.create.push(deferOp);
|
|
19561
19757
|
let prefetch = false;
|
|
19562
19758
|
let deferOnOps = [];
|
|
19759
|
+
let deferWhenOps = [];
|
|
19563
19760
|
for (const triggers of [deferBlock.triggers, deferBlock.prefetchTriggers]) {
|
|
19564
19761
|
if (triggers.idle !== void 0) {
|
|
19565
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, prefetch,
|
|
19762
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, prefetch, triggers.idle.sourceSpan);
|
|
19566
19763
|
deferOnOps.push(deferOnOp);
|
|
19567
19764
|
}
|
|
19568
19765
|
if (triggers.immediate !== void 0) {
|
|
19569
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, prefetch,
|
|
19766
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, prefetch, triggers.immediate.sourceSpan);
|
|
19570
19767
|
deferOnOps.push(deferOnOp);
|
|
19571
19768
|
}
|
|
19572
19769
|
if (triggers.timer !== void 0) {
|
|
19573
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, prefetch,
|
|
19770
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, prefetch, triggers.timer.sourceSpan);
|
|
19574
19771
|
deferOnOps.push(deferOnOp);
|
|
19575
19772
|
}
|
|
19576
19773
|
if (triggers.hover !== void 0) {
|
|
@@ -19581,7 +19778,7 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
19581
19778
|
targetSlot: null,
|
|
19582
19779
|
targetView: null,
|
|
19583
19780
|
targetSlotViewSteps: null
|
|
19584
|
-
}, prefetch,
|
|
19781
|
+
}, prefetch, triggers.hover.sourceSpan);
|
|
19585
19782
|
deferOnOps.push(deferOnOp);
|
|
19586
19783
|
}
|
|
19587
19784
|
if (triggers.interaction !== void 0) {
|
|
@@ -19592,7 +19789,7 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
19592
19789
|
targetSlot: null,
|
|
19593
19790
|
targetView: null,
|
|
19594
19791
|
targetSlotViewSteps: null
|
|
19595
|
-
}, prefetch,
|
|
19792
|
+
}, prefetch, triggers.interaction.sourceSpan);
|
|
19596
19793
|
deferOnOps.push(deferOnOp);
|
|
19597
19794
|
}
|
|
19598
19795
|
if (triggers.viewport !== void 0) {
|
|
@@ -19603,21 +19800,26 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
19603
19800
|
targetSlot: null,
|
|
19604
19801
|
targetView: null,
|
|
19605
19802
|
targetSlotViewSteps: null
|
|
19606
|
-
}, prefetch,
|
|
19803
|
+
}, prefetch, triggers.viewport.sourceSpan);
|
|
19607
19804
|
deferOnOps.push(deferOnOp);
|
|
19608
19805
|
}
|
|
19609
|
-
if (
|
|
19806
|
+
if (triggers.when !== void 0) {
|
|
19807
|
+
const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
|
|
19808
|
+
deferWhenOps.push(deferOnOp);
|
|
19809
|
+
}
|
|
19810
|
+
if (deferOnOps.length === 0 && deferWhenOps.length === 0) {
|
|
19610
19811
|
deferOnOps.push(createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, false, null));
|
|
19611
19812
|
}
|
|
19612
19813
|
prefetch = true;
|
|
19613
19814
|
}
|
|
19614
19815
|
unit.create.push(deferOnOps);
|
|
19816
|
+
unit.update.push(deferWhenOps);
|
|
19615
19817
|
}
|
|
19616
19818
|
function ingestIcu(unit, icu) {
|
|
19617
19819
|
var _a2;
|
|
19618
|
-
if (icu.i18n instanceof Message) {
|
|
19820
|
+
if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
|
|
19619
19821
|
const xref = unit.job.allocateXrefId();
|
|
19620
|
-
unit.create.push(createIcuOp(xref, icu.i18n, null));
|
|
19822
|
+
unit.create.push(createIcuOp(xref, icu.i18n, icu.i18n.nodes[0], icuFromI18nMessage(icu.i18n).name, null));
|
|
19621
19823
|
unit.update.push(createIcuUpdateOp(xref, null));
|
|
19622
19824
|
} else {
|
|
19623
19825
|
throw Error(`Unhandled i18n metadata type for ICU: ${(_a2 = icu.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
@@ -19675,6 +19877,15 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
19675
19877
|
return new ReadPropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, null, convertSourceSpan(ast.span, baseSourceSpan));
|
|
19676
19878
|
}
|
|
19677
19879
|
} else if (ast instanceof PropertyWrite) {
|
|
19880
|
+
if (ast.receiver instanceof ImplicitReceiver) {
|
|
19881
|
+
return new WritePropExpr(
|
|
19882
|
+
new ContextExpr(job.root.xref),
|
|
19883
|
+
ast.name,
|
|
19884
|
+
convertAst(ast.value, job, baseSourceSpan),
|
|
19885
|
+
null,
|
|
19886
|
+
convertSourceSpan(ast.span, baseSourceSpan)
|
|
19887
|
+
);
|
|
19888
|
+
}
|
|
19678
19889
|
return new WritePropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, convertAst(ast.value, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
19679
19890
|
} else if (ast instanceof KeyedWrite) {
|
|
19680
19891
|
return new WriteKeyExpr(convertAst(ast.receiver, job, baseSourceSpan), convertAst(ast.key, job, baseSourceSpan), convertAst(ast.value, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
@@ -19724,7 +19935,7 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
19724
19935
|
} else if (ast instanceof EmptyExpr) {
|
|
19725
19936
|
return new EmptyExpr2(convertSourceSpan(ast.span, baseSourceSpan));
|
|
19726
19937
|
} else {
|
|
19727
|
-
throw new Error(`Unhandled expression type
|
|
19938
|
+
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
|
|
19728
19939
|
}
|
|
19729
19940
|
}
|
|
19730
19941
|
function isPlainTemplate(tmpl) {
|
|
@@ -19862,7 +20073,8 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
19862
20073
|
for (const attr of root.attributes) {
|
|
19863
20074
|
ingestBinding(unit, xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue);
|
|
19864
20075
|
}
|
|
19865
|
-
|
|
20076
|
+
const tagName = root instanceof Element ? root.name : root.tagName;
|
|
20077
|
+
return tagName === "ng-template" ? null : tagName;
|
|
19866
20078
|
}
|
|
19867
20079
|
return null;
|
|
19868
20080
|
}
|
|
@@ -22760,7 +22972,8 @@ var TemplateDefinitionBuilder = class {
|
|
|
22760
22972
|
}
|
|
22761
22973
|
}
|
|
22762
22974
|
if (root !== null) {
|
|
22763
|
-
|
|
22975
|
+
const name = root instanceof Element ? root.name : root.tagName;
|
|
22976
|
+
tagName = name === NG_TEMPLATE_TAG_NAME ? null : name;
|
|
22764
22977
|
attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, root.attributes, root.inputs, []);
|
|
22765
22978
|
}
|
|
22766
22979
|
return { tagName, attrsExprs };
|
|
@@ -23710,7 +23923,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
23710
23923
|
}
|
|
23711
23924
|
definitionMap.set("template", templateFunctionExpression);
|
|
23712
23925
|
} else {
|
|
23713
|
-
const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds);
|
|
23926
|
+
const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.deferBlocks);
|
|
23714
23927
|
transform(tpl, CompilationJobKind.Tmpl);
|
|
23715
23928
|
const templateFn = emitTemplateFn(tpl, constantPool);
|
|
23716
23929
|
if (tpl.contentSelectors !== null) {
|
|
@@ -25361,7 +25574,7 @@ function publishFacade(global) {
|
|
|
25361
25574
|
}
|
|
25362
25575
|
|
|
25363
25576
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
|
|
25364
|
-
var VERSION2 = new Version("17.0.0
|
|
25577
|
+
var VERSION2 = new Version("17.0.0");
|
|
25365
25578
|
|
|
25366
25579
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
25367
25580
|
var _I18N_ATTR = "i18n";
|
|
@@ -26398,7 +26611,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
|
|
|
26398
26611
|
function compileDeclareClassMetadata(metadata) {
|
|
26399
26612
|
const definitionMap = new DefinitionMap();
|
|
26400
26613
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
26401
|
-
definitionMap.set("version", literal("17.0.0
|
|
26614
|
+
definitionMap.set("version", literal("17.0.0"));
|
|
26402
26615
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
26403
26616
|
definitionMap.set("type", metadata.type);
|
|
26404
26617
|
definitionMap.set("decorators", metadata.decorators);
|
|
@@ -26469,7 +26682,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
26469
26682
|
const hasTransformFunctions = Object.values(meta.inputs).some((input) => input.transformFunction !== null);
|
|
26470
26683
|
const minVersion = hasTransformFunctions ? MINIMUM_PARTIAL_LINKER_VERSION2 : "14.0.0";
|
|
26471
26684
|
definitionMap.set("minVersion", literal(minVersion));
|
|
26472
|
-
definitionMap.set("version", literal("17.0.0
|
|
26685
|
+
definitionMap.set("version", literal("17.0.0"));
|
|
26473
26686
|
definitionMap.set("type", meta.type.value);
|
|
26474
26687
|
if (meta.isStandalone) {
|
|
26475
26688
|
definitionMap.set("isStandalone", literal(meta.isStandalone));
|
|
@@ -26701,7 +26914,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
|
|
|
26701
26914
|
function compileDeclareFactoryFunction(meta) {
|
|
26702
26915
|
const definitionMap = new DefinitionMap();
|
|
26703
26916
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
|
|
26704
|
-
definitionMap.set("version", literal("17.0.0
|
|
26917
|
+
definitionMap.set("version", literal("17.0.0"));
|
|
26705
26918
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
26706
26919
|
definitionMap.set("type", meta.type.value);
|
|
26707
26920
|
definitionMap.set("deps", compileDependencies(meta.deps));
|
|
@@ -26724,7 +26937,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
26724
26937
|
function createInjectableDefinitionMap(meta) {
|
|
26725
26938
|
const definitionMap = new DefinitionMap();
|
|
26726
26939
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
|
|
26727
|
-
definitionMap.set("version", literal("17.0.0
|
|
26940
|
+
definitionMap.set("version", literal("17.0.0"));
|
|
26728
26941
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
26729
26942
|
definitionMap.set("type", meta.type.value);
|
|
26730
26943
|
if (meta.providedIn !== void 0) {
|
|
@@ -26762,7 +26975,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
26762
26975
|
function createInjectorDefinitionMap(meta) {
|
|
26763
26976
|
const definitionMap = new DefinitionMap();
|
|
26764
26977
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
|
|
26765
|
-
definitionMap.set("version", literal("17.0.0
|
|
26978
|
+
definitionMap.set("version", literal("17.0.0"));
|
|
26766
26979
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
26767
26980
|
definitionMap.set("type", meta.type.value);
|
|
26768
26981
|
definitionMap.set("providers", meta.providers);
|
|
@@ -26786,7 +26999,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
26786
26999
|
throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
|
|
26787
27000
|
}
|
|
26788
27001
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
|
|
26789
|
-
definitionMap.set("version", literal("17.0.0
|
|
27002
|
+
definitionMap.set("version", literal("17.0.0"));
|
|
26790
27003
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
26791
27004
|
definitionMap.set("type", meta.type.value);
|
|
26792
27005
|
if (meta.bootstrap.length > 0) {
|
|
@@ -26821,7 +27034,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
26821
27034
|
function createPipeDefinitionMap(meta) {
|
|
26822
27035
|
const definitionMap = new DefinitionMap();
|
|
26823
27036
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
|
|
26824
|
-
definitionMap.set("version", literal("17.0.0
|
|
27037
|
+
definitionMap.set("version", literal("17.0.0"));
|
|
26825
27038
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
26826
27039
|
definitionMap.set("type", meta.type.value);
|
|
26827
27040
|
if (meta.isStandalone) {
|
|
@@ -26838,7 +27051,7 @@ function createPipeDefinitionMap(meta) {
|
|
|
26838
27051
|
publishFacade(_global);
|
|
26839
27052
|
|
|
26840
27053
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version.mjs
|
|
26841
|
-
var VERSION3 = new Version("17.0.0
|
|
27054
|
+
var VERSION3 = new Version("17.0.0");
|
|
26842
27055
|
|
|
26843
27056
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
26844
27057
|
var EmitFlags;
|