@angular/compiler 17.1.0-next.1 → 17.1.0-next.2
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/compiler.mjs +2 -1
- 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/api.mjs +1 -1
- package/esm2022/src/render3/view/compiler.mjs +6 -4
- package/esm2022/src/render3/view/t2_api.mjs +1 -1
- package/esm2022/src/render3/view/t2_binder.mjs +6 -7
- package/esm2022/src/render3/view/template.mjs +1 -20
- package/esm2022/src/render3/view/util.mjs +24 -2
- package/esm2022/src/template/pipeline/ir/src/enums.mjs +9 -1
- package/esm2022/src/template/pipeline/ir/src/ops/create.mjs +3 -2
- package/esm2022/src/template/pipeline/src/emit.mjs +1 -3
- package/esm2022/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs +2 -7
- package/esm2022/src/template/pipeline/src/phases/create_i18n_contexts.mjs +20 -6
- package/esm2022/src/template/pipeline/src/phases/extract_i18n_messages.mjs +94 -23
- package/esm2022/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs +3 -2
- package/esm2022/src/template/pipeline/src/phases/resolve_i18n_element_placeholders.mjs +70 -57
- package/esm2022/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs +4 -4
- package/esm2022/src/template/pipeline/src/phases/resolve_i18n_icu_placeholders.mjs +5 -21
- package/esm2022/src/version.mjs +1 -1
- package/fesm2022/compiler.mjs +275 -236
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +21 -1
- package/package.json +2 -2
- package/esm2022/src/template/pipeline/src/phases/merge_i18n_contexts.mjs +0 -59
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.1.0-next.
|
|
2
|
+
* @license Angular v17.1.0-next.2
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -3679,6 +3679,41 @@ function getInjectFn(target) {
|
|
|
3679
3679
|
}
|
|
3680
3680
|
}
|
|
3681
3681
|
|
|
3682
|
+
var TagContentType;
|
|
3683
|
+
(function (TagContentType) {
|
|
3684
|
+
TagContentType[TagContentType["RAW_TEXT"] = 0] = "RAW_TEXT";
|
|
3685
|
+
TagContentType[TagContentType["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
|
|
3686
|
+
TagContentType[TagContentType["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
|
|
3687
|
+
})(TagContentType || (TagContentType = {}));
|
|
3688
|
+
function splitNsName(elementName) {
|
|
3689
|
+
if (elementName[0] != ':') {
|
|
3690
|
+
return [null, elementName];
|
|
3691
|
+
}
|
|
3692
|
+
const colonIndex = elementName.indexOf(':', 1);
|
|
3693
|
+
if (colonIndex === -1) {
|
|
3694
|
+
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
|
3695
|
+
}
|
|
3696
|
+
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
|
3697
|
+
}
|
|
3698
|
+
// `<ng-container>` tags work the same regardless the namespace
|
|
3699
|
+
function isNgContainer(tagName) {
|
|
3700
|
+
return splitNsName(tagName)[1] === 'ng-container';
|
|
3701
|
+
}
|
|
3702
|
+
// `<ng-content>` tags work the same regardless the namespace
|
|
3703
|
+
function isNgContent(tagName) {
|
|
3704
|
+
return splitNsName(tagName)[1] === 'ng-content';
|
|
3705
|
+
}
|
|
3706
|
+
// `<ng-template>` tags work the same regardless the namespace
|
|
3707
|
+
function isNgTemplate(tagName) {
|
|
3708
|
+
return splitNsName(tagName)[1] === 'ng-template';
|
|
3709
|
+
}
|
|
3710
|
+
function getNsPrefix(fullName) {
|
|
3711
|
+
return fullName === null ? null : splitNsName(fullName)[0];
|
|
3712
|
+
}
|
|
3713
|
+
function mergeNsAndName(prefix, localName) {
|
|
3714
|
+
return prefix ? `:${prefix}:${localName}` : localName;
|
|
3715
|
+
}
|
|
3716
|
+
|
|
3682
3717
|
/**
|
|
3683
3718
|
* This is an R3 `Node`-like wrapper for a raw `html.Comment` node. We do not currently
|
|
3684
3719
|
* require the implementation of a visitor for Comments as they are only collected at
|
|
@@ -5019,6 +5054,26 @@ class DefinitionMap {
|
|
|
5019
5054
|
return literalMap(this.values);
|
|
5020
5055
|
}
|
|
5021
5056
|
}
|
|
5057
|
+
/**
|
|
5058
|
+
* Creates a `CssSelector` from an AST node.
|
|
5059
|
+
*/
|
|
5060
|
+
function createCssSelectorFromNode(node) {
|
|
5061
|
+
const elementName = node instanceof Element$1 ? node.name : 'ng-template';
|
|
5062
|
+
const attributes = getAttrsForDirectiveMatching(node);
|
|
5063
|
+
const cssSelector = new CssSelector();
|
|
5064
|
+
const elementNameNoNs = splitNsName(elementName)[1];
|
|
5065
|
+
cssSelector.setElement(elementNameNoNs);
|
|
5066
|
+
Object.getOwnPropertyNames(attributes).forEach((name) => {
|
|
5067
|
+
const nameNoNs = splitNsName(name)[1];
|
|
5068
|
+
const value = attributes[name];
|
|
5069
|
+
cssSelector.addAttribute(nameNoNs, value);
|
|
5070
|
+
if (name.toLowerCase() === 'class') {
|
|
5071
|
+
const classes = value.trim().split(/\s+/);
|
|
5072
|
+
classes.forEach(className => cssSelector.addClassName(className));
|
|
5073
|
+
}
|
|
5074
|
+
});
|
|
5075
|
+
return cssSelector;
|
|
5076
|
+
}
|
|
5022
5077
|
/**
|
|
5023
5078
|
* Extract a map of properties to values for a given element or template node, which can be used
|
|
5024
5079
|
* by the directive matching machinery.
|
|
@@ -9195,6 +9250,14 @@ var DerivedRepeaterVarIdentity;
|
|
|
9195
9250
|
DerivedRepeaterVarIdentity[DerivedRepeaterVarIdentity["Even"] = 2] = "Even";
|
|
9196
9251
|
DerivedRepeaterVarIdentity[DerivedRepeaterVarIdentity["Odd"] = 3] = "Odd";
|
|
9197
9252
|
})(DerivedRepeaterVarIdentity || (DerivedRepeaterVarIdentity = {}));
|
|
9253
|
+
/**
|
|
9254
|
+
* Kinds of i18n contexts. They can be created because of root i18n blocks, or ICUs.
|
|
9255
|
+
*/
|
|
9256
|
+
var I18nContextKind;
|
|
9257
|
+
(function (I18nContextKind) {
|
|
9258
|
+
I18nContextKind[I18nContextKind["RootI18n"] = 0] = "RootI18n";
|
|
9259
|
+
I18nContextKind[I18nContextKind["Icu"] = 1] = "Icu";
|
|
9260
|
+
})(I18nContextKind || (I18nContextKind = {}));
|
|
9198
9261
|
|
|
9199
9262
|
/**
|
|
9200
9263
|
* Marker symbol for `ConsumesSlotOpTrait`.
|
|
@@ -10979,9 +11042,10 @@ function createIcuEndOp(xref) {
|
|
|
10979
11042
|
...NEW_OP,
|
|
10980
11043
|
};
|
|
10981
11044
|
}
|
|
10982
|
-
function createI18nContextOp(xref, i18nBlock, message, sourceSpan) {
|
|
11045
|
+
function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan) {
|
|
10983
11046
|
return {
|
|
10984
11047
|
kind: OpKind.I18nContext,
|
|
11048
|
+
contextKind,
|
|
10985
11049
|
xref,
|
|
10986
11050
|
i18nBlock,
|
|
10987
11051
|
message,
|
|
@@ -11267,7 +11331,6 @@ function needsApplication(i18nContexts, op) {
|
|
|
11267
11331
|
*/
|
|
11268
11332
|
function assignI18nSlotDependencies(job) {
|
|
11269
11333
|
const i18nLastSlotConsumers = new Map();
|
|
11270
|
-
const i18nContexts = new Map();
|
|
11271
11334
|
let lastSlotConsumer = null;
|
|
11272
11335
|
let currentI18nOp = null;
|
|
11273
11336
|
for (const unit of job.units) {
|
|
@@ -11284,16 +11347,12 @@ function assignI18nSlotDependencies(job) {
|
|
|
11284
11347
|
i18nLastSlotConsumers.set(currentI18nOp.xref, lastSlotConsumer);
|
|
11285
11348
|
currentI18nOp = null;
|
|
11286
11349
|
break;
|
|
11287
|
-
case OpKind.I18nContext:
|
|
11288
|
-
i18nContexts.set(op.xref, op);
|
|
11289
|
-
break;
|
|
11290
11350
|
}
|
|
11291
11351
|
}
|
|
11292
11352
|
// Assign i18n expressions to target the last slot in its owning block.
|
|
11293
11353
|
for (const op of unit.update) {
|
|
11294
11354
|
if (op.kind === OpKind.I18nExpression) {
|
|
11295
|
-
|
|
11296
|
-
op.target = i18nLastSlotConsumers.get(i18nContext.i18nBlock);
|
|
11355
|
+
op.target = i18nLastSlotConsumers.get(op.target);
|
|
11297
11356
|
}
|
|
11298
11357
|
}
|
|
11299
11358
|
}
|
|
@@ -11624,41 +11683,6 @@ function generateConditionalExpressions(job) {
|
|
|
11624
11683
|
}
|
|
11625
11684
|
}
|
|
11626
11685
|
|
|
11627
|
-
var TagContentType;
|
|
11628
|
-
(function (TagContentType) {
|
|
11629
|
-
TagContentType[TagContentType["RAW_TEXT"] = 0] = "RAW_TEXT";
|
|
11630
|
-
TagContentType[TagContentType["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
|
|
11631
|
-
TagContentType[TagContentType["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
|
|
11632
|
-
})(TagContentType || (TagContentType = {}));
|
|
11633
|
-
function splitNsName(elementName) {
|
|
11634
|
-
if (elementName[0] != ':') {
|
|
11635
|
-
return [null, elementName];
|
|
11636
|
-
}
|
|
11637
|
-
const colonIndex = elementName.indexOf(':', 1);
|
|
11638
|
-
if (colonIndex === -1) {
|
|
11639
|
-
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
|
11640
|
-
}
|
|
11641
|
-
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
|
11642
|
-
}
|
|
11643
|
-
// `<ng-container>` tags work the same regardless the namespace
|
|
11644
|
-
function isNgContainer(tagName) {
|
|
11645
|
-
return splitNsName(tagName)[1] === 'ng-container';
|
|
11646
|
-
}
|
|
11647
|
-
// `<ng-content>` tags work the same regardless the namespace
|
|
11648
|
-
function isNgContent(tagName) {
|
|
11649
|
-
return splitNsName(tagName)[1] === 'ng-content';
|
|
11650
|
-
}
|
|
11651
|
-
// `<ng-template>` tags work the same regardless the namespace
|
|
11652
|
-
function isNgTemplate(tagName) {
|
|
11653
|
-
return splitNsName(tagName)[1] === 'ng-template';
|
|
11654
|
-
}
|
|
11655
|
-
function getNsPrefix(fullName) {
|
|
11656
|
-
return fullName === null ? null : splitNsName(fullName)[0];
|
|
11657
|
-
}
|
|
11658
|
-
function mergeNsAndName(prefix, localName) {
|
|
11659
|
-
return prefix ? `:${prefix}:${localName}` : localName;
|
|
11660
|
-
}
|
|
11661
|
-
|
|
11662
11686
|
const BINARY_OPERATORS = new Map([
|
|
11663
11687
|
['&&', BinaryOperator.And],
|
|
11664
11688
|
['>', BinaryOperator.Bigger],
|
|
@@ -11902,17 +11926,22 @@ function createDeferDepsFns(job) {
|
|
|
11902
11926
|
* message.)
|
|
11903
11927
|
*/
|
|
11904
11928
|
function createI18nContexts(job) {
|
|
11929
|
+
const rootContexts = new Map();
|
|
11905
11930
|
let currentI18nOp = null;
|
|
11906
11931
|
let xref;
|
|
11907
11932
|
for (const unit of job.units) {
|
|
11908
11933
|
for (const op of unit.create) {
|
|
11909
11934
|
switch (op.kind) {
|
|
11910
11935
|
case OpKind.I18nStart:
|
|
11911
|
-
// Each i18n block gets its own context.
|
|
11912
|
-
xref = job.allocateXrefId();
|
|
11913
|
-
unit.create.push(createI18nContextOp(xref, op.xref, op.message, null));
|
|
11914
|
-
op.context = xref;
|
|
11915
11936
|
currentI18nOp = op;
|
|
11937
|
+
// Each root i18n block gets its own context, child ones refer to the context for their
|
|
11938
|
+
// root block.
|
|
11939
|
+
if (op.xref === op.root) {
|
|
11940
|
+
xref = job.allocateXrefId();
|
|
11941
|
+
unit.create.push(createI18nContextOp(I18nContextKind.RootI18n, xref, op.xref, op.message, null));
|
|
11942
|
+
op.context = xref;
|
|
11943
|
+
rootContexts.set(op.xref, xref);
|
|
11944
|
+
}
|
|
11916
11945
|
break;
|
|
11917
11946
|
case OpKind.I18nEnd:
|
|
11918
11947
|
currentI18nOp = null;
|
|
@@ -11926,7 +11955,7 @@ function createI18nContexts(job) {
|
|
|
11926
11955
|
if (op.message.id !== currentI18nOp.message.id) {
|
|
11927
11956
|
// There was an enclosing i18n block around this ICU somewhere.
|
|
11928
11957
|
xref = job.allocateXrefId();
|
|
11929
|
-
unit.create.push(createI18nContextOp(xref, currentI18nOp.xref, op.message, null));
|
|
11958
|
+
unit.create.push(createI18nContextOp(I18nContextKind.Icu, xref, currentI18nOp.xref, op.message, null));
|
|
11930
11959
|
op.context = xref;
|
|
11931
11960
|
}
|
|
11932
11961
|
else {
|
|
@@ -11938,6 +11967,15 @@ function createI18nContexts(job) {
|
|
|
11938
11967
|
}
|
|
11939
11968
|
}
|
|
11940
11969
|
}
|
|
11970
|
+
// Assign contexts to child i18n blocks, now that all root i18n blocks have their context
|
|
11971
|
+
// assigned.
|
|
11972
|
+
for (const unit of job.units) {
|
|
11973
|
+
for (const op of unit.create) {
|
|
11974
|
+
if (op.kind === OpKind.I18nStart && op.xref !== op.root) {
|
|
11975
|
+
op.context = rootContexts.get(op.root);
|
|
11976
|
+
}
|
|
11977
|
+
}
|
|
11978
|
+
}
|
|
11941
11979
|
}
|
|
11942
11980
|
|
|
11943
11981
|
/**
|
|
@@ -12320,11 +12358,9 @@ const LIST_DELIMITER = '|';
|
|
|
12320
12358
|
* used in the final output.
|
|
12321
12359
|
*/
|
|
12322
12360
|
function extractI18nMessages(job) {
|
|
12323
|
-
// Save the i18n context ops for later use.
|
|
12361
|
+
// Save the i18n start and i18n context ops for later use.
|
|
12324
12362
|
const i18nContexts = new Map();
|
|
12325
|
-
|
|
12326
|
-
// created from ICUs).
|
|
12327
|
-
const i18nBlockContexts = new Set();
|
|
12363
|
+
const i18nBlocks = new Map();
|
|
12328
12364
|
for (const unit of job.units) {
|
|
12329
12365
|
for (const op of unit.create) {
|
|
12330
12366
|
switch (op.kind) {
|
|
@@ -12332,7 +12368,7 @@ function extractI18nMessages(job) {
|
|
|
12332
12368
|
i18nContexts.set(op.xref, op);
|
|
12333
12369
|
break;
|
|
12334
12370
|
case OpKind.I18nStart:
|
|
12335
|
-
|
|
12371
|
+
i18nBlocks.set(op.xref, op);
|
|
12336
12372
|
break;
|
|
12337
12373
|
}
|
|
12338
12374
|
}
|
|
@@ -12359,11 +12395,12 @@ function extractI18nMessages(job) {
|
|
|
12359
12395
|
if (!op.context) {
|
|
12360
12396
|
throw Error('ICU op should have its context set.');
|
|
12361
12397
|
}
|
|
12362
|
-
|
|
12363
|
-
|
|
12398
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
12399
|
+
if (i18nContext.contextKind === I18nContextKind.Icu) {
|
|
12364
12400
|
const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
|
|
12365
12401
|
unit.create.push(subMessage);
|
|
12366
|
-
const
|
|
12402
|
+
const rootI18nId = i18nBlocks.get(i18nContext.i18nBlock).root;
|
|
12403
|
+
const parentMessage = i18nBlockMessages.get(rootI18nId);
|
|
12367
12404
|
parentMessage?.subMessages.push(subMessage.xref);
|
|
12368
12405
|
}
|
|
12369
12406
|
OpList.remove(op);
|
|
@@ -12379,38 +12416,110 @@ function extractI18nMessages(job) {
|
|
|
12379
12416
|
* Create an i18n message op from an i18n context op.
|
|
12380
12417
|
*/
|
|
12381
12418
|
function createI18nMessage(job, context, messagePlaceholder) {
|
|
12382
|
-
let needsPostprocessing = context.
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
}
|
|
12387
|
-
}
|
|
12388
|
-
return createI18nMessageOp(job.allocateXrefId(), context.i18nBlock, context.message, messagePlaceholder ?? null, formatParams(context.params), formatParams(context.postprocessingParams), needsPostprocessing);
|
|
12419
|
+
let [formattedParams, needsPostprocessing] = formatParams(context.params);
|
|
12420
|
+
const [formattedPostprocessingParams] = formatParams(context.postprocessingParams);
|
|
12421
|
+
needsPostprocessing ||= formattedPostprocessingParams.size > 0;
|
|
12422
|
+
return createI18nMessageOp(job.allocateXrefId(), context.i18nBlock, context.message, messagePlaceholder ?? null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
|
|
12389
12423
|
}
|
|
12390
12424
|
/**
|
|
12391
12425
|
* Formats a map of `I18nParamValue[]` values into a map of `Expression` values.
|
|
12426
|
+
* @return A tuple of the formatted params and a boolean indicating whether postprocessing is needed
|
|
12427
|
+
* for any of the params
|
|
12392
12428
|
*/
|
|
12393
12429
|
function formatParams(params) {
|
|
12394
|
-
const
|
|
12430
|
+
const formattedParams = new Map();
|
|
12431
|
+
let needsPostprocessing = false;
|
|
12395
12432
|
for (const [placeholder, placeholderValues] of params) {
|
|
12396
|
-
const serializedValues = formatParamValues(placeholderValues);
|
|
12433
|
+
const [serializedValues, paramNeedsPostprocessing] = formatParamValues(placeholderValues);
|
|
12434
|
+
needsPostprocessing ||= paramNeedsPostprocessing;
|
|
12397
12435
|
if (serializedValues !== null) {
|
|
12398
|
-
|
|
12436
|
+
formattedParams.set(placeholder, literal(serializedValues));
|
|
12399
12437
|
}
|
|
12400
12438
|
}
|
|
12401
|
-
return
|
|
12439
|
+
return [formattedParams, needsPostprocessing];
|
|
12402
12440
|
}
|
|
12403
12441
|
/**
|
|
12404
12442
|
* Formats an `I18nParamValue[]` into a string (or null for empty array).
|
|
12443
|
+
* @return A tuple of the formatted value and a boolean indicating whether postprocessing is needed
|
|
12444
|
+
* for the value
|
|
12405
12445
|
*/
|
|
12406
12446
|
function formatParamValues(values) {
|
|
12407
12447
|
if (values.length === 0) {
|
|
12408
|
-
return null;
|
|
12448
|
+
return [null, false];
|
|
12409
12449
|
}
|
|
12450
|
+
collapseElementTemplatePairs(values);
|
|
12410
12451
|
const serializedValues = values.map(value => formatValue(value));
|
|
12411
12452
|
return serializedValues.length === 1 ?
|
|
12412
|
-
serializedValues[0] :
|
|
12413
|
-
`${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}
|
|
12453
|
+
[serializedValues[0], false] :
|
|
12454
|
+
[`${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`, true];
|
|
12455
|
+
}
|
|
12456
|
+
/**
|
|
12457
|
+
* Collapses element/template pairs that refer to the same subTemplateIndex, i.e. elements and
|
|
12458
|
+
* templates that refer to the same element instance.
|
|
12459
|
+
*
|
|
12460
|
+
* This accounts for the case of a structural directive inside an i18n block, e.g.:
|
|
12461
|
+
* ```
|
|
12462
|
+
* <div i18n>
|
|
12463
|
+
* <div *ngIf="condition">
|
|
12464
|
+
* </div>
|
|
12465
|
+
* ```
|
|
12466
|
+
*
|
|
12467
|
+
* In this case, both the element start and template start placeholders are the same,
|
|
12468
|
+
* and we collapse them down into a single compound placeholder value. Rather than produce
|
|
12469
|
+
* `[\uFFFD#1:1\uFFFD|\uFFFD*2:1\uFFFD]`, we want to produce `\uFFFD#1:1\uFFFD\uFFFD*2:1\uFFFD`,
|
|
12470
|
+
* likewise for the closing of the element/template.
|
|
12471
|
+
*/
|
|
12472
|
+
function collapseElementTemplatePairs(values) {
|
|
12473
|
+
// Record the indicies of element and template values in the values array by subTemplateIndex.
|
|
12474
|
+
const valueIndiciesBySubTemplateIndex = new Map();
|
|
12475
|
+
for (let i = 0; i < values.length; i++) {
|
|
12476
|
+
const value = values[i];
|
|
12477
|
+
if (value.subTemplateIndex !== null &&
|
|
12478
|
+
(value.flags & (I18nParamValueFlags.ElementTag | I18nParamValueFlags.TemplateTag))) {
|
|
12479
|
+
const valueIndicies = valueIndiciesBySubTemplateIndex.get(value.subTemplateIndex) ?? [];
|
|
12480
|
+
valueIndicies.push(i);
|
|
12481
|
+
valueIndiciesBySubTemplateIndex.set(value.subTemplateIndex, valueIndicies);
|
|
12482
|
+
}
|
|
12483
|
+
}
|
|
12484
|
+
// For each subTemplateIndex, check if any values can be collapsed.
|
|
12485
|
+
for (const [subTemplateIndex, valueIndicies] of valueIndiciesBySubTemplateIndex) {
|
|
12486
|
+
if (valueIndicies.length > 1) {
|
|
12487
|
+
const elementIndex = valueIndicies.find(index => values[index].flags & I18nParamValueFlags.ElementTag);
|
|
12488
|
+
const templateIndex = valueIndicies.find(index => values[index].flags & I18nParamValueFlags.TemplateTag);
|
|
12489
|
+
// If the values list contains both an element and template value, we can collapse.
|
|
12490
|
+
if (elementIndex !== undefined && templateIndex !== undefined) {
|
|
12491
|
+
const elementValue = values[elementIndex];
|
|
12492
|
+
const templateValue = values[templateIndex];
|
|
12493
|
+
// To match the TemplateDefinitionBuilder output, flip the order depending on whether the
|
|
12494
|
+
// values represent a closing or opening tag (or both).
|
|
12495
|
+
// TODO(mmalerba): Figure out if this makes a difference in terms of either functionality,
|
|
12496
|
+
// or the resulting message ID. If not, we can remove the special-casing in the future.
|
|
12497
|
+
let compundValue;
|
|
12498
|
+
if ((elementValue.flags & I18nParamValueFlags.OpenTag) &&
|
|
12499
|
+
(elementValue.flags & I18nParamValueFlags.CloseTag)) {
|
|
12500
|
+
// TODO(mmalerba): Is this a TDB bug? I don't understand why it would put the template
|
|
12501
|
+
// value twice.
|
|
12502
|
+
compundValue = `${formatValue(templateValue)}${formatValue(elementValue)}${formatValue(templateValue)}`;
|
|
12503
|
+
}
|
|
12504
|
+
else if (elementValue.flags & I18nParamValueFlags.OpenTag) {
|
|
12505
|
+
compundValue = `${formatValue(templateValue)}${formatValue(elementValue)}`;
|
|
12506
|
+
}
|
|
12507
|
+
else {
|
|
12508
|
+
compundValue = `${formatValue(elementValue)}${formatValue(templateValue)}`;
|
|
12509
|
+
}
|
|
12510
|
+
// Replace the element value with the combined value.
|
|
12511
|
+
values.splice(elementIndex, 1, { value: compundValue, subTemplateIndex, flags: I18nParamValueFlags.None });
|
|
12512
|
+
// Replace the template value with null to preserve the indicies we calculated earlier.
|
|
12513
|
+
values.splice(templateIndex, 1, null);
|
|
12514
|
+
}
|
|
12515
|
+
}
|
|
12516
|
+
}
|
|
12517
|
+
// Strip out any nulled out values we introduced above.
|
|
12518
|
+
for (let i = values.length - 1; i >= 0; i--) {
|
|
12519
|
+
if (values[i] === null) {
|
|
12520
|
+
values.splice(i, 1);
|
|
12521
|
+
}
|
|
12522
|
+
}
|
|
12414
12523
|
}
|
|
12415
12524
|
/**
|
|
12416
12525
|
* Formats a single `I18nParamValue` into a string
|
|
@@ -19938,57 +20047,6 @@ function serializeLocalRefs(refs) {
|
|
|
19938
20047
|
return literalArr(constRefs);
|
|
19939
20048
|
}
|
|
19940
20049
|
|
|
19941
|
-
/**
|
|
19942
|
-
* Merge i18n contexts for child i18n blocks into their ancestor root contexts.
|
|
19943
|
-
*/
|
|
19944
|
-
function mergeI18nContexts(job) {
|
|
19945
|
-
// Record all of the i18n and extracted message ops for use later.
|
|
19946
|
-
const i18nOps = new Map();
|
|
19947
|
-
const i18nContexts = new Map();
|
|
19948
|
-
for (const unit of job.units) {
|
|
19949
|
-
for (const op of unit.create) {
|
|
19950
|
-
switch (op.kind) {
|
|
19951
|
-
case OpKind.I18nStart:
|
|
19952
|
-
if (!op.context) {
|
|
19953
|
-
throw Error('I18n op should have its context set.');
|
|
19954
|
-
}
|
|
19955
|
-
i18nOps.set(op.xref, op);
|
|
19956
|
-
break;
|
|
19957
|
-
case OpKind.I18nContext:
|
|
19958
|
-
i18nContexts.set(op.xref, op);
|
|
19959
|
-
break;
|
|
19960
|
-
}
|
|
19961
|
-
}
|
|
19962
|
-
}
|
|
19963
|
-
// For each non-root i18n op, merge its context into the root i18n op's context.
|
|
19964
|
-
for (const childI18nOp of i18nOps.values()) {
|
|
19965
|
-
if (childI18nOp.xref !== childI18nOp.root) {
|
|
19966
|
-
const childContext = i18nContexts.get(childI18nOp.context);
|
|
19967
|
-
const rootI18nOp = i18nOps.get(childI18nOp.root);
|
|
19968
|
-
const rootContext = i18nContexts.get(rootI18nOp.context);
|
|
19969
|
-
mergeParams(rootContext.params, childContext.params);
|
|
19970
|
-
mergeParams(rootContext.postprocessingParams, childContext.postprocessingParams);
|
|
19971
|
-
}
|
|
19972
|
-
}
|
|
19973
|
-
}
|
|
19974
|
-
/**
|
|
19975
|
-
* Merges the params in the `from` map to into the `to` map.
|
|
19976
|
-
*/
|
|
19977
|
-
function mergeParams(to, from) {
|
|
19978
|
-
for (const [placeholder, fromValues] of from) {
|
|
19979
|
-
const toValues = to.get(placeholder) || [];
|
|
19980
|
-
// TODO(mmalerba): Child element close tag params should be prepended to maintain the same order
|
|
19981
|
-
// as TemplateDefinitionBuilder. Can be cleaned up when compatibility is no longer required.
|
|
19982
|
-
const flags = fromValues[0].flags;
|
|
19983
|
-
if ((flags & I18nParamValueFlags.CloseTag) && !(flags & I18nParamValueFlags.OpenTag)) {
|
|
19984
|
-
to.set(placeholder, [...fromValues, ...toValues]);
|
|
19985
|
-
}
|
|
19986
|
-
else {
|
|
19987
|
-
to.set(placeholder, [...toValues, ...fromValues]);
|
|
19988
|
-
}
|
|
19989
|
-
}
|
|
19990
|
-
}
|
|
19991
|
-
|
|
19992
20050
|
/**
|
|
19993
20051
|
* Change namespaces between HTML, SVG and MathML, depending on the next element.
|
|
19994
20052
|
*/
|
|
@@ -20652,9 +20710,10 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
|
|
|
20652
20710
|
wrapTemplateWithI18n(templateView, i18nBlock);
|
|
20653
20711
|
}
|
|
20654
20712
|
// Continue traversing inside the template's view.
|
|
20655
|
-
propagateI18nBlocksToTemplates(templateView, subTemplateIndex);
|
|
20713
|
+
subTemplateIndex = propagateI18nBlocksToTemplates(templateView, subTemplateIndex);
|
|
20656
20714
|
}
|
|
20657
20715
|
}
|
|
20716
|
+
return subTemplateIndex;
|
|
20658
20717
|
}
|
|
20659
20718
|
/**
|
|
20660
20719
|
* Wraps a template view with i18n start and end ops.
|
|
@@ -21834,66 +21893,79 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
21834
21893
|
}
|
|
21835
21894
|
}
|
|
21836
21895
|
}
|
|
21837
|
-
|
|
21838
|
-
|
|
21839
|
-
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21896
|
+
resolvePlaceholdersForView(job, job.root, i18nContexts, elements);
|
|
21897
|
+
}
|
|
21898
|
+
function resolvePlaceholdersForView(job, unit, i18nContexts, elements) {
|
|
21899
|
+
// Track the current i18n op and corresponding i18n context op as we step through the creation
|
|
21900
|
+
// IR.
|
|
21901
|
+
let currentOps = null;
|
|
21902
|
+
for (const op of unit.create) {
|
|
21903
|
+
switch (op.kind) {
|
|
21904
|
+
case OpKind.I18nStart:
|
|
21905
|
+
if (!op.context) {
|
|
21906
|
+
throw Error('Could not find i18n context for i18n op');
|
|
21907
|
+
}
|
|
21908
|
+
currentOps = { i18nBlock: op, i18nContext: i18nContexts.get(op.context) };
|
|
21909
|
+
break;
|
|
21910
|
+
case OpKind.I18nEnd:
|
|
21911
|
+
currentOps = null;
|
|
21912
|
+
break;
|
|
21913
|
+
case OpKind.ElementStart:
|
|
21914
|
+
// For elements with i18n placeholders, record its slot value in the params map under the
|
|
21915
|
+
// corresponding tag start placeholder.
|
|
21916
|
+
if (op.i18nPlaceholder !== undefined) {
|
|
21917
|
+
if (currentOps === null) {
|
|
21918
|
+
throw Error('i18n tag placeholder should only occur inside an i18n block');
|
|
21846
21919
|
}
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21853
|
-
// For elements with i18n placeholders, record its slot value in the params map under the
|
|
21854
|
-
// corresponding tag start placeholder.
|
|
21855
|
-
if (op.i18nPlaceholder !== undefined) {
|
|
21856
|
-
if (currentOps === null) {
|
|
21857
|
-
throw Error('i18n tag placeholder should only occur inside an i18n block');
|
|
21858
|
-
}
|
|
21859
|
-
const { startName, closeName } = op.i18nPlaceholder;
|
|
21860
|
-
let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.OpenTag;
|
|
21861
|
-
// For self-closing tags, there is no close tag placeholder. Instead, the start tag
|
|
21862
|
-
// placeholder accounts for the start and close of the element.
|
|
21863
|
-
if (closeName === '') {
|
|
21864
|
-
flags |= I18nParamValueFlags.CloseTag;
|
|
21865
|
-
}
|
|
21866
|
-
addParam(currentOps.i18nContext.params, startName, op.handle.slot, currentOps.i18nBlock.subTemplateIndex, flags);
|
|
21920
|
+
const { startName, closeName } = op.i18nPlaceholder;
|
|
21921
|
+
let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.OpenTag;
|
|
21922
|
+
// For self-closing tags, there is no close tag placeholder. Instead, the start tag
|
|
21923
|
+
// placeholder accounts for the start and close of the element.
|
|
21924
|
+
if (closeName === '') {
|
|
21925
|
+
flags |= I18nParamValueFlags.CloseTag;
|
|
21867
21926
|
}
|
|
21868
|
-
|
|
21869
|
-
|
|
21870
|
-
|
|
21871
|
-
|
|
21872
|
-
|
|
21873
|
-
|
|
21874
|
-
|
|
21875
|
-
|
|
21876
|
-
|
|
21877
|
-
|
|
21878
|
-
// Self-closing tags don't have a closing tag placeholder.
|
|
21879
|
-
if (closeName !== '') {
|
|
21880
|
-
addParam(currentOps.i18nContext.params, closeName, startOp.handle.slot, currentOps.i18nBlock.subTemplateIndex, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
|
|
21881
|
-
}
|
|
21927
|
+
addParam(currentOps.i18nContext.params, startName, op.handle.slot, currentOps.i18nBlock.subTemplateIndex, flags);
|
|
21928
|
+
}
|
|
21929
|
+
break;
|
|
21930
|
+
case OpKind.ElementEnd:
|
|
21931
|
+
// For elements with i18n placeholders, record its slot value in the params map under the
|
|
21932
|
+
// corresponding tag close placeholder.
|
|
21933
|
+
const startOp = elements.get(op.xref);
|
|
21934
|
+
if (startOp && startOp.i18nPlaceholder !== undefined) {
|
|
21935
|
+
if (currentOps === null) {
|
|
21936
|
+
throw Error('i18n tag placeholder should only occur inside an i18n block');
|
|
21882
21937
|
}
|
|
21883
|
-
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
21887
|
-
if (op.i18nPlaceholder !== undefined) {
|
|
21888
|
-
if (currentOps === null) {
|
|
21889
|
-
throw Error('i18n tag placeholder should only occur inside an i18n block');
|
|
21890
|
-
}
|
|
21891
|
-
const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.i18nBlock, op);
|
|
21892
|
-
addParam(currentOps.i18nContext.params, op.i18nPlaceholder.startName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag);
|
|
21893
|
-
addParam(currentOps.i18nContext.params, op.i18nPlaceholder.closeName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
|
|
21938
|
+
const { closeName } = startOp.i18nPlaceholder;
|
|
21939
|
+
// Self-closing tags don't have a closing tag placeholder.
|
|
21940
|
+
if (closeName !== '') {
|
|
21941
|
+
addParam(currentOps.i18nContext.params, closeName, startOp.handle.slot, currentOps.i18nBlock.subTemplateIndex, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
|
|
21894
21942
|
}
|
|
21895
|
-
|
|
21896
|
-
|
|
21943
|
+
}
|
|
21944
|
+
break;
|
|
21945
|
+
case OpKind.Template:
|
|
21946
|
+
// For templates with i18n placeholders, record its slot value in the params map under the
|
|
21947
|
+
// corresponding template start and close placeholders.
|
|
21948
|
+
if (op.i18nPlaceholder !== undefined) {
|
|
21949
|
+
if (currentOps === null) {
|
|
21950
|
+
throw Error('i18n tag placeholder should only occur inside an i18n block');
|
|
21951
|
+
}
|
|
21952
|
+
let startFlags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.OpenTag;
|
|
21953
|
+
const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.i18nBlock, op);
|
|
21954
|
+
const { startName, closeName } = op.i18nPlaceholder;
|
|
21955
|
+
const isSelfClosing = closeName === '';
|
|
21956
|
+
if (isSelfClosing) {
|
|
21957
|
+
startFlags |= I18nParamValueFlags.CloseTag;
|
|
21958
|
+
}
|
|
21959
|
+
addParam(currentOps.i18nContext.params, startName, op.handle.slot, subTemplateIndex, startFlags);
|
|
21960
|
+
resolvePlaceholdersForView(job, job.views.get(op.xref), i18nContexts, elements);
|
|
21961
|
+
if (!isSelfClosing) {
|
|
21962
|
+
addParam(currentOps.i18nContext.params, closeName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
|
|
21963
|
+
}
|
|
21964
|
+
}
|
|
21965
|
+
else {
|
|
21966
|
+
resolvePlaceholdersForView(job, job.views.get(op.xref), i18nContexts, elements);
|
|
21967
|
+
}
|
|
21968
|
+
break;
|
|
21897
21969
|
}
|
|
21898
21970
|
}
|
|
21899
21971
|
}
|
|
@@ -21941,8 +22013,8 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
21941
22013
|
for (const op of unit.update) {
|
|
21942
22014
|
if (op.kind === OpKind.I18nExpression) {
|
|
21943
22015
|
const i18nContext = i18nContexts.get(op.context);
|
|
21944
|
-
const index = expressionIndices.get(
|
|
21945
|
-
const subTemplateIndex = subTemplateIndicies.get(
|
|
22016
|
+
const index = expressionIndices.get(op.target) || 0;
|
|
22017
|
+
const subTemplateIndex = subTemplateIndicies.get(op.target);
|
|
21946
22018
|
// Add the expression index in the appropriate params map.
|
|
21947
22019
|
const params = op.resolutionTime === I18nParamResolutionTime.Creation ?
|
|
21948
22020
|
i18nContext.params :
|
|
@@ -21954,7 +22026,7 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
21954
22026
|
flags: I18nParamValueFlags.ExpressionIndex
|
|
21955
22027
|
});
|
|
21956
22028
|
params.set(op.i18nPlaceholder, values);
|
|
21957
|
-
expressionIndices.set(
|
|
22029
|
+
expressionIndices.set(op.target, index + 1);
|
|
21958
22030
|
}
|
|
21959
22031
|
}
|
|
21960
22032
|
}
|
|
@@ -21964,28 +22036,12 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
21964
22036
|
* Resolves placeholders for element tags inside of an ICU.
|
|
21965
22037
|
*/
|
|
21966
22038
|
function resolveI18nIcuPlaceholders(job) {
|
|
21967
|
-
const contextOps = new Map();
|
|
21968
|
-
for (const unit of job.units) {
|
|
21969
|
-
for (const op of unit.create) {
|
|
21970
|
-
switch (op.kind) {
|
|
21971
|
-
case OpKind.I18nContext:
|
|
21972
|
-
contextOps.set(op.xref, op);
|
|
21973
|
-
break;
|
|
21974
|
-
}
|
|
21975
|
-
}
|
|
21976
|
-
}
|
|
21977
22039
|
for (const unit of job.units) {
|
|
21978
22040
|
for (const op of unit.create) {
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
}
|
|
21984
|
-
const i18nContext = contextOps.get(op.context);
|
|
21985
|
-
for (const node of op.message.nodes) {
|
|
21986
|
-
node.visit(new ResolveIcuPlaceholdersVisitor(i18nContext.postprocessingParams));
|
|
21987
|
-
}
|
|
21988
|
-
break;
|
|
22041
|
+
if (op.kind === OpKind.I18nContext && op.contextKind === I18nContextKind.Icu) {
|
|
22042
|
+
for (const node of op.message.nodes) {
|
|
22043
|
+
node.visit(new ResolveIcuPlaceholdersVisitor(op.postprocessingParams));
|
|
22044
|
+
}
|
|
21989
22045
|
}
|
|
21990
22046
|
}
|
|
21991
22047
|
}
|
|
@@ -23155,7 +23211,6 @@ const phases = [
|
|
|
23155
23211
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
23156
23212
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
23157
23213
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
|
|
23158
|
-
{ kind: CompilationJobKind.Tmpl, fn: mergeI18nContexts },
|
|
23159
23214
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
23160
23215
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
|
|
23161
23216
|
{ kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
|
|
@@ -28749,24 +28804,6 @@ class TrackByBindingScope extends BindingScope {
|
|
|
28749
28804
|
return this.componentAccessCount;
|
|
28750
28805
|
}
|
|
28751
28806
|
}
|
|
28752
|
-
/**
|
|
28753
|
-
* Creates a `CssSelector` given a tag name and a map of attributes
|
|
28754
|
-
*/
|
|
28755
|
-
function createCssSelector(elementName, attributes) {
|
|
28756
|
-
const cssSelector = new CssSelector();
|
|
28757
|
-
const elementNameNoNs = splitNsName(elementName)[1];
|
|
28758
|
-
cssSelector.setElement(elementNameNoNs);
|
|
28759
|
-
Object.getOwnPropertyNames(attributes).forEach((name) => {
|
|
28760
|
-
const nameNoNs = splitNsName(name)[1];
|
|
28761
|
-
const value = attributes[name];
|
|
28762
|
-
cssSelector.addAttribute(nameNoNs, value);
|
|
28763
|
-
if (name.toLowerCase() === 'class') {
|
|
28764
|
-
const classes = value.trim().split(/\s+/);
|
|
28765
|
-
classes.forEach(className => cssSelector.addClassName(className));
|
|
28766
|
-
}
|
|
28767
|
-
});
|
|
28768
|
-
return cssSelector;
|
|
28769
|
-
}
|
|
28770
28807
|
/**
|
|
28771
28808
|
* Creates an array of expressions out of an `ngProjectAs` attributes
|
|
28772
28809
|
* which can be added to the instruction parameters.
|
|
@@ -29127,6 +29164,11 @@ function addFeatures(definitionMap, meta) {
|
|
|
29127
29164
|
break;
|
|
29128
29165
|
}
|
|
29129
29166
|
}
|
|
29167
|
+
// Note: host directives feature needs to be inserted before the
|
|
29168
|
+
// inheritance feature to ensure the correct execution order.
|
|
29169
|
+
if (meta.hostDirectives?.length) {
|
|
29170
|
+
features.push(importExpr(Identifiers.HostDirectivesFeature).callFn([createHostDirectivesFeatureArg(meta.hostDirectives)]));
|
|
29171
|
+
}
|
|
29130
29172
|
if (meta.usesInheritance) {
|
|
29131
29173
|
features.push(importExpr(Identifiers.InheritDefinitionFeature));
|
|
29132
29174
|
}
|
|
@@ -29140,9 +29182,6 @@ function addFeatures(definitionMap, meta) {
|
|
|
29140
29182
|
if (meta.hasOwnProperty('template') && meta.isStandalone) {
|
|
29141
29183
|
features.push(importExpr(Identifiers.StandaloneFeature));
|
|
29142
29184
|
}
|
|
29143
|
-
if (meta.hostDirectives?.length) {
|
|
29144
|
-
features.push(importExpr(Identifiers.HostDirectivesFeature).callFn([createHostDirectivesFeatureArg(meta.hostDirectives)]));
|
|
29145
|
-
}
|
|
29146
29185
|
if (features.length) {
|
|
29147
29186
|
definitionMap.set('features', literalArr(features));
|
|
29148
29187
|
}
|
|
@@ -30103,15 +30142,15 @@ class DirectiveBinder {
|
|
|
30103
30142
|
template.forEach(node => node.visit(this));
|
|
30104
30143
|
}
|
|
30105
30144
|
visitElement(element) {
|
|
30106
|
-
this.visitElementOrTemplate(element
|
|
30145
|
+
this.visitElementOrTemplate(element);
|
|
30107
30146
|
}
|
|
30108
30147
|
visitTemplate(template) {
|
|
30109
|
-
this.visitElementOrTemplate(
|
|
30148
|
+
this.visitElementOrTemplate(template);
|
|
30110
30149
|
}
|
|
30111
|
-
visitElementOrTemplate(
|
|
30150
|
+
visitElementOrTemplate(node) {
|
|
30112
30151
|
// First, determine the HTML shape of the node for the purpose of directive matching.
|
|
30113
30152
|
// Do this by building up a `CssSelector` for the node.
|
|
30114
|
-
const cssSelector =
|
|
30153
|
+
const cssSelector = createCssSelectorFromNode(node);
|
|
30115
30154
|
// Next, use the `SelectorMatcher` to get the list of directives on the node.
|
|
30116
30155
|
const directives = [];
|
|
30117
30156
|
this.matcher.match(cssSelector, (_selector, results) => directives.push(...results));
|
|
@@ -31240,7 +31279,7 @@ function publishFacade(global) {
|
|
|
31240
31279
|
* @description
|
|
31241
31280
|
* Entry point for all public APIs of the compiler package.
|
|
31242
31281
|
*/
|
|
31243
|
-
const VERSION = new Version('17.1.0-next.
|
|
31282
|
+
const VERSION = new Version('17.1.0-next.2');
|
|
31244
31283
|
|
|
31245
31284
|
class CompilerConfig {
|
|
31246
31285
|
constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, preserveWhitespaces, strictInjectionParameters } = {}) {
|
|
@@ -32806,7 +32845,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
32806
32845
|
function compileDeclareClassMetadata(metadata) {
|
|
32807
32846
|
const definitionMap = new DefinitionMap();
|
|
32808
32847
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
32809
|
-
definitionMap.set('version', literal('17.1.0-next.
|
|
32848
|
+
definitionMap.set('version', literal('17.1.0-next.2'));
|
|
32810
32849
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32811
32850
|
definitionMap.set('type', metadata.type);
|
|
32812
32851
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32914,7 +32953,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
32914
32953
|
// in 16.1 is actually used.
|
|
32915
32954
|
const minVersion = hasTransformFunctions ? MINIMUM_PARTIAL_LINKER_VERSION$5 : '14.0.0';
|
|
32916
32955
|
definitionMap.set('minVersion', literal(minVersion));
|
|
32917
|
-
definitionMap.set('version', literal('17.1.0-next.
|
|
32956
|
+
definitionMap.set('version', literal('17.1.0-next.2'));
|
|
32918
32957
|
// e.g. `type: MyDirective`
|
|
32919
32958
|
definitionMap.set('type', meta.type.value);
|
|
32920
32959
|
if (meta.isStandalone) {
|
|
@@ -33191,7 +33230,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
33191
33230
|
function compileDeclareFactoryFunction(meta) {
|
|
33192
33231
|
const definitionMap = new DefinitionMap();
|
|
33193
33232
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
33194
|
-
definitionMap.set('version', literal('17.1.0-next.
|
|
33233
|
+
definitionMap.set('version', literal('17.1.0-next.2'));
|
|
33195
33234
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33196
33235
|
definitionMap.set('type', meta.type.value);
|
|
33197
33236
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -33226,7 +33265,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
33226
33265
|
function createInjectableDefinitionMap(meta) {
|
|
33227
33266
|
const definitionMap = new DefinitionMap();
|
|
33228
33267
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
33229
|
-
definitionMap.set('version', literal('17.1.0-next.
|
|
33268
|
+
definitionMap.set('version', literal('17.1.0-next.2'));
|
|
33230
33269
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33231
33270
|
definitionMap.set('type', meta.type.value);
|
|
33232
33271
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -33277,7 +33316,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
33277
33316
|
function createInjectorDefinitionMap(meta) {
|
|
33278
33317
|
const definitionMap = new DefinitionMap();
|
|
33279
33318
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
33280
|
-
definitionMap.set('version', literal('17.1.0-next.
|
|
33319
|
+
definitionMap.set('version', literal('17.1.0-next.2'));
|
|
33281
33320
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33282
33321
|
definitionMap.set('type', meta.type.value);
|
|
33283
33322
|
definitionMap.set('providers', meta.providers);
|
|
@@ -33310,7 +33349,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
33310
33349
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
33311
33350
|
}
|
|
33312
33351
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
33313
|
-
definitionMap.set('version', literal('17.1.0-next.
|
|
33352
|
+
definitionMap.set('version', literal('17.1.0-next.2'));
|
|
33314
33353
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33315
33354
|
definitionMap.set('type', meta.type.value);
|
|
33316
33355
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -33361,7 +33400,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
33361
33400
|
function createPipeDefinitionMap(meta) {
|
|
33362
33401
|
const definitionMap = new DefinitionMap();
|
|
33363
33402
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
33364
|
-
definitionMap.set('version', literal('17.1.0-next.
|
|
33403
|
+
definitionMap.set('version', literal('17.1.0-next.2'));
|
|
33365
33404
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33366
33405
|
// e.g. `type: MyPipe`
|
|
33367
33406
|
definitionMap.set('type', meta.type.value);
|
|
@@ -33394,5 +33433,5 @@ publishFacade(_global);
|
|
|
33394
33433
|
|
|
33395
33434
|
// This file is not used to build this module. It is only used during editing
|
|
33396
33435
|
|
|
33397
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compilePipeFromMetadata, computeMsgId, core, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
|
|
33436
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
|
|
33398
33437
|
//# sourceMappingURL=compiler.mjs.map
|