@angular/compiler 17.0.2 → 17.1.0-next.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/src/assertions.mjs +5 -5
- package/esm2022/src/compiler_util/expression_converter.mjs +1 -1
- package/esm2022/src/constant_pool.mjs +1 -1
- package/esm2022/src/core.mjs +1 -1
- package/esm2022/src/expression_parser/ast.mjs +1 -1
- package/esm2022/src/expression_parser/lexer.mjs +1 -1
- package/esm2022/src/expression_parser/parser.mjs +1 -1
- package/esm2022/src/i18n/digest.mjs +1 -1
- package/esm2022/src/i18n/extractor_merger.mjs +1 -1
- package/esm2022/src/i18n/i18n_ast.mjs +1 -1
- package/esm2022/src/i18n/i18n_html_parser.mjs +1 -1
- package/esm2022/src/i18n/i18n_parser.mjs +1 -1
- package/esm2022/src/i18n/message_bundle.mjs +1 -1
- package/esm2022/src/i18n/serializers/placeholder.mjs +1 -1
- package/esm2022/src/i18n/serializers/serializer.mjs +1 -1
- package/esm2022/src/i18n/serializers/xliff.mjs +1 -1
- package/esm2022/src/i18n/serializers/xliff2.mjs +1 -1
- package/esm2022/src/i18n/serializers/xmb.mjs +1 -1
- package/esm2022/src/i18n/serializers/xml_helper.mjs +1 -1
- package/esm2022/src/i18n/serializers/xtb.mjs +1 -1
- package/esm2022/src/i18n/translation_bundle.mjs +1 -1
- package/esm2022/src/injectable_compiler_2.mjs +1 -1
- package/esm2022/src/jit_compiler_facade.mjs +2 -2
- package/esm2022/src/ml_parser/ast.mjs +1 -1
- package/esm2022/src/ml_parser/html_tags.mjs +1 -1
- package/esm2022/src/ml_parser/html_whitespaces.mjs +1 -1
- package/esm2022/src/ml_parser/icu_ast_expander.mjs +1 -1
- package/esm2022/src/ml_parser/interpolation_config.mjs +1 -1
- package/esm2022/src/ml_parser/lexer.mjs +1 -1
- package/esm2022/src/ml_parser/parser.mjs +1 -1
- package/esm2022/src/ml_parser/tags.mjs +1 -1
- package/esm2022/src/output/abstract_emitter.mjs +1 -1
- package/esm2022/src/output/abstract_js_emitter.mjs +1 -1
- package/esm2022/src/output/output_ast.mjs +1 -1
- package/esm2022/src/output/output_jit.mjs +1 -1
- package/esm2022/src/output/output_jit_trusted_types.mjs +1 -1
- package/esm2022/src/output/source_map.mjs +1 -1
- package/esm2022/src/parse_util.mjs +1 -1
- package/esm2022/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2022/src/render3/partial/component.mjs +1 -1
- package/esm2022/src/render3/partial/directive.mjs +2 -2
- package/esm2022/src/render3/partial/factory.mjs +1 -1
- package/esm2022/src/render3/partial/injectable.mjs +2 -2
- package/esm2022/src/render3/partial/injector.mjs +2 -2
- package/esm2022/src/render3/partial/ng_module.mjs +2 -2
- package/esm2022/src/render3/partial/pipe.mjs +2 -2
- package/esm2022/src/render3/partial/util.mjs +1 -1
- package/esm2022/src/render3/r3_ast.mjs +1 -1
- package/esm2022/src/render3/r3_class_debug_info_compiler.mjs +1 -1
- package/esm2022/src/render3/r3_class_metadata_compiler.mjs +1 -1
- package/esm2022/src/render3/r3_control_flow.mjs +1 -1
- package/esm2022/src/render3/r3_deferred_blocks.mjs +1 -1
- package/esm2022/src/render3/r3_deferred_triggers.mjs +3 -3
- package/esm2022/src/render3/r3_factory.mjs +1 -1
- package/esm2022/src/render3/r3_injector_compiler.mjs +1 -1
- package/esm2022/src/render3/r3_jit.mjs +1 -1
- package/esm2022/src/render3/r3_module_compiler.mjs +1 -1
- package/esm2022/src/render3/r3_pipe_compiler.mjs +1 -1
- package/esm2022/src/render3/r3_template_transform.mjs +1 -1
- package/esm2022/src/render3/util.mjs +1 -1
- package/esm2022/src/render3/view/compiler.mjs +1 -1
- package/esm2022/src/render3/view/i18n/context.mjs +1 -1
- package/esm2022/src/render3/view/i18n/get_msg_utils.mjs +1 -1
- package/esm2022/src/render3/view/i18n/localize_utils.mjs +1 -1
- package/esm2022/src/render3/view/i18n/meta.mjs +1 -1
- package/esm2022/src/render3/view/i18n/util.mjs +1 -1
- package/esm2022/src/render3/view/style_parser.mjs +1 -1
- package/esm2022/src/render3/view/styling_builder.mjs +1 -1
- package/esm2022/src/render3/view/t2_binder.mjs +1 -1
- package/esm2022/src/render3/view/template.mjs +4 -2
- package/esm2022/src/render3/view/util.mjs +1 -1
- package/esm2022/src/schema/dom_element_schema_registry.mjs +1 -1
- package/esm2022/src/schema/dom_security_schema.mjs +1 -1
- package/esm2022/src/selector.mjs +1 -1
- package/esm2022/src/shadow_css.mjs +1 -1
- package/esm2022/src/template/pipeline/ir/src/enums.mjs +7 -3
- package/esm2022/src/template/pipeline/ir/src/expression.mjs +3 -3
- package/esm2022/src/template/pipeline/ir/src/operations.mjs +1 -1
- package/esm2022/src/template/pipeline/ir/src/ops/create.mjs +14 -5
- package/esm2022/src/template/pipeline/ir/src/ops/update.mjs +1 -12
- package/esm2022/src/template/pipeline/src/compilation.mjs +1 -1
- package/esm2022/src/template/pipeline/src/conversion.mjs +1 -1
- package/esm2022/src/template/pipeline/src/emit.mjs +4 -4
- package/esm2022/src/template/pipeline/src/ingest.mjs +28 -7
- package/esm2022/src/template/pipeline/src/instruction.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/any_cast.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/apply_i18n_expressions.mjs +15 -5
- package/esm2022/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/attribute_extraction.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/binding_specialization.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/chaining.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/collapse_singleton_interpolations.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/conditionals.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/const_collection.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/create_defer_deps_fns.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/create_i18n_contexts.mjs +2 -2
- package/esm2022/src/template/pipeline/src/phases/defer_configs.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/defer_resolve_targets.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/empty_elements.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/expand_safe_reads.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/extract_i18n_messages.mjs +23 -14
- package/esm2022/src/template/pipeline/src/phases/generate_advance.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/generate_projection_def.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/generate_variables.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/has_const_expression_collection.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/host_style_property_parsing.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/i18n_const_collection.mjs +9 -3
- package/esm2022/src/template/pipeline/src/phases/i18n_text_extraction.mjs +18 -3
- package/esm2022/src/template/pipeline/src/phases/local_refs.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/merge_i18n_contexts.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/namespace.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/naming.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/next_context_merging.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/ng_container.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/nonbindable.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/nullish_coalescing.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/ordering.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/parse_extracted_styles.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/phase_remove_content_selectors.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/pipe_creation.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/pipe_variadic.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/pure_function_extraction.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/pure_literal_structures.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/reify.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/remove_empty_bindings.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/remove_i18n_contexts.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/repeater_derived_vars.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/resolve_contexts.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/resolve_dollar_event.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/resolve_i18n_element_placeholders.mjs +2 -2
- package/esm2022/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs +9 -5
- package/esm2022/src/template/pipeline/src/phases/resolve_i18n_icu_placeholders.mjs +71 -0
- package/esm2022/src/template/pipeline/src/phases/resolve_names.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/resolve_sanitizers.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/save_restore_view.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/slot_allocation.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/style_binding_specialization.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/temporary_variables.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/track_fn_generation.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/track_fn_optimization.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/track_variables.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/var_counting.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/variable_optimization.mjs +1 -1
- package/esm2022/src/template/pipeline/src/phases/wrap_icus.mjs +11 -5
- package/esm2022/src/template/pipeline/src/util/elements.mjs +1 -1
- package/esm2022/src/template_parser/binding_parser.mjs +1 -1
- package/esm2022/src/template_parser/template_preparser.mjs +1 -1
- package/esm2022/src/util.mjs +1 -1
- package/esm2022/src/version.mjs +1 -1
- package/fesm2022/compiler.mjs +212 -119
- 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/create_i18n_icu_expressions.mjs +0 -52
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.0.
|
|
2
|
+
* @license Angular v17.1.0-next.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -5175,10 +5175,10 @@ function createFactoryFunction(type) {
|
|
|
5175
5175
|
}
|
|
5176
5176
|
|
|
5177
5177
|
const UNUSABLE_INTERPOLATION_REGEXPS = [
|
|
5178
|
-
/^\s*$/,
|
|
5179
|
-
/[<>]/,
|
|
5180
|
-
/^[{}]$/,
|
|
5181
|
-
/&(#|[a-z])/i,
|
|
5178
|
+
/^\s*$/, // empty
|
|
5179
|
+
/[<>]/, // html tag
|
|
5180
|
+
/^[{}]$/, // i18n expansion
|
|
5181
|
+
/&(#|[a-z])/i, // character reference,
|
|
5182
5182
|
/^\/\//, // comment
|
|
5183
5183
|
];
|
|
5184
5184
|
function assertInterpolationSymbols(identifier, value) {
|
|
@@ -8852,11 +8852,11 @@ var OpKind;
|
|
|
8852
8852
|
/**
|
|
8853
8853
|
* An instruction to create an ICU expression.
|
|
8854
8854
|
*/
|
|
8855
|
-
OpKind[OpKind["
|
|
8855
|
+
OpKind[OpKind["IcuStart"] = 41] = "IcuStart";
|
|
8856
8856
|
/**
|
|
8857
8857
|
* An instruction to update an ICU expression.
|
|
8858
8858
|
*/
|
|
8859
|
-
OpKind[OpKind["
|
|
8859
|
+
OpKind[OpKind["IcuEnd"] = 42] = "IcuEnd";
|
|
8860
8860
|
/**
|
|
8861
8861
|
* An i18n context containing information needed to generate an i18n message.
|
|
8862
8862
|
*/
|
|
@@ -9105,6 +9105,10 @@ var I18nParamValueFlags;
|
|
|
9105
9105
|
* This value represents the closing of a tag.
|
|
9106
9106
|
*/
|
|
9107
9107
|
I18nParamValueFlags[I18nParamValueFlags["CloseTag"] = 8] = "CloseTag";
|
|
9108
|
+
/**
|
|
9109
|
+
* This value represents an i18n expression index.
|
|
9110
|
+
*/
|
|
9111
|
+
I18nParamValueFlags[I18nParamValueFlags["ExpressionIndex"] = 16] = "ExpressionIndex";
|
|
9108
9112
|
})(I18nParamValueFlags || (I18nParamValueFlags = {}));
|
|
9109
9113
|
/**
|
|
9110
9114
|
* Whether the active namespace is HTML, MathML, or SVG mode.
|
|
@@ -9453,17 +9457,6 @@ function createI18nApplyOp(target, handle, sourceSpan) {
|
|
|
9453
9457
|
...NEW_OP,
|
|
9454
9458
|
};
|
|
9455
9459
|
}
|
|
9456
|
-
/**
|
|
9457
|
-
* Creates an op to update an ICU expression.
|
|
9458
|
-
*/
|
|
9459
|
-
function createIcuUpdateOp(xref, sourceSpan) {
|
|
9460
|
-
return {
|
|
9461
|
-
kind: OpKind.IcuUpdate,
|
|
9462
|
-
xref,
|
|
9463
|
-
sourceSpan,
|
|
9464
|
-
...NEW_OP,
|
|
9465
|
-
};
|
|
9466
|
-
}
|
|
9467
9460
|
|
|
9468
9461
|
var _a, _b, _c, _d, _e, _f;
|
|
9469
9462
|
/**
|
|
@@ -10254,8 +10247,8 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
10254
10247
|
case OpKind.I18nContext:
|
|
10255
10248
|
case OpKind.I18nEnd:
|
|
10256
10249
|
case OpKind.I18nStart:
|
|
10257
|
-
case OpKind.
|
|
10258
|
-
case OpKind.
|
|
10250
|
+
case OpKind.IcuEnd:
|
|
10251
|
+
case OpKind.IcuStart:
|
|
10259
10252
|
case OpKind.Namespace:
|
|
10260
10253
|
case OpKind.Pipe:
|
|
10261
10254
|
case OpKind.Projection:
|
|
@@ -10908,20 +10901,29 @@ function createI18nEndOp(xref) {
|
|
|
10908
10901
|
};
|
|
10909
10902
|
}
|
|
10910
10903
|
/**
|
|
10911
|
-
* Creates an
|
|
10904
|
+
* Creates an ICU start op.
|
|
10912
10905
|
*/
|
|
10913
|
-
function
|
|
10906
|
+
function createIcuStartOp(xref, message, messagePlaceholder, sourceSpan) {
|
|
10914
10907
|
return {
|
|
10915
|
-
kind: OpKind.
|
|
10908
|
+
kind: OpKind.IcuStart,
|
|
10916
10909
|
xref,
|
|
10917
10910
|
message,
|
|
10918
|
-
icu,
|
|
10919
10911
|
messagePlaceholder,
|
|
10920
10912
|
context: null,
|
|
10921
10913
|
sourceSpan,
|
|
10922
10914
|
...NEW_OP,
|
|
10923
10915
|
};
|
|
10924
10916
|
}
|
|
10917
|
+
/**
|
|
10918
|
+
* Creates an ICU end op.
|
|
10919
|
+
*/
|
|
10920
|
+
function createIcuEndOp(xref) {
|
|
10921
|
+
return {
|
|
10922
|
+
kind: OpKind.IcuEnd,
|
|
10923
|
+
xref,
|
|
10924
|
+
...NEW_OP,
|
|
10925
|
+
};
|
|
10926
|
+
}
|
|
10925
10927
|
function createI18nContextOp(xref, i18nBlock, message, sourceSpan) {
|
|
10926
10928
|
return {
|
|
10927
10929
|
kind: OpKind.I18nContext,
|
|
@@ -11170,10 +11172,18 @@ function removeAnys(e) {
|
|
|
11170
11172
|
* Adds apply operations after i18n expressions.
|
|
11171
11173
|
*/
|
|
11172
11174
|
function applyI18nExpressions(job) {
|
|
11175
|
+
const i18nContexts = new Map();
|
|
11176
|
+
for (const unit of job.units) {
|
|
11177
|
+
for (const op of unit.create) {
|
|
11178
|
+
if (op.kind === OpKind.I18nContext) {
|
|
11179
|
+
i18nContexts.set(op.xref, op);
|
|
11180
|
+
}
|
|
11181
|
+
}
|
|
11182
|
+
}
|
|
11173
11183
|
for (const unit of job.units) {
|
|
11174
11184
|
for (const op of unit.update) {
|
|
11175
11185
|
// Only add apply after expressions that are not followed by more expressions.
|
|
11176
|
-
if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
|
|
11186
|
+
if (op.kind === OpKind.I18nExpression && needsApplication(i18nContexts, op)) {
|
|
11177
11187
|
// TODO: what should be the source span for the apply op?
|
|
11178
11188
|
OpList.insertAfter(createI18nApplyOp(op.target, op.handle, null), op);
|
|
11179
11189
|
}
|
|
@@ -11183,13 +11193,15 @@ function applyI18nExpressions(job) {
|
|
|
11183
11193
|
/**
|
|
11184
11194
|
* Checks whether the given expression op needs to be followed with an apply op.
|
|
11185
11195
|
*/
|
|
11186
|
-
function needsApplication(op) {
|
|
11196
|
+
function needsApplication(i18nContexts, op) {
|
|
11187
11197
|
// If the next op is not another expression, we need to apply.
|
|
11188
11198
|
if (op.next?.kind !== OpKind.I18nExpression) {
|
|
11189
11199
|
return true;
|
|
11190
11200
|
}
|
|
11191
|
-
// If the next op is an expression targeting a different i18n
|
|
11192
|
-
|
|
11201
|
+
// If the next op is an expression targeting a different i18n block, we need to apply.
|
|
11202
|
+
const context = i18nContexts.get(op.context);
|
|
11203
|
+
const nextContext = i18nContexts.get(op.next.context);
|
|
11204
|
+
if (context.i18nBlock !== nextContext.i18nBlock) {
|
|
11193
11205
|
return true;
|
|
11194
11206
|
}
|
|
11195
11207
|
return false;
|
|
@@ -11850,7 +11862,7 @@ function createI18nContexts(job) {
|
|
|
11850
11862
|
case OpKind.I18nEnd:
|
|
11851
11863
|
currentI18nOp = null;
|
|
11852
11864
|
break;
|
|
11853
|
-
case OpKind.
|
|
11865
|
+
case OpKind.IcuStart:
|
|
11854
11866
|
// If an ICU represents a different message than its containing block, we give it its own
|
|
11855
11867
|
// i18n context.
|
|
11856
11868
|
if (currentI18nOp === null) {
|
|
@@ -11873,50 +11885,6 @@ function createI18nContexts(job) {
|
|
|
11873
11885
|
}
|
|
11874
11886
|
}
|
|
11875
11887
|
|
|
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
|
-
|
|
11920
11888
|
/**
|
|
11921
11889
|
* Defer instructions take a configuration array, which should be collected into the component
|
|
11922
11890
|
* consts. This phase finds the config options, and creates the corresponding const array.
|
|
@@ -12331,18 +12299,23 @@ function extractI18nMessages(job) {
|
|
|
12331
12299
|
// Extract messages from ICUs with their own sub-context.
|
|
12332
12300
|
for (const unit of job.units) {
|
|
12333
12301
|
for (const op of unit.create) {
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12302
|
+
switch (op.kind) {
|
|
12303
|
+
case OpKind.IcuStart:
|
|
12304
|
+
if (!op.context) {
|
|
12305
|
+
throw Error('ICU op should have its context set.');
|
|
12306
|
+
}
|
|
12307
|
+
if (!i18nBlockContexts.has(op.context)) {
|
|
12308
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
12309
|
+
const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
|
|
12310
|
+
unit.create.push(subMessage);
|
|
12311
|
+
const parentMessage = i18nBlockMessages.get(i18nContext.i18nBlock);
|
|
12312
|
+
parentMessage?.subMessages.push(subMessage.xref);
|
|
12313
|
+
}
|
|
12314
|
+
OpList.remove(op);
|
|
12315
|
+
break;
|
|
12316
|
+
case OpKind.IcuEnd:
|
|
12317
|
+
OpList.remove(op);
|
|
12318
|
+
break;
|
|
12346
12319
|
}
|
|
12347
12320
|
}
|
|
12348
12321
|
}
|
|
@@ -12364,7 +12337,7 @@ function createI18nMessage(job, context, messagePlaceholder) {
|
|
|
12364
12337
|
*/
|
|
12365
12338
|
function formatParams(params) {
|
|
12366
12339
|
const result = new Map();
|
|
12367
|
-
for (const [placeholder, placeholderValues] of
|
|
12340
|
+
for (const [placeholder, placeholderValues] of params) {
|
|
12368
12341
|
const serializedValues = formatParamValues(placeholderValues);
|
|
12369
12342
|
if (serializedValues !== null) {
|
|
12370
12343
|
result.set(placeholder, literal(formatParamValues(placeholderValues)));
|
|
@@ -12388,6 +12361,10 @@ function formatParamValues(values) {
|
|
|
12388
12361
|
* Formats a single `I18nParamValue` into a string
|
|
12389
12362
|
*/
|
|
12390
12363
|
function formatValue(value) {
|
|
12364
|
+
// If there are no special flags, just return the raw value.
|
|
12365
|
+
if (value.flags === I18nParamValueFlags.None) {
|
|
12366
|
+
return `${value.value}`;
|
|
12367
|
+
}
|
|
12391
12368
|
let tagMarker = '';
|
|
12392
12369
|
let closeMarker = '';
|
|
12393
12370
|
if (value.flags & I18nParamValueFlags.ElementTag) {
|
|
@@ -19638,6 +19615,8 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
|
19638
19615
|
statements.push(...subMessageStatements);
|
|
19639
19616
|
messageOp.params.set(subMessage.messagePlaceholder, subMessageVar);
|
|
19640
19617
|
}
|
|
19618
|
+
// Sort the params for consistency with TemaplateDefinitionBuilder output.
|
|
19619
|
+
messageOp.params = new Map([...messageOp.params.entries()].sort());
|
|
19641
19620
|
// Check that the message has all of its parameters filled out.
|
|
19642
19621
|
assertAllParamsResolved(messageOp);
|
|
19643
19622
|
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX));
|
|
@@ -19649,6 +19628,8 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
|
19649
19628
|
// If nescessary, add a post-processing step and resolve any placeholder params that are
|
|
19650
19629
|
// set in post-processing.
|
|
19651
19630
|
if (messageOp.needsPostprocessing) {
|
|
19631
|
+
// Sort the post-processing params for consistency with TemaplateDefinitionBuilder output.
|
|
19632
|
+
messageOp.postprocessingParams = new Map([...messageOp.postprocessingParams.entries()].sort());
|
|
19652
19633
|
const extraTransformFnParams = [];
|
|
19653
19634
|
if (messageOp.postprocessingParams.size > 0) {
|
|
19654
19635
|
extraTransformFnParams.push(literalMap([...messageOp.postprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
|
|
@@ -19730,12 +19711,14 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
|
|
|
19730
19711
|
* Asserts that all of the message's placeholders have values.
|
|
19731
19712
|
*/
|
|
19732
19713
|
function assertAllParamsResolved(op) {
|
|
19733
|
-
for (
|
|
19714
|
+
for (let placeholder in op.message.placeholders) {
|
|
19715
|
+
placeholder = placeholder.trimEnd();
|
|
19734
19716
|
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
19735
19717
|
throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
|
|
19736
19718
|
}
|
|
19737
19719
|
}
|
|
19738
|
-
for (
|
|
19720
|
+
for (let placeholder in op.message.placeholderToMessage) {
|
|
19721
|
+
placeholder = placeholder.trimEnd();
|
|
19739
19722
|
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
19740
19723
|
throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
|
|
19741
19724
|
}
|
|
@@ -19750,7 +19733,9 @@ function extractI18nText(job) {
|
|
|
19750
19733
|
// Remove all text nodes within i18n blocks, their content is already captured in the i18n
|
|
19751
19734
|
// message.
|
|
19752
19735
|
let currentI18n = null;
|
|
19736
|
+
let currentIcu = null;
|
|
19753
19737
|
const textNodeI18nBlocks = new Map();
|
|
19738
|
+
const textNodeIcus = new Map();
|
|
19754
19739
|
for (const op of unit.create) {
|
|
19755
19740
|
switch (op.kind) {
|
|
19756
19741
|
case OpKind.I18nStart:
|
|
@@ -19762,9 +19747,19 @@ function extractI18nText(job) {
|
|
|
19762
19747
|
case OpKind.I18nEnd:
|
|
19763
19748
|
currentI18n = null;
|
|
19764
19749
|
break;
|
|
19750
|
+
case OpKind.IcuStart:
|
|
19751
|
+
if (op.context === null) {
|
|
19752
|
+
throw Error('Icu op should have its context set.');
|
|
19753
|
+
}
|
|
19754
|
+
currentIcu = op;
|
|
19755
|
+
break;
|
|
19756
|
+
case OpKind.IcuEnd:
|
|
19757
|
+
currentIcu = null;
|
|
19758
|
+
break;
|
|
19765
19759
|
case OpKind.Text:
|
|
19766
19760
|
if (currentI18n !== null) {
|
|
19767
19761
|
textNodeI18nBlocks.set(op.xref, currentI18n);
|
|
19762
|
+
textNodeIcus.set(op.xref, currentIcu);
|
|
19768
19763
|
OpList.remove(op);
|
|
19769
19764
|
}
|
|
19770
19765
|
break;
|
|
@@ -19779,13 +19774,16 @@ function extractI18nText(job) {
|
|
|
19779
19774
|
continue;
|
|
19780
19775
|
}
|
|
19781
19776
|
const i18nOp = textNodeI18nBlocks.get(op.target);
|
|
19777
|
+
const icuOp = textNodeIcus.get(op.target);
|
|
19778
|
+
const contextId = icuOp ? icuOp.context : i18nOp.context;
|
|
19779
|
+
const resolutionTime = icuOp ? I18nParamResolutionTime.Postproccessing :
|
|
19780
|
+
I18nParamResolutionTime.Creation;
|
|
19782
19781
|
const ops = [];
|
|
19783
19782
|
for (let i = 0; i < op.interpolation.expressions.length; i++) {
|
|
19784
19783
|
const expr = op.interpolation.expressions[i];
|
|
19785
|
-
const placeholder = op.i18nPlaceholders[i];
|
|
19786
19784
|
// For now, this i18nExpression depends on the slot context of the enclosing i18n block.
|
|
19787
19785
|
// Later, we will modify this, and advance to a different point.
|
|
19788
|
-
ops.push(createI18nExpressionOp(
|
|
19786
|
+
ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.handle, expr, op.i18nPlaceholders[i], resolutionTime, expr.sourceSpan ?? op.sourceSpan));
|
|
19789
19787
|
}
|
|
19790
19788
|
OpList.replaceWithMany(op, ops);
|
|
19791
19789
|
break;
|
|
@@ -21800,7 +21798,7 @@ function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
|
|
|
21800
21798
|
return i18nOp.subTemplateIndex;
|
|
21801
21799
|
}
|
|
21802
21800
|
/** Add a param value to the given params map. */
|
|
21803
|
-
function addParam(params, placeholder, value, subTemplateIndex, flags
|
|
21801
|
+
function addParam(params, placeholder, value, subTemplateIndex, flags) {
|
|
21804
21802
|
const values = params.get(placeholder) ?? [];
|
|
21805
21803
|
values.push({ value, subTemplateIndex, flags });
|
|
21806
21804
|
params.set(placeholder, values);
|
|
@@ -21825,27 +21823,93 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
21825
21823
|
}
|
|
21826
21824
|
}
|
|
21827
21825
|
}
|
|
21828
|
-
// Keep track of the next available expression index per i18n
|
|
21826
|
+
// Keep track of the next available expression index per i18n block.
|
|
21829
21827
|
const expressionIndices = new Map();
|
|
21830
21828
|
for (const unit of job.units) {
|
|
21831
21829
|
for (const op of unit.update) {
|
|
21832
21830
|
if (op.kind === OpKind.I18nExpression) {
|
|
21833
|
-
const index = expressionIndices.get(op.context) || 0;
|
|
21834
21831
|
const i18nContext = i18nContexts.get(op.context);
|
|
21832
|
+
const index = expressionIndices.get(i18nContext.i18nBlock) || 0;
|
|
21835
21833
|
const subTemplateIndex = subTemplateIndicies.get(i18nContext.i18nBlock);
|
|
21836
21834
|
// Add the expression index in the appropriate params map.
|
|
21837
21835
|
const params = op.resolutionTime === I18nParamResolutionTime.Creation ?
|
|
21838
21836
|
i18nContext.params :
|
|
21839
21837
|
i18nContext.postprocessingParams;
|
|
21840
21838
|
const values = params.get(op.i18nPlaceholder) || [];
|
|
21841
|
-
values.push({
|
|
21839
|
+
values.push({
|
|
21840
|
+
value: index,
|
|
21841
|
+
subTemplateIndex: subTemplateIndex,
|
|
21842
|
+
flags: I18nParamValueFlags.ExpressionIndex
|
|
21843
|
+
});
|
|
21842
21844
|
params.set(op.i18nPlaceholder, values);
|
|
21843
|
-
expressionIndices.set(
|
|
21845
|
+
expressionIndices.set(i18nContext.i18nBlock, index + 1);
|
|
21844
21846
|
}
|
|
21845
21847
|
}
|
|
21846
21848
|
}
|
|
21847
21849
|
}
|
|
21848
21850
|
|
|
21851
|
+
/**
|
|
21852
|
+
* Resolves placeholders for element tags inside of an ICU.
|
|
21853
|
+
*/
|
|
21854
|
+
function resolveI18nIcuPlaceholders(job) {
|
|
21855
|
+
const contextOps = new Map();
|
|
21856
|
+
for (const unit of job.units) {
|
|
21857
|
+
for (const op of unit.create) {
|
|
21858
|
+
switch (op.kind) {
|
|
21859
|
+
case OpKind.I18nContext:
|
|
21860
|
+
contextOps.set(op.xref, op);
|
|
21861
|
+
break;
|
|
21862
|
+
}
|
|
21863
|
+
}
|
|
21864
|
+
}
|
|
21865
|
+
for (const unit of job.units) {
|
|
21866
|
+
for (const op of unit.create) {
|
|
21867
|
+
switch (op.kind) {
|
|
21868
|
+
case OpKind.IcuStart:
|
|
21869
|
+
if (op.context === null) {
|
|
21870
|
+
throw Error('Icu should have its i18n context set.');
|
|
21871
|
+
}
|
|
21872
|
+
const i18nContext = contextOps.get(op.context);
|
|
21873
|
+
for (const node of op.message.nodes) {
|
|
21874
|
+
node.visit(new ResolveIcuPlaceholdersVisitor(i18nContext.postprocessingParams));
|
|
21875
|
+
}
|
|
21876
|
+
break;
|
|
21877
|
+
}
|
|
21878
|
+
}
|
|
21879
|
+
}
|
|
21880
|
+
}
|
|
21881
|
+
/**
|
|
21882
|
+
* Visitor for i18n AST that resolves ICU params into the given map.
|
|
21883
|
+
*/
|
|
21884
|
+
class ResolveIcuPlaceholdersVisitor extends RecurseVisitor {
|
|
21885
|
+
constructor(params) {
|
|
21886
|
+
super();
|
|
21887
|
+
this.params = params;
|
|
21888
|
+
}
|
|
21889
|
+
visitTagPlaceholder(placeholder) {
|
|
21890
|
+
super.visitTagPlaceholder(placeholder);
|
|
21891
|
+
// Add the start and end source span for tag placeholders. These need to be recorded for
|
|
21892
|
+
// elements inside ICUs. The slots for the elements were recorded separately under the i18n
|
|
21893
|
+
// block's context as part of the `resolveI18nElementPlaceholders` phase.
|
|
21894
|
+
if (placeholder.startName && placeholder.startSourceSpan &&
|
|
21895
|
+
!this.params.has(placeholder.startName)) {
|
|
21896
|
+
this.params.set(placeholder.startName, [{
|
|
21897
|
+
value: placeholder.startSourceSpan?.toString(),
|
|
21898
|
+
subTemplateIndex: null,
|
|
21899
|
+
flags: I18nParamValueFlags.None
|
|
21900
|
+
}]);
|
|
21901
|
+
}
|
|
21902
|
+
if (placeholder.closeName && placeholder.endSourceSpan &&
|
|
21903
|
+
!this.params.has(placeholder.closeName)) {
|
|
21904
|
+
this.params.set(placeholder.closeName, [{
|
|
21905
|
+
value: placeholder.endSourceSpan?.toString(),
|
|
21906
|
+
subTemplateIndex: null,
|
|
21907
|
+
flags: I18nParamValueFlags.None
|
|
21908
|
+
}]);
|
|
21909
|
+
}
|
|
21910
|
+
}
|
|
21911
|
+
}
|
|
21912
|
+
|
|
21849
21913
|
/**
|
|
21850
21914
|
* Resolves lexical references in views (`ir.LexicalReadExpr`) to either a target variable or to
|
|
21851
21915
|
* property reads on the top-level component context.
|
|
@@ -22896,6 +22960,7 @@ function allowConservativeInlining(decl, target) {
|
|
|
22896
22960
|
function wrapI18nIcus(job) {
|
|
22897
22961
|
for (const unit of job.units) {
|
|
22898
22962
|
let currentI18nOp = null;
|
|
22963
|
+
let addedI18nId = null;
|
|
22899
22964
|
for (const op of unit.create) {
|
|
22900
22965
|
switch (op.kind) {
|
|
22901
22966
|
case OpKind.I18nStart:
|
|
@@ -22904,11 +22969,16 @@ function wrapI18nIcus(job) {
|
|
|
22904
22969
|
case OpKind.I18nEnd:
|
|
22905
22970
|
currentI18nOp = null;
|
|
22906
22971
|
break;
|
|
22907
|
-
case OpKind.
|
|
22972
|
+
case OpKind.IcuStart:
|
|
22908
22973
|
if (currentI18nOp === null) {
|
|
22909
|
-
|
|
22910
|
-
OpList.insertBefore(createI18nStartOp(
|
|
22911
|
-
|
|
22974
|
+
addedI18nId = job.allocateXrefId();
|
|
22975
|
+
OpList.insertBefore(createI18nStartOp(addedI18nId, op.message), op);
|
|
22976
|
+
}
|
|
22977
|
+
break;
|
|
22978
|
+
case OpKind.IcuEnd:
|
|
22979
|
+
if (addedI18nId !== null) {
|
|
22980
|
+
OpList.insertAfter(createI18nEndOp(addedI18nId), op);
|
|
22981
|
+
addedI18nId = null;
|
|
22912
22982
|
}
|
|
22913
22983
|
break;
|
|
22914
22984
|
}
|
|
@@ -22942,7 +23012,6 @@ const phases = [
|
|
|
22942
23012
|
{ kind: CompilationJobKind.Tmpl, fn: createPipes },
|
|
22943
23013
|
{ kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
|
|
22944
23014
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nText },
|
|
22945
|
-
{ kind: CompilationJobKind.Tmpl, fn: createI18nIcuExpressions },
|
|
22946
23015
|
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
22947
23016
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
22948
23017
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
@@ -22957,7 +23026,7 @@ const phases = [
|
|
|
22957
23026
|
{ kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
|
|
22958
23027
|
{ kind: CompilationJobKind.Tmpl, fn: optimizeTrackFns },
|
|
22959
23028
|
{ kind: CompilationJobKind.Both, fn: resolveContexts },
|
|
22960
|
-
{ kind: CompilationJobKind.Tmpl, fn: resolveSanitizers },
|
|
23029
|
+
{ kind: CompilationJobKind.Tmpl, fn: resolveSanitizers }, // TODO: run in both
|
|
22961
23030
|
{ kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
|
|
22962
23031
|
{ kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
|
|
22963
23032
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
@@ -22966,6 +23035,7 @@ const phases = [
|
|
|
22966
23035
|
{ kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
|
|
22967
23036
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
22968
23037
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
23038
|
+
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
|
|
22969
23039
|
{ kind: CompilationJobKind.Tmpl, fn: mergeI18nContexts },
|
|
22970
23040
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
22971
23041
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
|
|
@@ -23279,7 +23349,7 @@ function ingestText(unit, text) {
|
|
|
23279
23349
|
/**
|
|
23280
23350
|
* Ingest an interpolated text node from the AST into the given `ViewCompilation`.
|
|
23281
23351
|
*/
|
|
23282
|
-
function ingestBoundText(unit, text) {
|
|
23352
|
+
function ingestBoundText(unit, text, i18nPlaceholders) {
|
|
23283
23353
|
let value = text.value;
|
|
23284
23354
|
if (value instanceof ASTWithSource) {
|
|
23285
23355
|
value = value.ast;
|
|
@@ -23290,9 +23360,16 @@ function ingestBoundText(unit, text) {
|
|
|
23290
23360
|
if (text.i18n !== undefined && !(text.i18n instanceof Container)) {
|
|
23291
23361
|
throw Error(`Unhandled i18n metadata type for text interpolation: ${text.i18n?.constructor.name}`);
|
|
23292
23362
|
}
|
|
23293
|
-
|
|
23294
|
-
text.i18n
|
|
23295
|
-
|
|
23363
|
+
if (i18nPlaceholders === undefined) {
|
|
23364
|
+
i18nPlaceholders = text.i18n instanceof Container ?
|
|
23365
|
+
text.i18n.children
|
|
23366
|
+
.filter((node) => node instanceof Placeholder)
|
|
23367
|
+
.map(placeholder => placeholder.name) :
|
|
23368
|
+
[];
|
|
23369
|
+
}
|
|
23370
|
+
if (i18nPlaceholders.length > 0 && i18nPlaceholders.length !== value.expressions.length) {
|
|
23371
|
+
throw Error(`Unexpected number of i18n placeholders (${value.expressions.length}) for BoundText with ${value.expressions.length} expressions`);
|
|
23372
|
+
}
|
|
23296
23373
|
const textXref = unit.job.allocateXrefId();
|
|
23297
23374
|
unit.create.push(createTextOp(textXref, '', text.sourceSpan));
|
|
23298
23375
|
// TemplateDefinitionBuilder does not generate source maps for sub-expressions inside an
|
|
@@ -23458,8 +23535,22 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
23458
23535
|
function ingestIcu(unit, icu) {
|
|
23459
23536
|
if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
|
|
23460
23537
|
const xref = unit.job.allocateXrefId();
|
|
23461
|
-
|
|
23462
|
-
unit.
|
|
23538
|
+
const icuNode = icu.i18n.nodes[0];
|
|
23539
|
+
unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
|
|
23540
|
+
const expressionPlaceholder = icuNode.expressionPlaceholder?.trimEnd();
|
|
23541
|
+
if (expressionPlaceholder === undefined || icu.vars[expressionPlaceholder] === undefined) {
|
|
23542
|
+
throw Error('ICU should have a text binding');
|
|
23543
|
+
}
|
|
23544
|
+
ingestBoundText(unit, icu.vars[expressionPlaceholder], [expressionPlaceholder]);
|
|
23545
|
+
for (const [placeholder, text] of Object.entries(icu.placeholders)) {
|
|
23546
|
+
if (text instanceof BoundText) {
|
|
23547
|
+
ingestBoundText(unit, text, [placeholder]);
|
|
23548
|
+
}
|
|
23549
|
+
else {
|
|
23550
|
+
ingestText(unit, text);
|
|
23551
|
+
}
|
|
23552
|
+
}
|
|
23553
|
+
unit.create.push(createIcuEndOp(xref));
|
|
23463
23554
|
}
|
|
23464
23555
|
else {
|
|
23465
23556
|
throw Error(`Unhandled i18n metadata type for ICU: ${icu.i18n?.constructor.name}`);
|
|
@@ -25353,8 +25444,8 @@ const TIME_PATTERN = /^\d+\.?\d*(ms|s)?$/;
|
|
|
25353
25444
|
const SEPARATOR_PATTERN = /^\s$/;
|
|
25354
25445
|
/** Pairs of characters that form syntax that is comma-delimited. */
|
|
25355
25446
|
const COMMA_DELIMITED_SYNTAX = new Map([
|
|
25356
|
-
[$LBRACE, $RBRACE],
|
|
25357
|
-
[$LBRACKET, $RBRACKET],
|
|
25447
|
+
[$LBRACE, $RBRACE], // Object literals
|
|
25448
|
+
[$LBRACKET, $RBRACKET], // Array literals
|
|
25358
25449
|
[$LPAREN, $RPAREN], // Function calls
|
|
25359
25450
|
]);
|
|
25360
25451
|
/** Possible types of `on` triggers. */
|
|
@@ -27380,7 +27471,9 @@ class TemplateDefinitionBuilder {
|
|
|
27380
27471
|
// inside ICUs)
|
|
27381
27472
|
// - all ICU vars (such as `VAR_SELECT` or `VAR_PLURAL`) are replaced with correct values
|
|
27382
27473
|
const transformFn = (raw) => {
|
|
27383
|
-
|
|
27474
|
+
// Sort the map entries in the compiled output. This makes it easy to acheive identical output
|
|
27475
|
+
// in the template pipeline compiler.
|
|
27476
|
+
const params = Object.fromEntries(Object.entries({ ...vars, ...placeholders }).sort());
|
|
27384
27477
|
const formatted = formatI18nPlaceholderNamesInMap(params, /* useCamelCase */ false);
|
|
27385
27478
|
return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
|
|
27386
27479
|
};
|
|
@@ -30431,7 +30524,7 @@ class CompilerFacadeImpl {
|
|
|
30431
30524
|
type: wrapReference(facade.type),
|
|
30432
30525
|
bootstrap: facade.bootstrap.map(wrapReference),
|
|
30433
30526
|
declarations: facade.declarations.map(wrapReference),
|
|
30434
|
-
publicDeclarationTypes: null,
|
|
30527
|
+
publicDeclarationTypes: null, // only needed for types in AOT
|
|
30435
30528
|
imports: facade.imports.map(wrapReference),
|
|
30436
30529
|
includeImportTypes: true,
|
|
30437
30530
|
exports: facade.exports.map(wrapReference),
|
|
@@ -30971,7 +31064,7 @@ function publishFacade(global) {
|
|
|
30971
31064
|
* @description
|
|
30972
31065
|
* Entry point for all public APIs of the compiler package.
|
|
30973
31066
|
*/
|
|
30974
|
-
const VERSION = new Version('17.0.
|
|
31067
|
+
const VERSION = new Version('17.1.0-next.0');
|
|
30975
31068
|
|
|
30976
31069
|
class CompilerConfig {
|
|
30977
31070
|
constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, preserveWhitespaces, strictInjectionParameters } = {}) {
|
|
@@ -32501,7 +32594,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
32501
32594
|
function compileDeclareClassMetadata(metadata) {
|
|
32502
32595
|
const definitionMap = new DefinitionMap();
|
|
32503
32596
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
32504
|
-
definitionMap.set('version', literal('17.0.
|
|
32597
|
+
definitionMap.set('version', literal('17.1.0-next.0'));
|
|
32505
32598
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32506
32599
|
definitionMap.set('type', metadata.type);
|
|
32507
32600
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32609,7 +32702,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
32609
32702
|
// in 16.1 is actually used.
|
|
32610
32703
|
const minVersion = hasTransformFunctions ? MINIMUM_PARTIAL_LINKER_VERSION$5 : '14.0.0';
|
|
32611
32704
|
definitionMap.set('minVersion', literal(minVersion));
|
|
32612
|
-
definitionMap.set('version', literal('17.0.
|
|
32705
|
+
definitionMap.set('version', literal('17.1.0-next.0'));
|
|
32613
32706
|
// e.g. `type: MyDirective`
|
|
32614
32707
|
definitionMap.set('type', meta.type.value);
|
|
32615
32708
|
if (meta.isStandalone) {
|
|
@@ -32886,7 +32979,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
32886
32979
|
function compileDeclareFactoryFunction(meta) {
|
|
32887
32980
|
const definitionMap = new DefinitionMap();
|
|
32888
32981
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
32889
|
-
definitionMap.set('version', literal('17.0.
|
|
32982
|
+
definitionMap.set('version', literal('17.1.0-next.0'));
|
|
32890
32983
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32891
32984
|
definitionMap.set('type', meta.type.value);
|
|
32892
32985
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -32921,7 +33014,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
32921
33014
|
function createInjectableDefinitionMap(meta) {
|
|
32922
33015
|
const definitionMap = new DefinitionMap();
|
|
32923
33016
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
32924
|
-
definitionMap.set('version', literal('17.0.
|
|
33017
|
+
definitionMap.set('version', literal('17.1.0-next.0'));
|
|
32925
33018
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32926
33019
|
definitionMap.set('type', meta.type.value);
|
|
32927
33020
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -32972,7 +33065,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
32972
33065
|
function createInjectorDefinitionMap(meta) {
|
|
32973
33066
|
const definitionMap = new DefinitionMap();
|
|
32974
33067
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
32975
|
-
definitionMap.set('version', literal('17.0.
|
|
33068
|
+
definitionMap.set('version', literal('17.1.0-next.0'));
|
|
32976
33069
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32977
33070
|
definitionMap.set('type', meta.type.value);
|
|
32978
33071
|
definitionMap.set('providers', meta.providers);
|
|
@@ -33005,7 +33098,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
33005
33098
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
33006
33099
|
}
|
|
33007
33100
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
33008
|
-
definitionMap.set('version', literal('17.0.
|
|
33101
|
+
definitionMap.set('version', literal('17.1.0-next.0'));
|
|
33009
33102
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33010
33103
|
definitionMap.set('type', meta.type.value);
|
|
33011
33104
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -33056,7 +33149,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
33056
33149
|
function createPipeDefinitionMap(meta) {
|
|
33057
33150
|
const definitionMap = new DefinitionMap();
|
|
33058
33151
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
33059
|
-
definitionMap.set('version', literal('17.0.
|
|
33152
|
+
definitionMap.set('version', literal('17.1.0-next.0'));
|
|
33060
33153
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33061
33154
|
// e.g. `type: MyPipe`
|
|
33062
33155
|
definitionMap.set('type', meta.type.value);
|