@angular/compiler 17.0.0-rc.2 → 17.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2022/src/render3/partial/directive.mjs +1 -1
- package/esm2022/src/render3/partial/factory.mjs +1 -1
- package/esm2022/src/render3/partial/injectable.mjs +1 -1
- package/esm2022/src/render3/partial/injector.mjs +1 -1
- package/esm2022/src/render3/partial/ng_module.mjs +1 -1
- package/esm2022/src/render3/partial/pipe.mjs +1 -1
- package/esm2022/src/render3/view/compiler.mjs +2 -2
- package/esm2022/src/render3/view/i18n/util.mjs +1 -1
- package/esm2022/src/render3/view/template.mjs +4 -2
- package/esm2022/src/template/pipeline/ir/src/enums.mjs +23 -15
- package/esm2022/src/template/pipeline/ir/src/expression.mjs +14 -3
- package/esm2022/src/template/pipeline/ir/src/ops/create.mjs +30 -12
- package/esm2022/src/template/pipeline/ir/src/ops/update.mjs +18 -7
- package/esm2022/src/template/pipeline/src/compilation.mjs +3 -2
- package/esm2022/src/template/pipeline/src/emit.mjs +13 -9
- package/esm2022/src/template/pipeline/src/ingest.mjs +39 -16
- package/esm2022/src/template/pipeline/src/instruction.mjs +20 -9
- package/esm2022/src/template/pipeline/src/phases/apply_i18n_expressions.mjs +4 -4
- package/esm2022/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs +17 -5
- package/esm2022/src/template/pipeline/src/phases/create_defer_deps_fns.mjs +43 -0
- package/esm2022/src/template/pipeline/src/phases/create_i18n_contexts.mjs +57 -0
- package/esm2022/src/template/pipeline/src/phases/create_i18n_icu_expressions.mjs +52 -0
- package/esm2022/src/template/pipeline/src/phases/defer_resolve_targets.mjs +21 -1
- package/esm2022/src/template/pipeline/src/phases/extract_i18n_messages.mjs +157 -0
- package/esm2022/src/template/pipeline/src/phases/i18n_const_collection.mjs +48 -31
- package/esm2022/src/template/pipeline/src/phases/i18n_text_extraction.mjs +15 -16
- package/esm2022/src/template/pipeline/src/phases/merge_i18n_contexts.mjs +59 -0
- package/esm2022/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs +4 -2
- package/esm2022/src/template/pipeline/src/phases/reify.mjs +10 -4
- package/esm2022/src/template/pipeline/src/phases/remove_i18n_contexts.mjs +27 -0
- package/esm2022/src/template/pipeline/src/phases/resolve_i18n_element_placeholders.mjs +15 -15
- package/esm2022/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs +15 -25
- package/esm2022/src/version.mjs +1 -1
- package/fesm2022/compiler.mjs +550 -291
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +2 -2
- package/esm2022/src/template/pipeline/src/phases/format_i18n_params.mjs +0 -114
- package/esm2022/src/template/pipeline/src/phases/i18n_message_extraction.mjs +0 -21
- package/esm2022/src/template/pipeline/src/phases/icu_extraction.mjs +0 -56
- package/esm2022/src/template/pipeline/src/phases/propagate_i18n_placeholders.mjs +0 -61
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.0.0-rc.
|
|
2
|
+
* @license Angular v17.0.0-rc.3
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -8797,62 +8797,70 @@ var OpKind;
|
|
|
8797
8797
|
* An operation that controls when a `@defer` loads.
|
|
8798
8798
|
*/
|
|
8799
8799
|
OpKind[OpKind["DeferOn"] = 27] = "DeferOn";
|
|
8800
|
+
/**
|
|
8801
|
+
* An operation that controls when a `@defer` loads, using a custom expression as the condition.
|
|
8802
|
+
*/
|
|
8803
|
+
OpKind[OpKind["DeferWhen"] = 28] = "DeferWhen";
|
|
8800
8804
|
/**
|
|
8801
8805
|
* An i18n message that has been extracted for inclusion in the consts array.
|
|
8802
8806
|
*/
|
|
8803
|
-
OpKind[OpKind["
|
|
8807
|
+
OpKind[OpKind["I18nMessage"] = 29] = "I18nMessage";
|
|
8804
8808
|
/**
|
|
8805
8809
|
* A host binding property.
|
|
8806
8810
|
*/
|
|
8807
|
-
OpKind[OpKind["HostProperty"] =
|
|
8811
|
+
OpKind[OpKind["HostProperty"] = 30] = "HostProperty";
|
|
8808
8812
|
/**
|
|
8809
8813
|
* A namespace change, which causes the subsequent elements to be processed as either HTML or SVG.
|
|
8810
8814
|
*/
|
|
8811
|
-
OpKind[OpKind["Namespace"] =
|
|
8815
|
+
OpKind[OpKind["Namespace"] = 31] = "Namespace";
|
|
8812
8816
|
/**
|
|
8813
8817
|
* Configure a content projeciton definition for the view.
|
|
8814
8818
|
*/
|
|
8815
|
-
OpKind[OpKind["ProjectionDef"] =
|
|
8819
|
+
OpKind[OpKind["ProjectionDef"] = 32] = "ProjectionDef";
|
|
8816
8820
|
/**
|
|
8817
8821
|
* Create a content projection slot.
|
|
8818
8822
|
*/
|
|
8819
|
-
OpKind[OpKind["Projection"] =
|
|
8823
|
+
OpKind[OpKind["Projection"] = 33] = "Projection";
|
|
8820
8824
|
/**
|
|
8821
8825
|
* Create a repeater creation instruction op.
|
|
8822
8826
|
*/
|
|
8823
|
-
OpKind[OpKind["RepeaterCreate"] =
|
|
8827
|
+
OpKind[OpKind["RepeaterCreate"] = 34] = "RepeaterCreate";
|
|
8824
8828
|
/**
|
|
8825
8829
|
* An update up for a repeater.
|
|
8826
8830
|
*/
|
|
8827
|
-
OpKind[OpKind["Repeater"] =
|
|
8831
|
+
OpKind[OpKind["Repeater"] = 35] = "Repeater";
|
|
8828
8832
|
/**
|
|
8829
8833
|
* The start of an i18n block.
|
|
8830
8834
|
*/
|
|
8831
|
-
OpKind[OpKind["I18nStart"] =
|
|
8835
|
+
OpKind[OpKind["I18nStart"] = 36] = "I18nStart";
|
|
8832
8836
|
/**
|
|
8833
8837
|
* A self-closing i18n on a single element.
|
|
8834
8838
|
*/
|
|
8835
|
-
OpKind[OpKind["I18n"] =
|
|
8839
|
+
OpKind[OpKind["I18n"] = 37] = "I18n";
|
|
8836
8840
|
/**
|
|
8837
8841
|
* The end of an i18n block.
|
|
8838
8842
|
*/
|
|
8839
|
-
OpKind[OpKind["I18nEnd"] =
|
|
8843
|
+
OpKind[OpKind["I18nEnd"] = 38] = "I18nEnd";
|
|
8840
8844
|
/**
|
|
8841
8845
|
* An expression in an i18n message.
|
|
8842
8846
|
*/
|
|
8843
|
-
OpKind[OpKind["I18nExpression"] =
|
|
8847
|
+
OpKind[OpKind["I18nExpression"] = 39] = "I18nExpression";
|
|
8844
8848
|
/**
|
|
8845
8849
|
* An instruction that applies a set of i18n expressions.
|
|
8846
8850
|
*/
|
|
8847
|
-
OpKind[OpKind["I18nApply"] =
|
|
8851
|
+
OpKind[OpKind["I18nApply"] = 40] = "I18nApply";
|
|
8848
8852
|
/**
|
|
8849
8853
|
* An instruction to create an ICU expression.
|
|
8850
8854
|
*/
|
|
8851
|
-
OpKind[OpKind["Icu"] =
|
|
8855
|
+
OpKind[OpKind["Icu"] = 41] = "Icu";
|
|
8852
8856
|
/**
|
|
8853
8857
|
* An instruction to update an ICU expression.
|
|
8854
8858
|
*/
|
|
8855
|
-
OpKind[OpKind["IcuUpdate"] =
|
|
8859
|
+
OpKind[OpKind["IcuUpdate"] = 42] = "IcuUpdate";
|
|
8860
|
+
/**
|
|
8861
|
+
* An i18n context containing information needed to generate an i18n message.
|
|
8862
|
+
*/
|
|
8863
|
+
OpKind[OpKind["I18nContext"] = 43] = "I18nContext";
|
|
8856
8864
|
})(OpKind || (OpKind = {}));
|
|
8857
8865
|
/**
|
|
8858
8866
|
* Distinguishes different kinds of IR expressions.
|
|
@@ -9404,15 +9412,26 @@ function createRepeaterOp(repeaterCreate, targetSlot, collection, sourceSpan) {
|
|
|
9404
9412
|
...NEW_OP,
|
|
9405
9413
|
};
|
|
9406
9414
|
}
|
|
9415
|
+
function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
|
|
9416
|
+
return {
|
|
9417
|
+
kind: OpKind.DeferWhen,
|
|
9418
|
+
target,
|
|
9419
|
+
expr,
|
|
9420
|
+
prefetch,
|
|
9421
|
+
sourceSpan,
|
|
9422
|
+
...NEW_OP,
|
|
9423
|
+
...TRAIT_DEPENDS_ON_SLOT_CONTEXT,
|
|
9424
|
+
};
|
|
9425
|
+
}
|
|
9407
9426
|
/**
|
|
9408
9427
|
* Create an i18n expression op.
|
|
9409
9428
|
*/
|
|
9410
|
-
function createI18nExpressionOp(
|
|
9429
|
+
function createI18nExpressionOp(context, target, handle, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
|
|
9411
9430
|
return {
|
|
9412
9431
|
kind: OpKind.I18nExpression,
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
|
|
9432
|
+
context,
|
|
9433
|
+
target,
|
|
9434
|
+
handle,
|
|
9416
9435
|
expression,
|
|
9417
9436
|
i18nPlaceholder,
|
|
9418
9437
|
resolutionTime,
|
|
@@ -9425,11 +9444,11 @@ function createI18nExpressionOp(owner, ownerSlot, expression, i18nPlaceholder, r
|
|
|
9425
9444
|
/**
|
|
9426
9445
|
*Creates an op to apply i18n expression ops
|
|
9427
9446
|
*/
|
|
9428
|
-
function createI18nApplyOp(target,
|
|
9447
|
+
function createI18nApplyOp(target, handle, sourceSpan) {
|
|
9429
9448
|
return {
|
|
9430
9449
|
kind: OpKind.I18nApply,
|
|
9431
9450
|
target,
|
|
9432
|
-
|
|
9451
|
+
handle,
|
|
9433
9452
|
sourceSpan,
|
|
9434
9453
|
...NEW_OP,
|
|
9435
9454
|
};
|
|
@@ -10209,6 +10228,17 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
10209
10228
|
transformExpressionsInExpression(op.placeholderConfig, transform, flags);
|
|
10210
10229
|
}
|
|
10211
10230
|
break;
|
|
10231
|
+
case OpKind.I18nMessage:
|
|
10232
|
+
for (const [placeholder, expr] of op.params) {
|
|
10233
|
+
op.params.set(placeholder, transformExpressionsInExpression(expr, transform, flags));
|
|
10234
|
+
}
|
|
10235
|
+
for (const [placeholder, expr] of op.postprocessingParams) {
|
|
10236
|
+
op.postprocessingParams.set(placeholder, transformExpressionsInExpression(expr, transform, flags));
|
|
10237
|
+
}
|
|
10238
|
+
break;
|
|
10239
|
+
case OpKind.DeferWhen:
|
|
10240
|
+
op.expr = transformExpressionsInExpression(op.expr, transform, flags);
|
|
10241
|
+
break;
|
|
10212
10242
|
case OpKind.Advance:
|
|
10213
10243
|
case OpKind.Container:
|
|
10214
10244
|
case OpKind.ContainerEnd:
|
|
@@ -10219,9 +10249,9 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
10219
10249
|
case OpKind.ElementEnd:
|
|
10220
10250
|
case OpKind.ElementStart:
|
|
10221
10251
|
case OpKind.EnableBindings:
|
|
10222
|
-
case OpKind.ExtractedMessage:
|
|
10223
10252
|
case OpKind.I18n:
|
|
10224
10253
|
case OpKind.I18nApply:
|
|
10254
|
+
case OpKind.I18nContext:
|
|
10225
10255
|
case OpKind.I18nEnd:
|
|
10226
10256
|
case OpKind.I18nStart:
|
|
10227
10257
|
case OpKind.Icu:
|
|
@@ -10797,7 +10827,7 @@ function createExtractedAttributeOp(target, bindingKind, name, expression) {
|
|
|
10797
10827
|
...NEW_OP,
|
|
10798
10828
|
};
|
|
10799
10829
|
}
|
|
10800
|
-
function createDeferOp(xref, main, mainSlot, sourceSpan) {
|
|
10830
|
+
function createDeferOp(xref, main, mainSlot, metadata, sourceSpan) {
|
|
10801
10831
|
return {
|
|
10802
10832
|
kind: OpKind.Defer,
|
|
10803
10833
|
xref,
|
|
@@ -10815,6 +10845,8 @@ function createDeferOp(xref, main, mainSlot, sourceSpan) {
|
|
|
10815
10845
|
placeholderMinimumTime: null,
|
|
10816
10846
|
errorView: null,
|
|
10817
10847
|
errorSlot: null,
|
|
10848
|
+
metadata,
|
|
10849
|
+
resolverFn: null,
|
|
10818
10850
|
sourceSpan,
|
|
10819
10851
|
...NEW_OP,
|
|
10820
10852
|
...TRAIT_CONSUMES_SLOT,
|
|
@@ -10834,17 +10866,17 @@ function createDeferOnOp(defer, trigger, prefetch, sourceSpan) {
|
|
|
10834
10866
|
/**
|
|
10835
10867
|
* Create an `ExtractedMessageOp`.
|
|
10836
10868
|
*/
|
|
10837
|
-
function
|
|
10869
|
+
function createI18nMessageOp(xref, i18nBlock, message, messagePlaceholder, params, postprocessingParams, needsPostprocessing) {
|
|
10838
10870
|
return {
|
|
10839
|
-
kind: OpKind.
|
|
10840
|
-
|
|
10871
|
+
kind: OpKind.I18nMessage,
|
|
10872
|
+
xref,
|
|
10873
|
+
i18nBlock,
|
|
10841
10874
|
message,
|
|
10842
|
-
|
|
10843
|
-
params
|
|
10844
|
-
postprocessingParams
|
|
10845
|
-
needsPostprocessing
|
|
10846
|
-
|
|
10847
|
-
formattedPostprocessingParams: null,
|
|
10875
|
+
messagePlaceholder,
|
|
10876
|
+
params,
|
|
10877
|
+
postprocessingParams,
|
|
10878
|
+
needsPostprocessing,
|
|
10879
|
+
subMessages: [],
|
|
10848
10880
|
...NEW_OP,
|
|
10849
10881
|
};
|
|
10850
10882
|
}
|
|
@@ -10860,6 +10892,7 @@ function createI18nStartOp(xref, message, root) {
|
|
|
10860
10892
|
message,
|
|
10861
10893
|
messageIndex: null,
|
|
10862
10894
|
subTemplateIndex: null,
|
|
10895
|
+
context: null,
|
|
10863
10896
|
...NEW_OP,
|
|
10864
10897
|
...TRAIT_CONSUMES_SLOT,
|
|
10865
10898
|
};
|
|
@@ -10877,15 +10910,30 @@ function createI18nEndOp(xref) {
|
|
|
10877
10910
|
/**
|
|
10878
10911
|
* Creates an op to create an ICU expression.
|
|
10879
10912
|
*/
|
|
10880
|
-
function createIcuOp(xref, message, sourceSpan) {
|
|
10913
|
+
function createIcuOp(xref, message, icu, messagePlaceholder, sourceSpan) {
|
|
10881
10914
|
return {
|
|
10882
10915
|
kind: OpKind.Icu,
|
|
10883
10916
|
xref,
|
|
10884
10917
|
message,
|
|
10918
|
+
icu,
|
|
10919
|
+
messagePlaceholder,
|
|
10920
|
+
context: null,
|
|
10885
10921
|
sourceSpan,
|
|
10886
10922
|
...NEW_OP,
|
|
10887
10923
|
};
|
|
10888
10924
|
}
|
|
10925
|
+
function createI18nContextOp(xref, i18nBlock, message, sourceSpan) {
|
|
10926
|
+
return {
|
|
10927
|
+
kind: OpKind.I18nContext,
|
|
10928
|
+
xref,
|
|
10929
|
+
i18nBlock,
|
|
10930
|
+
message,
|
|
10931
|
+
sourceSpan,
|
|
10932
|
+
params: new Map(),
|
|
10933
|
+
postprocessingParams: new Map(),
|
|
10934
|
+
...NEW_OP,
|
|
10935
|
+
};
|
|
10936
|
+
}
|
|
10889
10937
|
function literalOrArrayLiteral$1(value) {
|
|
10890
10938
|
if (Array.isArray(value)) {
|
|
10891
10939
|
return literalArr(value.map(literalOrArrayLiteral$1));
|
|
@@ -10944,10 +10992,11 @@ class CompilationJob {
|
|
|
10944
10992
|
* embedded views or host bindings.
|
|
10945
10993
|
*/
|
|
10946
10994
|
class ComponentCompilationJob extends CompilationJob {
|
|
10947
|
-
constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds) {
|
|
10995
|
+
constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
|
|
10948
10996
|
super(componentName, pool, compatibility);
|
|
10949
10997
|
this.relativeContextFilePath = relativeContextFilePath;
|
|
10950
10998
|
this.i18nUseExternalIds = i18nUseExternalIds;
|
|
10999
|
+
this.deferBlocksMeta = deferBlocksMeta;
|
|
10951
11000
|
this.kind = CompilationJobKind.Tmpl;
|
|
10952
11001
|
this.fnSuffix = 'Template';
|
|
10953
11002
|
this.views = new Map();
|
|
@@ -11126,7 +11175,7 @@ function applyI18nExpressions(job) {
|
|
|
11126
11175
|
// Only add apply after expressions that are not followed by more expressions.
|
|
11127
11176
|
if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
|
|
11128
11177
|
// TODO: what should be the source span for the apply op?
|
|
11129
|
-
OpList.insertAfter(createI18nApplyOp(op.
|
|
11178
|
+
OpList.insertAfter(createI18nApplyOp(op.target, op.handle, null), op);
|
|
11130
11179
|
}
|
|
11131
11180
|
}
|
|
11132
11181
|
}
|
|
@@ -11139,8 +11188,8 @@ function needsApplication(op) {
|
|
|
11139
11188
|
if (op.next?.kind !== OpKind.I18nExpression) {
|
|
11140
11189
|
return true;
|
|
11141
11190
|
}
|
|
11142
|
-
// If the next op is an expression targeting a different i18n
|
|
11143
|
-
if (op.next.
|
|
11191
|
+
// If the next op is an expression targeting a different i18n context, we need to apply.
|
|
11192
|
+
if (op.next.context !== op.context) {
|
|
11144
11193
|
return true;
|
|
11145
11194
|
}
|
|
11146
11195
|
return false;
|
|
@@ -11151,21 +11200,33 @@ function needsApplication(op) {
|
|
|
11151
11200
|
*/
|
|
11152
11201
|
function assignI18nSlotDependencies(job) {
|
|
11153
11202
|
const i18nLastSlotConsumers = new Map();
|
|
11203
|
+
const i18nContexts = new Map();
|
|
11154
11204
|
let lastSlotConsumer = null;
|
|
11205
|
+
let currentI18nOp = null;
|
|
11155
11206
|
for (const unit of job.units) {
|
|
11156
11207
|
// Record the last consumed slot before each i18n end instruction.
|
|
11157
11208
|
for (const op of unit.create) {
|
|
11158
|
-
if (op.kind === OpKind.I18nEnd) {
|
|
11159
|
-
i18nLastSlotConsumers.set(op.xref, lastSlotConsumer);
|
|
11160
|
-
}
|
|
11161
11209
|
if (hasConsumesSlotTrait(op)) {
|
|
11162
11210
|
lastSlotConsumer = op.xref;
|
|
11163
11211
|
}
|
|
11212
|
+
switch (op.kind) {
|
|
11213
|
+
case OpKind.I18nStart:
|
|
11214
|
+
currentI18nOp = op;
|
|
11215
|
+
break;
|
|
11216
|
+
case OpKind.I18nEnd:
|
|
11217
|
+
i18nLastSlotConsumers.set(currentI18nOp.xref, lastSlotConsumer);
|
|
11218
|
+
currentI18nOp = null;
|
|
11219
|
+
break;
|
|
11220
|
+
case OpKind.I18nContext:
|
|
11221
|
+
i18nContexts.set(op.xref, op);
|
|
11222
|
+
break;
|
|
11223
|
+
}
|
|
11164
11224
|
}
|
|
11165
11225
|
// Assign i18n expressions to target the last slot in its owning block.
|
|
11166
11226
|
for (const op of unit.update) {
|
|
11167
11227
|
if (op.kind === OpKind.I18nExpression) {
|
|
11168
|
-
|
|
11228
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
11229
|
+
op.target = i18nLastSlotConsumers.get(i18nContext.i18nBlock);
|
|
11169
11230
|
}
|
|
11170
11231
|
}
|
|
11171
11232
|
}
|
|
@@ -11729,6 +11790,133 @@ function serializeAttributes({ attributes, bindings, classes, i18n, projectAs, s
|
|
|
11729
11790
|
return literalArr(attrArray);
|
|
11730
11791
|
}
|
|
11731
11792
|
|
|
11793
|
+
/**
|
|
11794
|
+
* Create extracted deps functions for defer ops.
|
|
11795
|
+
*/
|
|
11796
|
+
function createDeferDepsFns(job) {
|
|
11797
|
+
for (const unit of job.units) {
|
|
11798
|
+
for (const op of unit.create) {
|
|
11799
|
+
if (op.kind === OpKind.Defer) {
|
|
11800
|
+
if (op.metadata.deps.length === 0) {
|
|
11801
|
+
continue;
|
|
11802
|
+
}
|
|
11803
|
+
const dependencies = [];
|
|
11804
|
+
for (const dep of op.metadata.deps) {
|
|
11805
|
+
if (dep.isDeferrable) {
|
|
11806
|
+
// Callback function, e.g. `m () => m.MyCmp;`.
|
|
11807
|
+
const innerFn = arrowFn([new FnParam('m', DYNAMIC_TYPE)], variable('m').prop(dep.symbolName));
|
|
11808
|
+
// Dynamic import, e.g. `import('./a').then(...)`.
|
|
11809
|
+
const importExpr = (new DynamicImportExpr(dep.importPath)).prop('then').callFn([innerFn]);
|
|
11810
|
+
dependencies.push(importExpr);
|
|
11811
|
+
}
|
|
11812
|
+
else {
|
|
11813
|
+
// Non-deferrable symbol, just use a reference to the type.
|
|
11814
|
+
dependencies.push(dep.type);
|
|
11815
|
+
}
|
|
11816
|
+
}
|
|
11817
|
+
const depsFnExpr = arrowFn([], literalArr(dependencies));
|
|
11818
|
+
if (op.handle.slot === null) {
|
|
11819
|
+
throw new Error('AssertionError: slot must be assigned bfore extracting defer deps functions');
|
|
11820
|
+
}
|
|
11821
|
+
op.resolverFn = job.pool.getSharedFunctionReference(depsFnExpr, `${job.componentName}_Defer_${op.handle.slot}_DepsFn`);
|
|
11822
|
+
}
|
|
11823
|
+
}
|
|
11824
|
+
}
|
|
11825
|
+
}
|
|
11826
|
+
|
|
11827
|
+
/**
|
|
11828
|
+
* Create one helper context op per i18n block (including generate descending blocks).
|
|
11829
|
+
*
|
|
11830
|
+
* Also, if an ICU exists inside an i18n block that also contains other localizable content (such as
|
|
11831
|
+
* string), create an additional helper context op for the ICU.
|
|
11832
|
+
*
|
|
11833
|
+
* These context ops are later used for generating i18n messages. (Although we generate at least one
|
|
11834
|
+
* context op per nested view, we will collect them up the tree later, to generate a top-level
|
|
11835
|
+
* message.)
|
|
11836
|
+
*/
|
|
11837
|
+
function createI18nContexts(job) {
|
|
11838
|
+
let currentI18nOp = null;
|
|
11839
|
+
let xref;
|
|
11840
|
+
for (const unit of job.units) {
|
|
11841
|
+
for (const op of unit.create) {
|
|
11842
|
+
switch (op.kind) {
|
|
11843
|
+
case OpKind.I18nStart:
|
|
11844
|
+
// Each i18n block gets its own context.
|
|
11845
|
+
xref = job.allocateXrefId();
|
|
11846
|
+
unit.create.push(createI18nContextOp(xref, op.xref, op.message, null));
|
|
11847
|
+
op.context = xref;
|
|
11848
|
+
currentI18nOp = op;
|
|
11849
|
+
break;
|
|
11850
|
+
case OpKind.I18nEnd:
|
|
11851
|
+
currentI18nOp = null;
|
|
11852
|
+
break;
|
|
11853
|
+
case OpKind.Icu:
|
|
11854
|
+
// If an ICU represents a different message than its containing block, we give it its own
|
|
11855
|
+
// i18n context.
|
|
11856
|
+
if (currentI18nOp === null) {
|
|
11857
|
+
throw Error('Unexpected ICU outside of an i18n block.');
|
|
11858
|
+
}
|
|
11859
|
+
if (op.message.id !== currentI18nOp.message.id) {
|
|
11860
|
+
// There was an enclosing i18n block around this ICU somewhere.
|
|
11861
|
+
xref = job.allocateXrefId();
|
|
11862
|
+
unit.create.push(createI18nContextOp(xref, currentI18nOp.xref, op.message, null));
|
|
11863
|
+
op.context = xref;
|
|
11864
|
+
}
|
|
11865
|
+
else {
|
|
11866
|
+
// The i18n block was generated because of this ICU, OR it was explicit, but the ICU is
|
|
11867
|
+
// the only localizable content inside of it.
|
|
11868
|
+
op.context = currentI18nOp.context;
|
|
11869
|
+
}
|
|
11870
|
+
break;
|
|
11871
|
+
}
|
|
11872
|
+
}
|
|
11873
|
+
}
|
|
11874
|
+
}
|
|
11875
|
+
|
|
11876
|
+
/**
|
|
11877
|
+
* Replace the ICU update ops with i18n expression ops.
|
|
11878
|
+
*/
|
|
11879
|
+
function createI18nIcuExpressions(job) {
|
|
11880
|
+
const icus = new Map();
|
|
11881
|
+
const i18nContexts = new Map();
|
|
11882
|
+
const i18nBlocks = new Map();
|
|
11883
|
+
// Collect maps of ops that need to be referenced to create the I18nExpressionOps.
|
|
11884
|
+
for (const unit of job.units) {
|
|
11885
|
+
for (const op of unit.create) {
|
|
11886
|
+
switch (op.kind) {
|
|
11887
|
+
case OpKind.Icu:
|
|
11888
|
+
icus.set(op.xref, op);
|
|
11889
|
+
break;
|
|
11890
|
+
case OpKind.I18nContext:
|
|
11891
|
+
i18nContexts.set(op.xref, op);
|
|
11892
|
+
break;
|
|
11893
|
+
case OpKind.I18nStart:
|
|
11894
|
+
i18nBlocks.set(op.xref, op);
|
|
11895
|
+
break;
|
|
11896
|
+
}
|
|
11897
|
+
}
|
|
11898
|
+
// Replace each IcuUpdateOp with an I18nExpressionOp.
|
|
11899
|
+
for (const op of unit.update) {
|
|
11900
|
+
switch (op.kind) {
|
|
11901
|
+
case OpKind.IcuUpdate:
|
|
11902
|
+
const icuOp = icus.get(op.xref);
|
|
11903
|
+
if (icuOp?.icu.expressionPlaceholder === undefined) {
|
|
11904
|
+
throw Error('ICU should have an i18n placeholder');
|
|
11905
|
+
}
|
|
11906
|
+
if (icuOp.context === null) {
|
|
11907
|
+
throw Error('ICU should have its i18n context set');
|
|
11908
|
+
}
|
|
11909
|
+
const i18nContext = i18nContexts.get(icuOp.context);
|
|
11910
|
+
const i18nBlock = i18nBlocks.get(i18nContext.i18nBlock);
|
|
11911
|
+
OpList.replace(op, createI18nExpressionOp(i18nContext.xref, i18nBlock.xref, i18nBlock.handle, new LexicalReadExpr(icuOp.icu.expression), icuOp.icu.expressionPlaceholder,
|
|
11912
|
+
// ICU-based i18n Expressions are resolved during post-processing.
|
|
11913
|
+
I18nParamResolutionTime.Postproccessing, null));
|
|
11914
|
+
break;
|
|
11915
|
+
}
|
|
11916
|
+
}
|
|
11917
|
+
}
|
|
11918
|
+
}
|
|
11919
|
+
|
|
11732
11920
|
/**
|
|
11733
11921
|
* Defer instructions take a configuration array, which should be collected into the component
|
|
11734
11922
|
* consts. This phase finds the config options, and creates the corresponding const array.
|
|
@@ -11791,6 +11979,26 @@ function resolveDeferTargetNames(job) {
|
|
|
11791
11979
|
case DeferTriggerKind.Interaction:
|
|
11792
11980
|
case DeferTriggerKind.Viewport:
|
|
11793
11981
|
if (op.trigger.targetName === null) {
|
|
11982
|
+
// A `null` target name indicates we should default to the first element in the
|
|
11983
|
+
// placeholder block.
|
|
11984
|
+
if (placeholderView === null) {
|
|
11985
|
+
throw new Error('defer on trigger with no target name must have a placeholder block');
|
|
11986
|
+
}
|
|
11987
|
+
const placeholder = job.views.get(placeholderView);
|
|
11988
|
+
if (placeholder == undefined) {
|
|
11989
|
+
throw new Error('AssertionError: could not find placeholder view for defer on trigger');
|
|
11990
|
+
}
|
|
11991
|
+
for (const placeholderOp of placeholder.create) {
|
|
11992
|
+
if (hasConsumesSlotTrait(placeholderOp) &&
|
|
11993
|
+
(isElementOrContainerOp(placeholderOp) ||
|
|
11994
|
+
placeholderOp.kind === OpKind.Projection)) {
|
|
11995
|
+
op.trigger.targetXref = placeholderOp.xref;
|
|
11996
|
+
op.trigger.targetView = placeholderView;
|
|
11997
|
+
op.trigger.targetSlotViewSteps = -1;
|
|
11998
|
+
op.trigger.targetSlot = placeholderOp.handle;
|
|
11999
|
+
return;
|
|
12000
|
+
}
|
|
12001
|
+
}
|
|
11794
12002
|
return;
|
|
11795
12003
|
}
|
|
11796
12004
|
let view = placeholderView !== null ? job.views.get(placeholderView) : deferOwnerView;
|
|
@@ -12088,26 +12296,69 @@ const LIST_DELIMITER = '|';
|
|
|
12088
12296
|
* Formats the param maps on extracted message ops into a maps of `Expression` objects that can be
|
|
12089
12297
|
* used in the final output.
|
|
12090
12298
|
*/
|
|
12091
|
-
function
|
|
12299
|
+
function extractI18nMessages(job) {
|
|
12300
|
+
// Save the i18n context ops for later use.
|
|
12301
|
+
const i18nContexts = new Map();
|
|
12302
|
+
// Record which contexts represent i18n blocks (any other contexts are assumed to have been
|
|
12303
|
+
// created from ICUs).
|
|
12304
|
+
const i18nBlockContexts = new Set();
|
|
12092
12305
|
for (const unit of job.units) {
|
|
12093
12306
|
for (const op of unit.create) {
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
op.
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
-
|
|
12101
|
-
|
|
12102
|
-
|
|
12103
|
-
|
|
12104
|
-
|
|
12105
|
-
|
|
12307
|
+
switch (op.kind) {
|
|
12308
|
+
case OpKind.I18nContext:
|
|
12309
|
+
i18nContexts.set(op.xref, op);
|
|
12310
|
+
break;
|
|
12311
|
+
case OpKind.I18nStart:
|
|
12312
|
+
i18nBlockContexts.add(op.context);
|
|
12313
|
+
break;
|
|
12314
|
+
}
|
|
12315
|
+
}
|
|
12316
|
+
}
|
|
12317
|
+
// Extract messages from root i18n blocks.
|
|
12318
|
+
const i18nBlockMessages = new Map();
|
|
12319
|
+
for (const unit of job.units) {
|
|
12320
|
+
for (const op of unit.create) {
|
|
12321
|
+
if (op.kind === OpKind.I18nStart && op.xref === op.root) {
|
|
12322
|
+
if (!op.context) {
|
|
12323
|
+
throw Error('I18n start op should have its context set.');
|
|
12106
12324
|
}
|
|
12325
|
+
const i18nMessageOp = createI18nMessage(job, i18nContexts.get(op.context));
|
|
12326
|
+
i18nBlockMessages.set(op.xref, i18nMessageOp);
|
|
12327
|
+
unit.create.push(i18nMessageOp);
|
|
12328
|
+
}
|
|
12329
|
+
}
|
|
12330
|
+
}
|
|
12331
|
+
// Extract messages from ICUs with their own sub-context.
|
|
12332
|
+
for (const unit of job.units) {
|
|
12333
|
+
for (const op of unit.create) {
|
|
12334
|
+
if (op.kind === OpKind.Icu) {
|
|
12335
|
+
if (!op.context) {
|
|
12336
|
+
throw Error('ICU op should have its context set.');
|
|
12337
|
+
}
|
|
12338
|
+
if (!i18nBlockContexts.has(op.context)) {
|
|
12339
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
12340
|
+
const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
|
|
12341
|
+
unit.create.push(subMessage);
|
|
12342
|
+
const parentMessage = i18nBlockMessages.get(i18nContext.i18nBlock);
|
|
12343
|
+
parentMessage?.subMessages.push(subMessage.xref);
|
|
12344
|
+
}
|
|
12345
|
+
OpList.remove(op);
|
|
12107
12346
|
}
|
|
12108
12347
|
}
|
|
12109
12348
|
}
|
|
12110
12349
|
}
|
|
12350
|
+
/**
|
|
12351
|
+
* Create an i18n message op from an i18n context op.
|
|
12352
|
+
*/
|
|
12353
|
+
function createI18nMessage(job, context, messagePlaceholder) {
|
|
12354
|
+
let needsPostprocessing = context.postprocessingParams.size > 0;
|
|
12355
|
+
for (const values of context.params.values()) {
|
|
12356
|
+
if (values.length > 1) {
|
|
12357
|
+
needsPostprocessing = true;
|
|
12358
|
+
}
|
|
12359
|
+
}
|
|
12360
|
+
return createI18nMessageOp(job.allocateXrefId(), context.i18nBlock, context.message, messagePlaceholder ?? null, formatParams(context.params), formatParams(context.postprocessingParams), needsPostprocessing);
|
|
12361
|
+
}
|
|
12111
12362
|
/**
|
|
12112
12363
|
* Formats a map of `I18nParamValue[]` values into a map of `Expression` values.
|
|
12113
12364
|
*/
|
|
@@ -19348,35 +19599,23 @@ const TRANSLATION_VAR_PREFIX = 'i18n_';
|
|
|
19348
19599
|
function collectI18nConsts(job) {
|
|
19349
19600
|
const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, '_').toUpperCase() + '_';
|
|
19350
19601
|
const messageConstIndices = new Map();
|
|
19602
|
+
// Remove all of the i18n message ops into a map.
|
|
19603
|
+
const messages = new Map();
|
|
19351
19604
|
for (const unit of job.units) {
|
|
19352
19605
|
for (const op of unit.create) {
|
|
19353
|
-
if (op.kind === OpKind.
|
|
19354
|
-
|
|
19355
|
-
if (op.isRoot) {
|
|
19356
|
-
assertAllParamsResolved(op);
|
|
19357
|
-
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX));
|
|
19358
|
-
// Closure Compiler requires const names to start with `MSG_` but disallows any other
|
|
19359
|
-
// const to start with `MSG_`. We define a variable starting with `MSG_` just for the
|
|
19360
|
-
// `goog.getMsg` call
|
|
19361
|
-
const closureVar = i18nGenerateClosureVar(job.pool, op.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
19362
|
-
let transformFn = undefined;
|
|
19363
|
-
// If nescessary, add a post-processing step and resolve any placeholder params that are
|
|
19364
|
-
// set in post-processing.
|
|
19365
|
-
if (op.needsPostprocessing) {
|
|
19366
|
-
const extraTransformFnParams = [];
|
|
19367
|
-
if (op.formattedPostprocessingParams.size > 0) {
|
|
19368
|
-
extraTransformFnParams.push(literalMap([...op.formattedPostprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
|
|
19369
|
-
}
|
|
19370
|
-
transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
|
|
19371
|
-
}
|
|
19372
|
-
const statements = getTranslationDeclStmts$1(op.message, mainVar, closureVar, op.formattedParams, transformFn);
|
|
19373
|
-
messageConstIndices.set(op.owner, job.addConst(mainVar, statements));
|
|
19374
|
-
}
|
|
19375
|
-
// Remove the extracted messages from the IR now that they have been collected.
|
|
19606
|
+
if (op.kind === OpKind.I18nMessage) {
|
|
19607
|
+
messages.set(op.xref, op);
|
|
19376
19608
|
OpList.remove(op);
|
|
19377
19609
|
}
|
|
19378
19610
|
}
|
|
19379
19611
|
}
|
|
19612
|
+
// Serialize the extracted messages for root i18n blocks into the const array.
|
|
19613
|
+
for (const op of messages.values()) {
|
|
19614
|
+
if (op.kind === OpKind.I18nMessage && op.messagePlaceholder === null) {
|
|
19615
|
+
const { mainVar, statements } = collectMessage(job, fileBasedI18nSuffix, messages, op);
|
|
19616
|
+
messageConstIndices.set(op.i18nBlock, job.addConst(mainVar, statements));
|
|
19617
|
+
}
|
|
19618
|
+
}
|
|
19380
19619
|
// Assign const index to i18n ops that messages were extracted from.
|
|
19381
19620
|
for (const unit of job.units) {
|
|
19382
19621
|
for (const op of unit.create) {
|
|
@@ -19386,6 +19625,40 @@ function collectI18nConsts(job) {
|
|
|
19386
19625
|
}
|
|
19387
19626
|
}
|
|
19388
19627
|
}
|
|
19628
|
+
/**
|
|
19629
|
+
* Collects the given message into a set of statements that can be added to the const array.
|
|
19630
|
+
* This will recursively collect any sub-messages referenced from the parent message as well.
|
|
19631
|
+
*/
|
|
19632
|
+
function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
19633
|
+
// Recursively collect any sub-messages, and fill in their placeholders in this message.
|
|
19634
|
+
const statements = [];
|
|
19635
|
+
for (const subMessageId of messageOp.subMessages) {
|
|
19636
|
+
const subMessage = messages.get(subMessageId);
|
|
19637
|
+
const { mainVar: subMessageVar, statements: subMessageStatements } = collectMessage(job, fileBasedI18nSuffix, messages, subMessage);
|
|
19638
|
+
statements.push(...subMessageStatements);
|
|
19639
|
+
messageOp.params.set(subMessage.messagePlaceholder, subMessageVar);
|
|
19640
|
+
}
|
|
19641
|
+
// Check that the message has all of its parameters filled out.
|
|
19642
|
+
assertAllParamsResolved(messageOp);
|
|
19643
|
+
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX));
|
|
19644
|
+
// Closure Compiler requires const names to start with `MSG_` but disallows any other
|
|
19645
|
+
// const to start with `MSG_`. We define a variable starting with `MSG_` just for the
|
|
19646
|
+
// `goog.getMsg` call
|
|
19647
|
+
const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
19648
|
+
let transformFn = undefined;
|
|
19649
|
+
// If nescessary, add a post-processing step and resolve any placeholder params that are
|
|
19650
|
+
// set in post-processing.
|
|
19651
|
+
if (messageOp.needsPostprocessing) {
|
|
19652
|
+
const extraTransformFnParams = [];
|
|
19653
|
+
if (messageOp.postprocessingParams.size > 0) {
|
|
19654
|
+
extraTransformFnParams.push(literalMap([...messageOp.postprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
|
|
19655
|
+
}
|
|
19656
|
+
transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
|
|
19657
|
+
}
|
|
19658
|
+
// Add the message's statements
|
|
19659
|
+
statements.push(...getTranslationDeclStmts$1(messageOp.message, mainVar, closureVar, messageOp.params, transformFn));
|
|
19660
|
+
return { mainVar, statements };
|
|
19661
|
+
}
|
|
19389
19662
|
/**
|
|
19390
19663
|
* Generate statements that define a given translation message.
|
|
19391
19664
|
*
|
|
@@ -19457,36 +19730,18 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
|
|
|
19457
19730
|
* Asserts that all of the message's placeholders have values.
|
|
19458
19731
|
*/
|
|
19459
19732
|
function assertAllParamsResolved(op) {
|
|
19460
|
-
if (op.formattedParams === null || op.formattedPostprocessingParams === null) {
|
|
19461
|
-
throw Error('Params should have been formatted.');
|
|
19462
|
-
}
|
|
19463
19733
|
for (const placeholder in op.message.placeholders) {
|
|
19464
|
-
if (!op.
|
|
19465
|
-
!op.formattedPostprocessingParams.has(placeholder)) {
|
|
19734
|
+
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
19466
19735
|
throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
|
|
19467
19736
|
}
|
|
19468
19737
|
}
|
|
19469
19738
|
for (const placeholder in op.message.placeholderToMessage) {
|
|
19470
|
-
if (!op.
|
|
19471
|
-
!op.formattedPostprocessingParams.has(placeholder)) {
|
|
19739
|
+
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
19472
19740
|
throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
|
|
19473
19741
|
}
|
|
19474
19742
|
}
|
|
19475
19743
|
}
|
|
19476
19744
|
|
|
19477
|
-
/**
|
|
19478
|
-
* Extracts i18n messages into their own op.
|
|
19479
|
-
*/
|
|
19480
|
-
function extractI18nMessages(job) {
|
|
19481
|
-
for (const unit of job.units) {
|
|
19482
|
-
for (const op of unit.create) {
|
|
19483
|
-
if (op.kind === OpKind.I18nStart) {
|
|
19484
|
-
unit.create.push(createExtractedMessageOp(op.xref, op.message, op.xref === op.root));
|
|
19485
|
-
}
|
|
19486
|
-
}
|
|
19487
|
-
}
|
|
19488
|
-
}
|
|
19489
|
-
|
|
19490
19745
|
/**
|
|
19491
19746
|
* Removes text nodes within i18n blocks since they are already hardcoded into the i18n message.
|
|
19492
19747
|
*/
|
|
@@ -19494,22 +19749,22 @@ function extractI18nText(job) {
|
|
|
19494
19749
|
for (const unit of job.units) {
|
|
19495
19750
|
// Remove all text nodes within i18n blocks, their content is already captured in the i18n
|
|
19496
19751
|
// message.
|
|
19497
|
-
let
|
|
19498
|
-
|
|
19499
|
-
const textNodes = new Map();
|
|
19752
|
+
let currentI18n = null;
|
|
19753
|
+
const textNodeI18nBlocks = new Map();
|
|
19500
19754
|
for (const op of unit.create) {
|
|
19501
19755
|
switch (op.kind) {
|
|
19502
19756
|
case OpKind.I18nStart:
|
|
19503
|
-
|
|
19504
|
-
|
|
19757
|
+
if (op.context === null) {
|
|
19758
|
+
throw Error('I18n op should have its context set.');
|
|
19759
|
+
}
|
|
19760
|
+
currentI18n = op;
|
|
19505
19761
|
break;
|
|
19506
19762
|
case OpKind.I18nEnd:
|
|
19507
|
-
|
|
19508
|
-
currentI18nSlot = null;
|
|
19763
|
+
currentI18n = null;
|
|
19509
19764
|
break;
|
|
19510
19765
|
case OpKind.Text:
|
|
19511
|
-
if (
|
|
19512
|
-
|
|
19766
|
+
if (currentI18n !== null) {
|
|
19767
|
+
textNodeI18nBlocks.set(op.xref, currentI18n);
|
|
19513
19768
|
OpList.remove(op);
|
|
19514
19769
|
}
|
|
19515
19770
|
break;
|
|
@@ -19520,18 +19775,17 @@ function extractI18nText(job) {
|
|
|
19520
19775
|
for (const op of unit.update) {
|
|
19521
19776
|
switch (op.kind) {
|
|
19522
19777
|
case OpKind.InterpolateText:
|
|
19523
|
-
if (!
|
|
19778
|
+
if (!textNodeI18nBlocks.has(op.target)) {
|
|
19524
19779
|
continue;
|
|
19525
19780
|
}
|
|
19526
|
-
const
|
|
19781
|
+
const i18nOp = textNodeI18nBlocks.get(op.target);
|
|
19527
19782
|
const ops = [];
|
|
19528
19783
|
for (let i = 0; i < op.interpolation.expressions.length; i++) {
|
|
19529
19784
|
const expr = op.interpolation.expressions[i];
|
|
19530
19785
|
const placeholder = op.i18nPlaceholders[i];
|
|
19531
|
-
|
|
19532
|
-
|
|
19533
|
-
|
|
19534
|
-
// ops.push(ir.createI18nApplyOp(i18nBlockId, op.i18nPlaceholders, op.sourceSpan));
|
|
19786
|
+
// For now, this i18nExpression depends on the slot context of the enclosing i18n block.
|
|
19787
|
+
// Later, we will modify this, and advance to a different point.
|
|
19788
|
+
ops.push(createI18nExpressionOp(i18nOp.context, i18nOp.xref, i18nOp.handle, expr, placeholder.name, I18nParamResolutionTime.Creation, expr.sourceSpan ?? op.sourceSpan));
|
|
19535
19789
|
}
|
|
19536
19790
|
OpList.replaceWithMany(op, ops);
|
|
19537
19791
|
break;
|
|
@@ -19540,53 +19794,6 @@ function extractI18nText(job) {
|
|
|
19540
19794
|
}
|
|
19541
19795
|
}
|
|
19542
19796
|
|
|
19543
|
-
/**
|
|
19544
|
-
* Extracts ICUs into i18n expressions.
|
|
19545
|
-
*/
|
|
19546
|
-
function extractI18nICUs(job) {
|
|
19547
|
-
for (const unit of job.units) {
|
|
19548
|
-
// Build a map of ICU to the i18n block they belong to, then remove the `Icu` ops.
|
|
19549
|
-
const icus = new Map();
|
|
19550
|
-
let currentI18nId = null;
|
|
19551
|
-
let currentI18nSlot = null;
|
|
19552
|
-
for (const op of unit.create) {
|
|
19553
|
-
switch (op.kind) {
|
|
19554
|
-
case OpKind.I18nStart:
|
|
19555
|
-
currentI18nId = op.xref;
|
|
19556
|
-
currentI18nSlot = op.handle;
|
|
19557
|
-
break;
|
|
19558
|
-
case OpKind.I18nEnd:
|
|
19559
|
-
currentI18nId = null;
|
|
19560
|
-
currentI18nSlot = null;
|
|
19561
|
-
break;
|
|
19562
|
-
case OpKind.Icu:
|
|
19563
|
-
if (currentI18nId === null) {
|
|
19564
|
-
throw Error('Unexpected ICU outside of an i18n block.');
|
|
19565
|
-
}
|
|
19566
|
-
icus.set(op.xref, { message: op.message, i18nBlockId: currentI18nId, i18nBlockSlot: currentI18nSlot });
|
|
19567
|
-
OpList.remove(op);
|
|
19568
|
-
break;
|
|
19569
|
-
}
|
|
19570
|
-
}
|
|
19571
|
-
// Replace the `IcuUpdate` ops with `i18nExpr` ops.
|
|
19572
|
-
for (const op of unit.update) {
|
|
19573
|
-
switch (op.kind) {
|
|
19574
|
-
case OpKind.IcuUpdate:
|
|
19575
|
-
const { message, i18nBlockId, i18nBlockSlot } = icus.get(op.xref);
|
|
19576
|
-
const icuNode = message.nodes.find((n) => n instanceof Icu);
|
|
19577
|
-
if (icuNode === undefined) {
|
|
19578
|
-
throw Error('Could not find ICU in i18n AST');
|
|
19579
|
-
}
|
|
19580
|
-
if (icuNode.expressionPlaceholder === undefined) {
|
|
19581
|
-
throw Error('ICU is missing an i18n placeholder');
|
|
19582
|
-
}
|
|
19583
|
-
OpList.replace(op, createI18nExpressionOp(i18nBlockId, i18nBlockSlot, new LexicalReadExpr(icuNode.expression), icuNode.expressionPlaceholder, I18nParamResolutionTime.Postproccessing, null));
|
|
19584
|
-
break;
|
|
19585
|
-
}
|
|
19586
|
-
}
|
|
19587
|
-
}
|
|
19588
|
-
}
|
|
19589
|
-
|
|
19590
19797
|
/**
|
|
19591
19798
|
* Lifts local reference declarations on element-like structures within each view into an entry in
|
|
19592
19799
|
* the `consts` array for the whole component.
|
|
@@ -19621,6 +19828,57 @@ function serializeLocalRefs(refs) {
|
|
|
19621
19828
|
return literalArr(constRefs);
|
|
19622
19829
|
}
|
|
19623
19830
|
|
|
19831
|
+
/**
|
|
19832
|
+
* Merge i18n contexts for child i18n blocks into their ancestor root contexts.
|
|
19833
|
+
*/
|
|
19834
|
+
function mergeI18nContexts(job) {
|
|
19835
|
+
// Record all of the i18n and extracted message ops for use later.
|
|
19836
|
+
const i18nOps = new Map();
|
|
19837
|
+
const i18nContexts = new Map();
|
|
19838
|
+
for (const unit of job.units) {
|
|
19839
|
+
for (const op of unit.create) {
|
|
19840
|
+
switch (op.kind) {
|
|
19841
|
+
case OpKind.I18nStart:
|
|
19842
|
+
if (!op.context) {
|
|
19843
|
+
throw Error('I18n op should have its context set.');
|
|
19844
|
+
}
|
|
19845
|
+
i18nOps.set(op.xref, op);
|
|
19846
|
+
break;
|
|
19847
|
+
case OpKind.I18nContext:
|
|
19848
|
+
i18nContexts.set(op.xref, op);
|
|
19849
|
+
break;
|
|
19850
|
+
}
|
|
19851
|
+
}
|
|
19852
|
+
}
|
|
19853
|
+
// For each non-root i18n op, merge its context into the root i18n op's context.
|
|
19854
|
+
for (const childI18nOp of i18nOps.values()) {
|
|
19855
|
+
if (childI18nOp.xref !== childI18nOp.root) {
|
|
19856
|
+
const childContext = i18nContexts.get(childI18nOp.context);
|
|
19857
|
+
const rootI18nOp = i18nOps.get(childI18nOp.root);
|
|
19858
|
+
const rootContext = i18nContexts.get(rootI18nOp.context);
|
|
19859
|
+
mergeParams(rootContext.params, childContext.params);
|
|
19860
|
+
mergeParams(rootContext.postprocessingParams, childContext.postprocessingParams);
|
|
19861
|
+
}
|
|
19862
|
+
}
|
|
19863
|
+
}
|
|
19864
|
+
/**
|
|
19865
|
+
* Merges the params in the `from` map to into the `to` map.
|
|
19866
|
+
*/
|
|
19867
|
+
function mergeParams(to, from) {
|
|
19868
|
+
for (const [placeholder, fromValues] of from) {
|
|
19869
|
+
const toValues = to.get(placeholder) || [];
|
|
19870
|
+
// TODO(mmalerba): Child element close tag params should be prepended to maintain the same order
|
|
19871
|
+
// as TemplateDefinitionBuilder. Can be cleaned up when compatibility is no longer required.
|
|
19872
|
+
const flags = fromValues[0].flags;
|
|
19873
|
+
if ((flags & I18nParamValueFlags.CloseTag) && !(flags & I18nParamValueFlags.OpenTag)) {
|
|
19874
|
+
to.set(placeholder, [...fromValues, ...toValues]);
|
|
19875
|
+
}
|
|
19876
|
+
else {
|
|
19877
|
+
to.set(placeholder, [...toValues, ...fromValues]);
|
|
19878
|
+
}
|
|
19879
|
+
}
|
|
19880
|
+
}
|
|
19881
|
+
|
|
19624
19882
|
/**
|
|
19625
19883
|
* Change namespaces between HTML, SVG and MathML, depending on the next element.
|
|
19626
19884
|
*/
|
|
@@ -20251,7 +20509,9 @@ function createVariadicPipes(job) {
|
|
|
20251
20509
|
|
|
20252
20510
|
/**
|
|
20253
20511
|
* Propagate i18n blocks down through child templates that act as placeholders in the root i18n
|
|
20254
|
-
* message.
|
|
20512
|
+
* message. Specifically, perform an in-order traversal of all the views, and add i18nStart/i18nEnd
|
|
20513
|
+
* op pairs into descending views. Also, assign an increasing sub-template index to each
|
|
20514
|
+
* descending view.
|
|
20255
20515
|
*/
|
|
20256
20516
|
function propagateI18nBlocks(job) {
|
|
20257
20517
|
propagateI18nBlocksToTemplates(job.root, 0);
|
|
@@ -20298,59 +20558,6 @@ function wrapTemplateWithI18n(unit, parentI18n) {
|
|
|
20298
20558
|
}
|
|
20299
20559
|
}
|
|
20300
20560
|
|
|
20301
|
-
/**
|
|
20302
|
-
* Propagate extractd message placeholders up to their root extracted message op.
|
|
20303
|
-
*/
|
|
20304
|
-
function propogateI18nPlaceholders(job) {
|
|
20305
|
-
// Record all of the i18n and extracted message ops for use later.
|
|
20306
|
-
const i18nOps = new Map();
|
|
20307
|
-
const extractedMessageOps = new Map();
|
|
20308
|
-
for (const unit of job.units) {
|
|
20309
|
-
for (const op of unit.create) {
|
|
20310
|
-
switch (op.kind) {
|
|
20311
|
-
case OpKind.I18nStart:
|
|
20312
|
-
i18nOps.set(op.xref, op);
|
|
20313
|
-
break;
|
|
20314
|
-
case OpKind.ExtractedMessage:
|
|
20315
|
-
extractedMessageOps.set(op.owner, op);
|
|
20316
|
-
break;
|
|
20317
|
-
}
|
|
20318
|
-
}
|
|
20319
|
-
}
|
|
20320
|
-
// For each non-root message, merge its params into the root message's params.
|
|
20321
|
-
for (const [xref, childExtractedMessageOp] of extractedMessageOps) {
|
|
20322
|
-
if (!childExtractedMessageOp.isRoot) {
|
|
20323
|
-
const i18nOp = i18nOps.get(xref);
|
|
20324
|
-
if (i18nOp === undefined) {
|
|
20325
|
-
throw Error('Could not find owner i18n block for extracted message.');
|
|
20326
|
-
}
|
|
20327
|
-
const rootExtractedMessageOp = extractedMessageOps.get(i18nOp.root);
|
|
20328
|
-
if (rootExtractedMessageOp === undefined) {
|
|
20329
|
-
throw Error('Could not find extracted message op for root i18n block.');
|
|
20330
|
-
}
|
|
20331
|
-
mergeParams(rootExtractedMessageOp.params, childExtractedMessageOp.params);
|
|
20332
|
-
mergeParams(rootExtractedMessageOp.postprocessingParams, childExtractedMessageOp.postprocessingParams);
|
|
20333
|
-
}
|
|
20334
|
-
}
|
|
20335
|
-
}
|
|
20336
|
-
/**
|
|
20337
|
-
* Merges the params in the `from` map to into the `to` map.
|
|
20338
|
-
*/
|
|
20339
|
-
function mergeParams(to, from) {
|
|
20340
|
-
for (const [placeholder, fromValues] of from) {
|
|
20341
|
-
const toValues = to.get(placeholder) || [];
|
|
20342
|
-
// TODO(mmalerba): Child element close tag params should be prepended to maintain the same order
|
|
20343
|
-
// as TemplateDefinitionBuilder. Can be cleaned up when compatibility is no longer required.
|
|
20344
|
-
const flags = fromValues[0].flags;
|
|
20345
|
-
if ((flags & I18nParamValueFlags.CloseTag) && !(flags & I18nParamValueFlags.OpenTag)) {
|
|
20346
|
-
to.set(placeholder, [...fromValues, ...toValues]);
|
|
20347
|
-
}
|
|
20348
|
-
else {
|
|
20349
|
-
to.set(placeholder, [...toValues, ...fromValues]);
|
|
20350
|
-
}
|
|
20351
|
-
}
|
|
20352
|
-
}
|
|
20353
|
-
|
|
20354
20561
|
function extractPureFunctions(job) {
|
|
20355
20562
|
for (const view of job.units) {
|
|
20356
20563
|
for (const op of view.ops()) {
|
|
@@ -20480,13 +20687,21 @@ function elementContainer(slot, constIndex, localRefIndex, sourceSpan) {
|
|
|
20480
20687
|
function elementContainerEnd() {
|
|
20481
20688
|
return call(Identifiers.elementContainerEnd, [], null);
|
|
20482
20689
|
}
|
|
20483
|
-
function template(slot, templateFnRef, decls, vars, tag, constIndex, sourceSpan) {
|
|
20484
|
-
const args = [
|
|
20485
|
-
|
|
20486
|
-
|
|
20487
|
-
|
|
20488
|
-
|
|
20489
|
-
|
|
20690
|
+
function template(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
20691
|
+
const args = [
|
|
20692
|
+
literal(slot),
|
|
20693
|
+
templateFnRef,
|
|
20694
|
+
literal(decls),
|
|
20695
|
+
literal(vars),
|
|
20696
|
+
literal(tag),
|
|
20697
|
+
literal(constIndex),
|
|
20698
|
+
];
|
|
20699
|
+
if (localRefs !== null) {
|
|
20700
|
+
args.push(literal(localRefs));
|
|
20701
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
20702
|
+
}
|
|
20703
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
20704
|
+
args.pop();
|
|
20490
20705
|
}
|
|
20491
20706
|
return call(Identifiers.templateCreate, args, sourceSpan);
|
|
20492
20707
|
}
|
|
@@ -20560,7 +20775,7 @@ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeho
|
|
|
20560
20775
|
const args = [
|
|
20561
20776
|
literal(selfSlot),
|
|
20562
20777
|
literal(primarySlot),
|
|
20563
|
-
literal(
|
|
20778
|
+
dependencyResolverFn ?? literal(null),
|
|
20564
20779
|
literal(loadingSlot),
|
|
20565
20780
|
literal(placeholderSlot),
|
|
20566
20781
|
literal(errorSlot),
|
|
@@ -20640,6 +20855,9 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
|
|
|
20640
20855
|
function repeater(metadataSlot, collection, sourceSpan) {
|
|
20641
20856
|
return call(Identifiers.repeater, [literal(metadataSlot), collection], sourceSpan);
|
|
20642
20857
|
}
|
|
20858
|
+
function deferWhen(prefetch, expr, sourceSpan) {
|
|
20859
|
+
return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
|
|
20860
|
+
}
|
|
20643
20861
|
function i18n(slot, constIndex, subTemplateIndex) {
|
|
20644
20862
|
const args = [literal(slot), literal(constIndex)];
|
|
20645
20863
|
if (subTemplateIndex) {
|
|
@@ -21040,8 +21258,11 @@ function reifyCreateOperations(unit, ops) {
|
|
|
21040
21258
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
21041
21259
|
throw new Error(`AssertionError: must be compiling a component`);
|
|
21042
21260
|
}
|
|
21261
|
+
if (Array.isArray(op.localRefs)) {
|
|
21262
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
21263
|
+
}
|
|
21043
21264
|
const childView = unit.job.views.get(op.xref);
|
|
21044
|
-
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.sourceSpan));
|
|
21265
|
+
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.sourceSpan));
|
|
21045
21266
|
break;
|
|
21046
21267
|
case OpKind.DisableBindings:
|
|
21047
21268
|
OpList.replace(op, disableBindings());
|
|
@@ -21080,7 +21301,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
21080
21301
|
break;
|
|
21081
21302
|
case OpKind.Defer:
|
|
21082
21303
|
const timerScheduling = !!op.loadingMinimumTime || !!op.loadingAfterTime || !!op.placeholderMinimumTime;
|
|
21083
|
-
OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot,
|
|
21304
|
+
OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot, op.resolverFn, op.loadingSlot?.slot ?? null, op.placeholderSlot?.slot ?? null, op.errorSlot?.slot ?? null, op.loadingConfig, op.placeholderConfig, timerScheduling, op.sourceSpan));
|
|
21084
21305
|
break;
|
|
21085
21306
|
case OpKind.DeferOn:
|
|
21086
21307
|
let args = [];
|
|
@@ -21198,7 +21419,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
21198
21419
|
OpList.replace(op, i18nExp(op.expression, op.sourceSpan));
|
|
21199
21420
|
break;
|
|
21200
21421
|
case OpKind.I18nApply:
|
|
21201
|
-
OpList.replace(op, i18nApply(op.
|
|
21422
|
+
OpList.replace(op, i18nApply(op.handle.slot, op.sourceSpan));
|
|
21202
21423
|
break;
|
|
21203
21424
|
case OpKind.InterpolateText:
|
|
21204
21425
|
OpList.replace(op, textInterpolate(op.interpolation.strings, op.interpolation.expressions, op.sourceSpan));
|
|
@@ -21242,6 +21463,9 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
21242
21463
|
case OpKind.Repeater:
|
|
21243
21464
|
OpList.replace(op, repeater(op.targetSlot.slot, op.collection, op.sourceSpan));
|
|
21244
21465
|
break;
|
|
21466
|
+
case OpKind.DeferWhen:
|
|
21467
|
+
OpList.replace(op, deferWhen(op.prefetch, op.expr, op.sourceSpan));
|
|
21468
|
+
break;
|
|
21245
21469
|
case OpKind.Statement:
|
|
21246
21470
|
// Pass statement operations directly through.
|
|
21247
21471
|
break;
|
|
@@ -21352,6 +21576,25 @@ function removeEmptyBindings(job) {
|
|
|
21352
21576
|
}
|
|
21353
21577
|
}
|
|
21354
21578
|
|
|
21579
|
+
/**
|
|
21580
|
+
* Remove the i18n context ops after they are no longer needed, and null out references to them to
|
|
21581
|
+
* be safe.
|
|
21582
|
+
*/
|
|
21583
|
+
function removeI18nContexts(job) {
|
|
21584
|
+
for (const unit of job.units) {
|
|
21585
|
+
for (const op of unit.create) {
|
|
21586
|
+
switch (op.kind) {
|
|
21587
|
+
case OpKind.I18nContext:
|
|
21588
|
+
OpList.remove(op);
|
|
21589
|
+
break;
|
|
21590
|
+
case OpKind.I18nStart:
|
|
21591
|
+
op.context = null;
|
|
21592
|
+
break;
|
|
21593
|
+
}
|
|
21594
|
+
}
|
|
21595
|
+
}
|
|
21596
|
+
}
|
|
21597
|
+
|
|
21355
21598
|
/**
|
|
21356
21599
|
* Inside the body of a repeater, certain context variables (such as `$first`) are ambiently
|
|
21357
21600
|
* available. This phase finds those variable usages, and replaces them with the appropriate
|
|
@@ -21466,14 +21709,14 @@ function transformDollarEvent(unit, ops) {
|
|
|
21466
21709
|
* Resolve the element placeholders in i18n messages.
|
|
21467
21710
|
*/
|
|
21468
21711
|
function resolveI18nElementPlaceholders(job) {
|
|
21469
|
-
// Record all of the element and
|
|
21470
|
-
const
|
|
21712
|
+
// Record all of the element and i18n context ops for use later.
|
|
21713
|
+
const i18nContexts = new Map();
|
|
21471
21714
|
const elements = new Map();
|
|
21472
21715
|
for (const unit of job.units) {
|
|
21473
21716
|
for (const op of unit.create) {
|
|
21474
21717
|
switch (op.kind) {
|
|
21475
|
-
case OpKind.
|
|
21476
|
-
|
|
21718
|
+
case OpKind.I18nContext:
|
|
21719
|
+
i18nContexts.set(op.xref, op);
|
|
21477
21720
|
break;
|
|
21478
21721
|
case OpKind.ElementStart:
|
|
21479
21722
|
elements.set(op.xref, op);
|
|
@@ -21482,16 +21725,16 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
21482
21725
|
}
|
|
21483
21726
|
}
|
|
21484
21727
|
for (const unit of job.units) {
|
|
21485
|
-
// Track the current i18n op and corresponding
|
|
21486
|
-
//
|
|
21728
|
+
// Track the current i18n op and corresponding i18n context op as we step through the creation
|
|
21729
|
+
// IR.
|
|
21487
21730
|
let currentOps = null;
|
|
21488
21731
|
for (const op of unit.create) {
|
|
21489
21732
|
switch (op.kind) {
|
|
21490
21733
|
case OpKind.I18nStart:
|
|
21491
|
-
if (!
|
|
21492
|
-
throw Error('Could not find
|
|
21734
|
+
if (!op.context) {
|
|
21735
|
+
throw Error('Could not find i18n context for i18n op');
|
|
21493
21736
|
}
|
|
21494
|
-
currentOps = {
|
|
21737
|
+
currentOps = { i18nBlock: op, i18nContext: i18nContexts.get(op.context) };
|
|
21495
21738
|
break;
|
|
21496
21739
|
case OpKind.I18nEnd:
|
|
21497
21740
|
currentOps = null;
|
|
@@ -21510,7 +21753,7 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
21510
21753
|
if (closeName === '') {
|
|
21511
21754
|
flags |= I18nParamValueFlags.CloseTag;
|
|
21512
21755
|
}
|
|
21513
|
-
addParam(currentOps.
|
|
21756
|
+
addParam(currentOps.i18nContext.params, startName, op.handle.slot, currentOps.i18nBlock.subTemplateIndex, flags);
|
|
21514
21757
|
}
|
|
21515
21758
|
break;
|
|
21516
21759
|
case OpKind.ElementEnd:
|
|
@@ -21524,7 +21767,7 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
21524
21767
|
const { closeName } = startOp.i18nPlaceholder;
|
|
21525
21768
|
// Self-closing tags don't have a closing tag placeholder.
|
|
21526
21769
|
if (closeName !== '') {
|
|
21527
|
-
addParam(currentOps.
|
|
21770
|
+
addParam(currentOps.i18nContext.params, closeName, startOp.handle.slot, currentOps.i18nBlock.subTemplateIndex, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
|
|
21528
21771
|
}
|
|
21529
21772
|
}
|
|
21530
21773
|
break;
|
|
@@ -21535,9 +21778,9 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
21535
21778
|
if (currentOps === null) {
|
|
21536
21779
|
throw Error('i18n tag placeholder should only occur inside an i18n block');
|
|
21537
21780
|
}
|
|
21538
|
-
const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.
|
|
21539
|
-
addParam(currentOps.
|
|
21540
|
-
addParam(currentOps.
|
|
21781
|
+
const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.i18nBlock, op);
|
|
21782
|
+
addParam(currentOps.i18nContext.params, op.i18nPlaceholder.startName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag);
|
|
21783
|
+
addParam(currentOps.i18nContext.params, op.i18nPlaceholder.closeName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
|
|
21541
21784
|
}
|
|
21542
21785
|
break;
|
|
21543
21786
|
}
|
|
@@ -21567,47 +21810,37 @@ function addParam(params, placeholder, value, subTemplateIndex, flags = I18nPara
|
|
|
21567
21810
|
* Resolve the i18n expression placeholders in i18n messages.
|
|
21568
21811
|
*/
|
|
21569
21812
|
function resolveI18nExpressionPlaceholders(job) {
|
|
21570
|
-
// Record all of the i18n and
|
|
21571
|
-
const
|
|
21572
|
-
const
|
|
21813
|
+
// Record all of the i18n context ops, and the sub-template index for each i18n op.
|
|
21814
|
+
const subTemplateIndicies = new Map();
|
|
21815
|
+
const i18nContexts = new Map();
|
|
21573
21816
|
for (const unit of job.units) {
|
|
21574
21817
|
for (const op of unit.create) {
|
|
21575
21818
|
switch (op.kind) {
|
|
21576
21819
|
case OpKind.I18nStart:
|
|
21577
|
-
|
|
21820
|
+
subTemplateIndicies.set(op.xref, op.subTemplateIndex);
|
|
21578
21821
|
break;
|
|
21579
|
-
case OpKind.
|
|
21580
|
-
|
|
21822
|
+
case OpKind.I18nContext:
|
|
21823
|
+
i18nContexts.set(op.xref, op);
|
|
21581
21824
|
break;
|
|
21582
21825
|
}
|
|
21583
21826
|
}
|
|
21584
21827
|
}
|
|
21585
|
-
// Keep track of the next available expression index per i18n
|
|
21828
|
+
// Keep track of the next available expression index per i18n context.
|
|
21586
21829
|
const expressionIndices = new Map();
|
|
21587
21830
|
for (const unit of job.units) {
|
|
21588
21831
|
for (const op of unit.update) {
|
|
21589
21832
|
if (op.kind === OpKind.I18nExpression) {
|
|
21590
|
-
const
|
|
21591
|
-
|
|
21592
|
-
|
|
21593
|
-
throw Error('Cannot find corresponding i18n block for i18nExpr');
|
|
21594
|
-
}
|
|
21595
|
-
const extractedMessageOp = extractedMessageOps.get(i18nOp.xref);
|
|
21596
|
-
if (!extractedMessageOp) {
|
|
21597
|
-
throw Error('Cannot find extracted message for i18n block');
|
|
21598
|
-
}
|
|
21833
|
+
const index = expressionIndices.get(op.context) || 0;
|
|
21834
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
21835
|
+
const subTemplateIndex = subTemplateIndicies.get(i18nContext.i18nBlock);
|
|
21599
21836
|
// Add the expression index in the appropriate params map.
|
|
21600
21837
|
const params = op.resolutionTime === I18nParamResolutionTime.Creation ?
|
|
21601
|
-
|
|
21602
|
-
|
|
21838
|
+
i18nContext.params :
|
|
21839
|
+
i18nContext.postprocessingParams;
|
|
21603
21840
|
const values = params.get(op.i18nPlaceholder) || [];
|
|
21604
|
-
values.push({
|
|
21605
|
-
value: index,
|
|
21606
|
-
subTemplateIndex: i18nOp.subTemplateIndex,
|
|
21607
|
-
flags: I18nParamValueFlags.None
|
|
21608
|
-
});
|
|
21841
|
+
values.push({ value: index, subTemplateIndex: subTemplateIndex, flags: I18nParamValueFlags.None });
|
|
21609
21842
|
params.set(op.i18nPlaceholder, values);
|
|
21610
|
-
expressionIndices.set(op.
|
|
21843
|
+
expressionIndices.set(op.context, index + 1);
|
|
21611
21844
|
}
|
|
21612
21845
|
}
|
|
21613
21846
|
}
|
|
@@ -22699,6 +22932,7 @@ const phases = [
|
|
|
22699
22932
|
{ kind: CompilationJobKind.Both, fn: specializeBindings },
|
|
22700
22933
|
{ kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
|
|
22701
22934
|
{ kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
|
|
22935
|
+
{ kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
|
|
22702
22936
|
{ kind: CompilationJobKind.Both, fn: extractAttributes },
|
|
22703
22937
|
{ kind: CompilationJobKind.Both, fn: parseExtractedStyles },
|
|
22704
22938
|
{ kind: CompilationJobKind.Tmpl, fn: removeEmptyBindings },
|
|
@@ -22708,7 +22942,7 @@ const phases = [
|
|
|
22708
22942
|
{ kind: CompilationJobKind.Tmpl, fn: createPipes },
|
|
22709
22943
|
{ kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
|
|
22710
22944
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nText },
|
|
22711
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
22945
|
+
{ kind: CompilationJobKind.Tmpl, fn: createI18nIcuExpressions },
|
|
22712
22946
|
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
22713
22947
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
22714
22948
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
@@ -22729,16 +22963,17 @@ const phases = [
|
|
|
22729
22963
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
22730
22964
|
{ kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
|
|
22731
22965
|
{ kind: CompilationJobKind.Tmpl, fn: allocateSlots },
|
|
22732
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
22966
|
+
{ kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
|
|
22733
22967
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
22734
22968
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
22735
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
22736
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
22969
|
+
{ kind: CompilationJobKind.Tmpl, fn: mergeI18nContexts },
|
|
22970
|
+
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
22737
22971
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
|
|
22738
22972
|
{ kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
|
|
22739
22973
|
{ kind: CompilationJobKind.Tmpl, fn: collectConstExpressions },
|
|
22740
22974
|
{ kind: CompilationJobKind.Both, fn: collectElementConsts },
|
|
22741
22975
|
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
22976
|
+
{ kind: CompilationJobKind.Tmpl, fn: removeI18nContexts },
|
|
22742
22977
|
{ kind: CompilationJobKind.Both, fn: countVariables },
|
|
22743
22978
|
{ kind: CompilationJobKind.Tmpl, fn: generateAdvance },
|
|
22744
22979
|
{ kind: CompilationJobKind.Both, fn: optimizeVariables },
|
|
@@ -22864,8 +23099,8 @@ const compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
|
|
|
22864
23099
|
* representation.
|
|
22865
23100
|
* TODO: Refactor more of the ingestion code into phases.
|
|
22866
23101
|
*/
|
|
22867
|
-
function ingestComponent(componentName, template, constantPool, relativeContextFilePath, i18nUseExternalIds) {
|
|
22868
|
-
const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds);
|
|
23102
|
+
function ingestComponent(componentName, template, constantPool, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
|
|
23103
|
+
const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta);
|
|
22869
23104
|
ingestNodes(job.root, template);
|
|
22870
23105
|
return job;
|
|
22871
23106
|
}
|
|
@@ -22975,7 +23210,12 @@ function ingestElement(unit, element) {
|
|
|
22975
23210
|
ingestBindings(unit, startOp, element);
|
|
22976
23211
|
ingestReferences(startOp, element);
|
|
22977
23212
|
ingestNodes(unit, element.children);
|
|
22978
|
-
|
|
23213
|
+
// The source span for the end op is typically the element closing tag. However, if no closing tag
|
|
23214
|
+
// exists, such as in `<input>`, we use the start source span instead. Usually the start and end
|
|
23215
|
+
// instructions will be collapsed into one `element` instruction, negating the purpose of this
|
|
23216
|
+
// fallback, but in cases when it is not collapsed (such as an input with a binding), we still
|
|
23217
|
+
// want to map the end instruction to the main element.
|
|
23218
|
+
const endOp = createElementEndOp(id, element.endSourceSpan ?? element.startSourceSpan);
|
|
22979
23219
|
unit.create.push(endOp);
|
|
22980
23220
|
// If there is an i18n message associated with this element, insert i18n start and end ops.
|
|
22981
23221
|
if (element.i18n instanceof Message) {
|
|
@@ -23130,6 +23370,10 @@ function ingestDeferView(unit, suffix, children, sourceSpan) {
|
|
|
23130
23370
|
return templateOp;
|
|
23131
23371
|
}
|
|
23132
23372
|
function ingestDeferBlock(unit, deferBlock) {
|
|
23373
|
+
const blockMeta = unit.job.deferBlocksMeta.get(deferBlock);
|
|
23374
|
+
if (blockMeta === undefined) {
|
|
23375
|
+
throw new Error(`AssertionError: unable to find metadata for deferred block`);
|
|
23376
|
+
}
|
|
23133
23377
|
// Generate the defer main view and all secondary views.
|
|
23134
23378
|
const main = ingestDeferView(unit, '', deferBlock.children, deferBlock.sourceSpan);
|
|
23135
23379
|
const loading = ingestDeferView(unit, 'Loading', deferBlock.loading?.children, deferBlock.loading?.sourceSpan);
|
|
@@ -23137,7 +23381,7 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
23137
23381
|
const error = ingestDeferView(unit, 'Error', deferBlock.error?.children, deferBlock.error?.sourceSpan);
|
|
23138
23382
|
// Create the main defer op, and ops for all secondary views.
|
|
23139
23383
|
const deferXref = unit.job.allocateXrefId();
|
|
23140
|
-
const deferOp = createDeferOp(deferXref, main.xref, main.handle, deferBlock.sourceSpan);
|
|
23384
|
+
const deferOp = createDeferOp(deferXref, main.xref, main.handle, blockMeta, deferBlock.sourceSpan);
|
|
23141
23385
|
deferOp.placeholderView = placeholder?.xref ?? null;
|
|
23142
23386
|
deferOp.placeholderSlot = placeholder?.handle ?? null;
|
|
23143
23387
|
deferOp.loadingSlot = loading?.handle ?? null;
|
|
@@ -23151,17 +23395,18 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
23151
23395
|
// make it easier to refactor prefetch behavior in the future.
|
|
23152
23396
|
let prefetch = false;
|
|
23153
23397
|
let deferOnOps = [];
|
|
23398
|
+
let deferWhenOps = [];
|
|
23154
23399
|
for (const triggers of [deferBlock.triggers, deferBlock.prefetchTriggers]) {
|
|
23155
23400
|
if (triggers.idle !== undefined) {
|
|
23156
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, prefetch,
|
|
23401
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, prefetch, triggers.idle.sourceSpan);
|
|
23157
23402
|
deferOnOps.push(deferOnOp);
|
|
23158
23403
|
}
|
|
23159
23404
|
if (triggers.immediate !== undefined) {
|
|
23160
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, prefetch,
|
|
23405
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, prefetch, triggers.immediate.sourceSpan);
|
|
23161
23406
|
deferOnOps.push(deferOnOp);
|
|
23162
23407
|
}
|
|
23163
23408
|
if (triggers.timer !== undefined) {
|
|
23164
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, prefetch,
|
|
23409
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, prefetch, triggers.timer.sourceSpan);
|
|
23165
23410
|
deferOnOps.push(deferOnOp);
|
|
23166
23411
|
}
|
|
23167
23412
|
if (triggers.hover !== undefined) {
|
|
@@ -23172,7 +23417,7 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
23172
23417
|
targetSlot: null,
|
|
23173
23418
|
targetView: null,
|
|
23174
23419
|
targetSlotViewSteps: null,
|
|
23175
|
-
}, prefetch,
|
|
23420
|
+
}, prefetch, triggers.hover.sourceSpan);
|
|
23176
23421
|
deferOnOps.push(deferOnOp);
|
|
23177
23422
|
}
|
|
23178
23423
|
if (triggers.interaction !== undefined) {
|
|
@@ -23183,7 +23428,7 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
23183
23428
|
targetSlot: null,
|
|
23184
23429
|
targetView: null,
|
|
23185
23430
|
targetSlotViewSteps: null,
|
|
23186
|
-
}, prefetch,
|
|
23431
|
+
}, prefetch, triggers.interaction.sourceSpan);
|
|
23187
23432
|
deferOnOps.push(deferOnOp);
|
|
23188
23433
|
}
|
|
23189
23434
|
if (triggers.viewport !== undefined) {
|
|
@@ -23194,21 +23439,26 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
23194
23439
|
targetSlot: null,
|
|
23195
23440
|
targetView: null,
|
|
23196
23441
|
targetSlotViewSteps: null,
|
|
23197
|
-
}, prefetch,
|
|
23442
|
+
}, prefetch, triggers.viewport.sourceSpan);
|
|
23198
23443
|
deferOnOps.push(deferOnOp);
|
|
23199
23444
|
}
|
|
23445
|
+
if (triggers.when !== undefined) {
|
|
23446
|
+
const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
|
|
23447
|
+
deferWhenOps.push(deferOnOp);
|
|
23448
|
+
}
|
|
23200
23449
|
// If no (non-prefetching) defer triggers were provided, default to `idle`.
|
|
23201
|
-
if (deferOnOps.length === 0) {
|
|
23450
|
+
if (deferOnOps.length === 0 && deferWhenOps.length === 0) {
|
|
23202
23451
|
deferOnOps.push(createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, false, null));
|
|
23203
23452
|
}
|
|
23204
23453
|
prefetch = true;
|
|
23205
23454
|
}
|
|
23206
23455
|
unit.create.push(deferOnOps);
|
|
23456
|
+
unit.update.push(deferWhenOps);
|
|
23207
23457
|
}
|
|
23208
23458
|
function ingestIcu(unit, icu) {
|
|
23209
|
-
if (icu.i18n instanceof Message) {
|
|
23459
|
+
if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
|
|
23210
23460
|
const xref = unit.job.allocateXrefId();
|
|
23211
|
-
unit.create.push(createIcuOp(xref, icu.i18n, null));
|
|
23461
|
+
unit.create.push(createIcuOp(xref, icu.i18n, icu.i18n.nodes[0], icuFromI18nMessage(icu.i18n).name, null));
|
|
23212
23462
|
unit.update.push(createIcuUpdateOp(xref, null));
|
|
23213
23463
|
}
|
|
23214
23464
|
else {
|
|
@@ -23276,6 +23526,11 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
23276
23526
|
}
|
|
23277
23527
|
}
|
|
23278
23528
|
else if (ast instanceof PropertyWrite) {
|
|
23529
|
+
if (ast.receiver instanceof ImplicitReceiver) {
|
|
23530
|
+
return new WritePropExpr(
|
|
23531
|
+
// TODO: Is it correct to always use the root context in place of the implicit receiver?
|
|
23532
|
+
new ContextExpr(job.root.xref), ast.name, convertAst(ast.value, job, baseSourceSpan), null, convertSourceSpan(ast.span, baseSourceSpan));
|
|
23533
|
+
}
|
|
23279
23534
|
return new WritePropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, convertAst(ast.value, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
23280
23535
|
}
|
|
23281
23536
|
else if (ast instanceof KeyedWrite) {
|
|
@@ -23351,7 +23606,7 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
23351
23606
|
return new EmptyExpr(convertSourceSpan(ast.span, baseSourceSpan));
|
|
23352
23607
|
}
|
|
23353
23608
|
else {
|
|
23354
|
-
throw new Error(`Unhandled expression type
|
|
23609
|
+
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
|
|
23355
23610
|
}
|
|
23356
23611
|
}
|
|
23357
23612
|
/**
|
|
@@ -23583,7 +23838,9 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
23583
23838
|
for (const attr of root.attributes) {
|
|
23584
23839
|
ingestBinding(unit, xref, attr.name, literal(attr.value), 1 /* e.BindingType.Attribute */, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue);
|
|
23585
23840
|
}
|
|
23586
|
-
|
|
23841
|
+
const tagName = root instanceof Element$1 ? root.name : root.tagName;
|
|
23842
|
+
// Don't pass along `ng-template` tag name since it enables directive matching.
|
|
23843
|
+
return tagName === 'ng-template' ? null : tagName;
|
|
23587
23844
|
}
|
|
23588
23845
|
return null;
|
|
23589
23846
|
}
|
|
@@ -27423,7 +27680,9 @@ class TemplateDefinitionBuilder {
|
|
|
27423
27680
|
// that we don't copy any bound attributes since they don't participate in content projection
|
|
27424
27681
|
// and they can be used in directive matching (in the case of `Template.templateAttrs`).
|
|
27425
27682
|
if (root !== null) {
|
|
27426
|
-
|
|
27683
|
+
const name = root instanceof Element$1 ? root.name : root.tagName;
|
|
27684
|
+
// Don't pass along `ng-template` tag name since it enables directive matching.
|
|
27685
|
+
tagName = name === NG_TEMPLATE_TAG_NAME ? null : name;
|
|
27427
27686
|
attrsExprs =
|
|
27428
27687
|
this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, root.attributes, root.inputs, []);
|
|
27429
27688
|
}
|
|
@@ -28689,7 +28948,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
28689
28948
|
else {
|
|
28690
28949
|
// This path compiles the template using the prototype template pipeline. First the template is
|
|
28691
28950
|
// ingested into IR:
|
|
28692
|
-
const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds);
|
|
28951
|
+
const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.deferBlocks);
|
|
28693
28952
|
// Then the IR is transformed to prepare it for cod egeneration.
|
|
28694
28953
|
transform(tpl, CompilationJobKind.Tmpl);
|
|
28695
28954
|
// Finally we emit the template function:
|
|
@@ -30712,7 +30971,7 @@ function publishFacade(global) {
|
|
|
30712
30971
|
* @description
|
|
30713
30972
|
* Entry point for all public APIs of the compiler package.
|
|
30714
30973
|
*/
|
|
30715
|
-
const VERSION = new Version('17.0.0-rc.
|
|
30974
|
+
const VERSION = new Version('17.0.0-rc.3');
|
|
30716
30975
|
|
|
30717
30976
|
class CompilerConfig {
|
|
30718
30977
|
constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, preserveWhitespaces, strictInjectionParameters } = {}) {
|
|
@@ -32242,7 +32501,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
32242
32501
|
function compileDeclareClassMetadata(metadata) {
|
|
32243
32502
|
const definitionMap = new DefinitionMap();
|
|
32244
32503
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
32245
|
-
definitionMap.set('version', literal('17.0.0-rc.
|
|
32504
|
+
definitionMap.set('version', literal('17.0.0-rc.3'));
|
|
32246
32505
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32247
32506
|
definitionMap.set('type', metadata.type);
|
|
32248
32507
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32350,7 +32609,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
32350
32609
|
// in 16.1 is actually used.
|
|
32351
32610
|
const minVersion = hasTransformFunctions ? MINIMUM_PARTIAL_LINKER_VERSION$5 : '14.0.0';
|
|
32352
32611
|
definitionMap.set('minVersion', literal(minVersion));
|
|
32353
|
-
definitionMap.set('version', literal('17.0.0-rc.
|
|
32612
|
+
definitionMap.set('version', literal('17.0.0-rc.3'));
|
|
32354
32613
|
// e.g. `type: MyDirective`
|
|
32355
32614
|
definitionMap.set('type', meta.type.value);
|
|
32356
32615
|
if (meta.isStandalone) {
|
|
@@ -32627,7 +32886,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
32627
32886
|
function compileDeclareFactoryFunction(meta) {
|
|
32628
32887
|
const definitionMap = new DefinitionMap();
|
|
32629
32888
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
32630
|
-
definitionMap.set('version', literal('17.0.0-rc.
|
|
32889
|
+
definitionMap.set('version', literal('17.0.0-rc.3'));
|
|
32631
32890
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32632
32891
|
definitionMap.set('type', meta.type.value);
|
|
32633
32892
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -32662,7 +32921,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
32662
32921
|
function createInjectableDefinitionMap(meta) {
|
|
32663
32922
|
const definitionMap = new DefinitionMap();
|
|
32664
32923
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
32665
|
-
definitionMap.set('version', literal('17.0.0-rc.
|
|
32924
|
+
definitionMap.set('version', literal('17.0.0-rc.3'));
|
|
32666
32925
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32667
32926
|
definitionMap.set('type', meta.type.value);
|
|
32668
32927
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -32713,7 +32972,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
32713
32972
|
function createInjectorDefinitionMap(meta) {
|
|
32714
32973
|
const definitionMap = new DefinitionMap();
|
|
32715
32974
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
32716
|
-
definitionMap.set('version', literal('17.0.0-rc.
|
|
32975
|
+
definitionMap.set('version', literal('17.0.0-rc.3'));
|
|
32717
32976
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32718
32977
|
definitionMap.set('type', meta.type.value);
|
|
32719
32978
|
definitionMap.set('providers', meta.providers);
|
|
@@ -32746,7 +33005,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
32746
33005
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
32747
33006
|
}
|
|
32748
33007
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
32749
|
-
definitionMap.set('version', literal('17.0.0-rc.
|
|
33008
|
+
definitionMap.set('version', literal('17.0.0-rc.3'));
|
|
32750
33009
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32751
33010
|
definitionMap.set('type', meta.type.value);
|
|
32752
33011
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -32797,7 +33056,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
32797
33056
|
function createPipeDefinitionMap(meta) {
|
|
32798
33057
|
const definitionMap = new DefinitionMap();
|
|
32799
33058
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
32800
|
-
definitionMap.set('version', literal('17.0.0-rc.
|
|
33059
|
+
definitionMap.set('version', literal('17.0.0-rc.3'));
|
|
32801
33060
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32802
33061
|
// e.g. `type: MyPipe`
|
|
32803
33062
|
definitionMap.set('type', meta.type.value);
|