@angular/compiler 14.0.0-next.1 → 14.0.0-next.10
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/esm2020/src/compiler.mjs +2 -2
- package/esm2020/src/compiler_facade_interface.mjs +1 -1
- package/esm2020/src/expression_parser/parser.mjs +76 -19
- package/esm2020/src/jit_compiler_facade.mjs +6 -3
- package/esm2020/src/ml_parser/lexer.mjs +2 -2
- package/esm2020/src/output/output_ast.mjs +1 -1
- package/esm2020/src/parse_util.mjs +2 -2
- package/esm2020/src/render3/partial/api.mjs +1 -1
- package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2020/src/render3/partial/directive.mjs +1 -1
- package/esm2020/src/render3/partial/factory.mjs +1 -1
- package/esm2020/src/render3/partial/injectable.mjs +1 -1
- package/esm2020/src/render3/partial/injector.mjs +1 -1
- package/esm2020/src/render3/partial/ng_module.mjs +1 -1
- package/esm2020/src/render3/partial/pipe.mjs +1 -1
- package/esm2020/src/render3/r3_identifiers.mjs +3 -1
- package/esm2020/src/render3/r3_module_compiler.mjs +45 -8
- package/esm2020/src/render3/r3_pipe_compiler.mjs +4 -1
- package/esm2020/src/render3/r3_template_transform.mjs +9 -9
- package/esm2020/src/render3/view/api.mjs +1 -1
- package/esm2020/src/render3/view/compiler.mjs +43 -40
- package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +2 -5
- package/esm2020/src/render3/view/i18n/meta.mjs +11 -6
- package/esm2020/src/render3/view/style_parser.mjs +2 -2
- package/esm2020/src/render3/view/styling_builder.mjs +3 -3
- package/esm2020/src/render3/view/template.mjs +98 -129
- package/esm2020/src/render3/view/util.mjs +94 -15
- package/esm2020/src/selector.mjs +3 -3
- package/esm2020/src/shadow_css.mjs +2 -2
- package/esm2020/src/template_parser/binding_parser.mjs +16 -16
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +414 -257
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/compiler.mjs +410 -255
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/fesm2020/testing.mjs.map +1 -1
- package/package.json +10 -2
- package/src/compiler.d.ts +1 -1
- package/src/compiler_facade_interface.d.ts +4 -0
- package/src/expression_parser/parser.d.ts +22 -5
- package/src/output/output_ast.d.ts +2 -1
- package/src/render3/partial/api.d.ts +10 -0
- package/src/render3/r3_identifiers.d.ts +2 -0
- package/src/render3/r3_module_compiler.d.ts +30 -4
- package/src/render3/r3_pipe_compiler.d.ts +4 -0
- package/src/render3/view/api.d.ts +4 -0
- package/src/render3/view/i18n/meta.d.ts +1 -1
- package/src/render3/view/template.d.ts +1 -4
- package/src/render3/view/util.d.ts +19 -2
- package/src/template_parser/binding_parser.d.ts +4 -3
package/fesm2020/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-next.
|
|
2
|
+
* @license Angular v14.0.0-next.10
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -224,11 +224,11 @@ class CssSelector {
|
|
|
224
224
|
const prefix = match[3 /* PREFIX */];
|
|
225
225
|
if (prefix === '#') {
|
|
226
226
|
// #hash
|
|
227
|
-
current.addAttribute('id', tag.
|
|
227
|
+
current.addAttribute('id', tag.slice(1));
|
|
228
228
|
}
|
|
229
229
|
else if (prefix === '.') {
|
|
230
230
|
// Class
|
|
231
|
-
current.addClassName(tag.
|
|
231
|
+
current.addClassName(tag.slice(1));
|
|
232
232
|
}
|
|
233
233
|
else {
|
|
234
234
|
// Element
|
|
@@ -2796,6 +2796,7 @@ Identifiers.stylePropInterpolate7 = { name: 'ɵɵstylePropInterpolate7', moduleN
|
|
|
2796
2796
|
Identifiers.stylePropInterpolate8 = { name: 'ɵɵstylePropInterpolate8', moduleName: CORE };
|
|
2797
2797
|
Identifiers.stylePropInterpolateV = { name: 'ɵɵstylePropInterpolateV', moduleName: CORE };
|
|
2798
2798
|
Identifiers.nextContext = { name: 'ɵɵnextContext', moduleName: CORE };
|
|
2799
|
+
Identifiers.resetView = { name: 'ɵɵresetView', moduleName: CORE };
|
|
2799
2800
|
Identifiers.templateCreate = { name: 'ɵɵtemplate', moduleName: CORE };
|
|
2800
2801
|
Identifiers.text = { name: 'ɵɵtext', moduleName: CORE };
|
|
2801
2802
|
Identifiers.enableBindings = { name: 'ɵɵenableBindings', moduleName: CORE };
|
|
@@ -2906,6 +2907,7 @@ Identifiers.ModuleWithProviders = {
|
|
|
2906
2907
|
Identifiers.defineNgModule = { name: 'ɵɵdefineNgModule', moduleName: CORE };
|
|
2907
2908
|
Identifiers.declareNgModule = { name: 'ɵɵngDeclareNgModule', moduleName: CORE };
|
|
2908
2909
|
Identifiers.setNgModuleScope = { name: 'ɵɵsetNgModuleScope', moduleName: CORE };
|
|
2910
|
+
Identifiers.registerNgModuleType = { name: 'ɵɵregisterNgModuleType', moduleName: CORE };
|
|
2909
2911
|
Identifiers.PipeDeclaration = { name: 'ɵɵPipeDeclaration', moduleName: CORE };
|
|
2910
2912
|
Identifiers.definePipe = { name: 'ɵɵdefinePipe', moduleName: CORE };
|
|
2911
2913
|
Identifiers.declarePipe = { name: 'ɵɵngDeclarePipe', moduleName: CORE };
|
|
@@ -4872,6 +4874,65 @@ const IMPLICIT_REFERENCE = '$implicit';
|
|
|
4872
4874
|
const NON_BINDABLE_ATTR = 'ngNonBindable';
|
|
4873
4875
|
/** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */
|
|
4874
4876
|
const RESTORED_VIEW_CONTEXT_NAME = 'restoredCtx';
|
|
4877
|
+
/** Instructions that support chaining. */
|
|
4878
|
+
const CHAINABLE_INSTRUCTIONS = new Set([
|
|
4879
|
+
Identifiers.element,
|
|
4880
|
+
Identifiers.elementStart,
|
|
4881
|
+
Identifiers.elementEnd,
|
|
4882
|
+
Identifiers.elementContainer,
|
|
4883
|
+
Identifiers.elementContainerStart,
|
|
4884
|
+
Identifiers.elementContainerEnd,
|
|
4885
|
+
Identifiers.i18nExp,
|
|
4886
|
+
Identifiers.listener,
|
|
4887
|
+
Identifiers.classProp,
|
|
4888
|
+
Identifiers.syntheticHostListener,
|
|
4889
|
+
Identifiers.hostProperty,
|
|
4890
|
+
Identifiers.syntheticHostProperty,
|
|
4891
|
+
Identifiers.property,
|
|
4892
|
+
Identifiers.propertyInterpolate1,
|
|
4893
|
+
Identifiers.propertyInterpolate2,
|
|
4894
|
+
Identifiers.propertyInterpolate3,
|
|
4895
|
+
Identifiers.propertyInterpolate4,
|
|
4896
|
+
Identifiers.propertyInterpolate5,
|
|
4897
|
+
Identifiers.propertyInterpolate6,
|
|
4898
|
+
Identifiers.propertyInterpolate7,
|
|
4899
|
+
Identifiers.propertyInterpolate8,
|
|
4900
|
+
Identifiers.propertyInterpolateV,
|
|
4901
|
+
Identifiers.attribute,
|
|
4902
|
+
Identifiers.attributeInterpolate1,
|
|
4903
|
+
Identifiers.attributeInterpolate2,
|
|
4904
|
+
Identifiers.attributeInterpolate3,
|
|
4905
|
+
Identifiers.attributeInterpolate4,
|
|
4906
|
+
Identifiers.attributeInterpolate5,
|
|
4907
|
+
Identifiers.attributeInterpolate6,
|
|
4908
|
+
Identifiers.attributeInterpolate7,
|
|
4909
|
+
Identifiers.attributeInterpolate8,
|
|
4910
|
+
Identifiers.attributeInterpolateV,
|
|
4911
|
+
Identifiers.styleProp,
|
|
4912
|
+
Identifiers.stylePropInterpolate1,
|
|
4913
|
+
Identifiers.stylePropInterpolate2,
|
|
4914
|
+
Identifiers.stylePropInterpolate3,
|
|
4915
|
+
Identifiers.stylePropInterpolate4,
|
|
4916
|
+
Identifiers.stylePropInterpolate5,
|
|
4917
|
+
Identifiers.stylePropInterpolate6,
|
|
4918
|
+
Identifiers.stylePropInterpolate7,
|
|
4919
|
+
Identifiers.stylePropInterpolate8,
|
|
4920
|
+
Identifiers.stylePropInterpolateV,
|
|
4921
|
+
Identifiers.textInterpolate,
|
|
4922
|
+
Identifiers.textInterpolate1,
|
|
4923
|
+
Identifiers.textInterpolate2,
|
|
4924
|
+
Identifiers.textInterpolate3,
|
|
4925
|
+
Identifiers.textInterpolate4,
|
|
4926
|
+
Identifiers.textInterpolate5,
|
|
4927
|
+
Identifiers.textInterpolate6,
|
|
4928
|
+
Identifiers.textInterpolate7,
|
|
4929
|
+
Identifiers.textInterpolate8,
|
|
4930
|
+
Identifiers.textInterpolateV,
|
|
4931
|
+
]);
|
|
4932
|
+
/** Generates a call to a single instruction. */
|
|
4933
|
+
function invokeInstruction(span, reference, params) {
|
|
4934
|
+
return importExpr(reference, null, span).callFn(params, span);
|
|
4935
|
+
}
|
|
4875
4936
|
/**
|
|
4876
4937
|
* Creates an allocator for a temporary variable.
|
|
4877
4938
|
*
|
|
@@ -5013,20 +5074,6 @@ function getAttrsForDirectiveMatching(elOrTpl) {
|
|
|
5013
5074
|
}
|
|
5014
5075
|
return attributesMap;
|
|
5015
5076
|
}
|
|
5016
|
-
/** Returns a call expression to a chained instruction, e.g. `property(params[0])(params[1])`. */
|
|
5017
|
-
function chainedInstruction(reference, calls, span) {
|
|
5018
|
-
let expression = importExpr(reference, null, span);
|
|
5019
|
-
if (calls.length > 0) {
|
|
5020
|
-
for (let i = 0; i < calls.length; i++) {
|
|
5021
|
-
expression = expression.callFn(calls[i], span);
|
|
5022
|
-
}
|
|
5023
|
-
}
|
|
5024
|
-
else {
|
|
5025
|
-
// Add a blank invocation, in case the `calls` array is empty.
|
|
5026
|
-
expression = expression.callFn([], span);
|
|
5027
|
-
}
|
|
5028
|
-
return expression;
|
|
5029
|
-
}
|
|
5030
5077
|
/**
|
|
5031
5078
|
* Gets the number of arguments expected to be passed to a generated instruction in the case of
|
|
5032
5079
|
* interpolation instructions.
|
|
@@ -5044,6 +5091,40 @@ function getInterpolationArgsLength(interpolation) {
|
|
|
5044
5091
|
return expressions.length + strings.length;
|
|
5045
5092
|
}
|
|
5046
5093
|
}
|
|
5094
|
+
/**
|
|
5095
|
+
* Generates the final instruction call statements based on the passed in configuration.
|
|
5096
|
+
* Will try to chain instructions as much as possible, if chaining is supported.
|
|
5097
|
+
*/
|
|
5098
|
+
function getInstructionStatements(instructions) {
|
|
5099
|
+
const statements = [];
|
|
5100
|
+
let pendingExpression = null;
|
|
5101
|
+
let pendingExpressionType = null;
|
|
5102
|
+
for (const current of instructions) {
|
|
5103
|
+
const resolvedParams = (typeof current.paramsOrFn === 'function' ? current.paramsOrFn() : current.paramsOrFn) ??
|
|
5104
|
+
[];
|
|
5105
|
+
const params = Array.isArray(resolvedParams) ? resolvedParams : [resolvedParams];
|
|
5106
|
+
// If the current instruction is the same as the previous one
|
|
5107
|
+
// and it can be chained, add another call to the chain.
|
|
5108
|
+
if (pendingExpressionType === current.reference &&
|
|
5109
|
+
CHAINABLE_INSTRUCTIONS.has(pendingExpressionType)) {
|
|
5110
|
+
// We'll always have a pending expression when there's a pending expression type.
|
|
5111
|
+
pendingExpression = pendingExpression.callFn(params, pendingExpression.sourceSpan);
|
|
5112
|
+
}
|
|
5113
|
+
else {
|
|
5114
|
+
if (pendingExpression !== null) {
|
|
5115
|
+
statements.push(pendingExpression.toStmt());
|
|
5116
|
+
}
|
|
5117
|
+
pendingExpression = invokeInstruction(current.span, current.reference, params);
|
|
5118
|
+
pendingExpressionType = current.reference;
|
|
5119
|
+
}
|
|
5120
|
+
}
|
|
5121
|
+
// Since the current instruction adds the previous one to the statements,
|
|
5122
|
+
// we may be left with the final one at the end that is still pending.
|
|
5123
|
+
if (pendingExpression !== null) {
|
|
5124
|
+
statements.push(pendingExpression.toStmt());
|
|
5125
|
+
}
|
|
5126
|
+
return statements;
|
|
5127
|
+
}
|
|
5047
5128
|
|
|
5048
5129
|
/**
|
|
5049
5130
|
* @license
|
|
@@ -5349,7 +5430,7 @@ class ParseLocation {
|
|
|
5349
5430
|
const ch = source.charCodeAt(offset);
|
|
5350
5431
|
if (ch == $LF) {
|
|
5351
5432
|
line--;
|
|
5352
|
-
const priorLine = source.
|
|
5433
|
+
const priorLine = source.substring(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
|
|
5353
5434
|
col = priorLine > 0 ? offset - priorLine : offset;
|
|
5354
5435
|
}
|
|
5355
5436
|
else {
|
|
@@ -5903,20 +5984,49 @@ class R3JitReflector {
|
|
|
5903
5984
|
* Use of this source code is governed by an MIT-style license that can be
|
|
5904
5985
|
* found in the LICENSE file at https://angular.io/license
|
|
5905
5986
|
*/
|
|
5987
|
+
/**
|
|
5988
|
+
* How the selector scope of an NgModule (its declarations, imports, and exports) should be emitted
|
|
5989
|
+
* as a part of the NgModule definition.
|
|
5990
|
+
*/
|
|
5991
|
+
var R3SelectorScopeMode;
|
|
5992
|
+
(function (R3SelectorScopeMode) {
|
|
5993
|
+
/**
|
|
5994
|
+
* Emit the declarations inline into the module definition.
|
|
5995
|
+
*
|
|
5996
|
+
* This option is useful in certain contexts where it's known that JIT support is required. The
|
|
5997
|
+
* tradeoff here is that this emit style prevents directives and pipes from being tree-shaken if
|
|
5998
|
+
* they are unused, but the NgModule is used.
|
|
5999
|
+
*/
|
|
6000
|
+
R3SelectorScopeMode[R3SelectorScopeMode["Inline"] = 0] = "Inline";
|
|
6001
|
+
/**
|
|
6002
|
+
* Emit the declarations using a side effectful function call, `ɵɵsetNgModuleScope`, that is
|
|
6003
|
+
* guarded with the `ngJitMode` flag.
|
|
6004
|
+
*
|
|
6005
|
+
* This form of emit supports JIT and can be optimized away if the `ngJitMode` flag is set to
|
|
6006
|
+
* false, which allows unused directives and pipes to be tree-shaken.
|
|
6007
|
+
*/
|
|
6008
|
+
R3SelectorScopeMode[R3SelectorScopeMode["SideEffect"] = 1] = "SideEffect";
|
|
6009
|
+
/**
|
|
6010
|
+
* Don't generate selector scopes at all.
|
|
6011
|
+
*
|
|
6012
|
+
* This is useful for contexts where JIT support is known to be unnecessary.
|
|
6013
|
+
*/
|
|
6014
|
+
R3SelectorScopeMode[R3SelectorScopeMode["Omit"] = 2] = "Omit";
|
|
6015
|
+
})(R3SelectorScopeMode || (R3SelectorScopeMode = {}));
|
|
5906
6016
|
/**
|
|
5907
6017
|
* Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.
|
|
5908
6018
|
*/
|
|
5909
6019
|
function compileNgModule(meta) {
|
|
5910
|
-
const { internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls,
|
|
6020
|
+
const { adjacentType, internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, selectorScopeMode, id } = meta;
|
|
5911
6021
|
const statements = [];
|
|
5912
6022
|
const definitionMap = new DefinitionMap();
|
|
5913
6023
|
definitionMap.set('type', internalType);
|
|
5914
6024
|
if (bootstrap.length > 0) {
|
|
5915
6025
|
definitionMap.set('bootstrap', refsToArray(bootstrap, containsForwardDecls));
|
|
5916
6026
|
}
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
6027
|
+
if (selectorScopeMode === R3SelectorScopeMode.Inline) {
|
|
6028
|
+
// If requested to emit scope information inline, pass the `declarations`, `imports` and
|
|
6029
|
+
// `exports` to the `ɵɵdefineNgModule()` call directly.
|
|
5920
6030
|
if (declarations.length > 0) {
|
|
5921
6031
|
definitionMap.set('declarations', refsToArray(declarations, containsForwardDecls));
|
|
5922
6032
|
}
|
|
@@ -5927,19 +6037,27 @@ function compileNgModule(meta) {
|
|
|
5927
6037
|
definitionMap.set('exports', refsToArray(exports, containsForwardDecls));
|
|
5928
6038
|
}
|
|
5929
6039
|
}
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
6040
|
+
else if (selectorScopeMode === R3SelectorScopeMode.SideEffect) {
|
|
6041
|
+
// In this mode, scope information is not passed into `ɵɵdefineNgModule` as it
|
|
6042
|
+
// would prevent tree-shaking of the declarations, imports and exports references. Instead, it's
|
|
6043
|
+
// patched onto the NgModule definition with a `ɵɵsetNgModuleScope` call that's guarded by the
|
|
6044
|
+
// `ngJitMode` flag.
|
|
5933
6045
|
const setNgModuleScopeCall = generateSetNgModuleScopeCall(meta);
|
|
5934
6046
|
if (setNgModuleScopeCall !== null) {
|
|
5935
6047
|
statements.push(setNgModuleScopeCall);
|
|
5936
6048
|
}
|
|
5937
6049
|
}
|
|
6050
|
+
else {
|
|
6051
|
+
// Selector scope emit was not requested, so skip it.
|
|
6052
|
+
}
|
|
5938
6053
|
if (schemas !== null && schemas.length > 0) {
|
|
5939
6054
|
definitionMap.set('schemas', literalArr(schemas.map(ref => ref.value)));
|
|
5940
6055
|
}
|
|
5941
6056
|
if (id !== null) {
|
|
5942
6057
|
definitionMap.set('id', id);
|
|
6058
|
+
// Generate a side-effectful call to register this NgModule by its id, as per the semantics of
|
|
6059
|
+
// NgModule ids.
|
|
6060
|
+
statements.push(importExpr(Identifiers.registerNgModuleType).callFn([adjacentType, id]).toStmt());
|
|
5943
6061
|
}
|
|
5944
6062
|
const expression = importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()], undefined, true);
|
|
5945
6063
|
const type = createNgModuleType(meta);
|
|
@@ -6035,6 +6153,9 @@ function compilePipeFromMetadata(metadata) {
|
|
|
6035
6153
|
definitionMapValues.push({ key: 'type', value: metadata.type.value, quoted: false });
|
|
6036
6154
|
// e.g. `pure: true`
|
|
6037
6155
|
definitionMapValues.push({ key: 'pure', value: literal(metadata.pure), quoted: false });
|
|
6156
|
+
if (metadata.isStandalone) {
|
|
6157
|
+
definitionMapValues.push({ key: 'standalone', value: literal(true), quoted: false });
|
|
6158
|
+
}
|
|
6038
6159
|
const expression = importExpr(Identifiers.definePipe).callFn([literalMap(definitionMapValues)], undefined, true);
|
|
6039
6160
|
const type = createPipeType(metadata);
|
|
6040
6161
|
return { expression, type, statements: [] };
|
|
@@ -7886,7 +8007,7 @@ class ShadowCss {
|
|
|
7886
8007
|
this._scopeSelector(rule.selector, scopeSelector, hostSelector, this.strictStyling);
|
|
7887
8008
|
}
|
|
7888
8009
|
else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
|
|
7889
|
-
rule.selector.startsWith('@document')) {
|
|
8010
|
+
rule.selector.startsWith('@document') || rule.selector.startsWith('@layer')) {
|
|
7890
8011
|
content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
|
|
7891
8012
|
}
|
|
7892
8013
|
else if (rule.selector.startsWith('@font-face') || rule.selector.startsWith('@page')) {
|
|
@@ -8349,7 +8470,7 @@ function parse(value) {
|
|
|
8349
8470
|
}
|
|
8350
8471
|
}
|
|
8351
8472
|
if (currentProp && valueStart) {
|
|
8352
|
-
const styleVal = value.
|
|
8473
|
+
const styleVal = value.slice(valueStart).trim();
|
|
8353
8474
|
styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal);
|
|
8354
8475
|
}
|
|
8355
8476
|
return styles;
|
|
@@ -8527,7 +8648,7 @@ class StylingBuilder {
|
|
|
8527
8648
|
const isClass = !isStyle && (name === 'class' || prefix === 'class.' || prefix === 'class!');
|
|
8528
8649
|
if (isStyle || isClass) {
|
|
8529
8650
|
const isMapBased = name.charAt(5) !== '.'; // style.prop or class.prop makes this a no
|
|
8530
|
-
const property = name.
|
|
8651
|
+
const property = name.slice(isMapBased ? 5 : 6); // the dot explains why there's a +1
|
|
8531
8652
|
if (isStyle) {
|
|
8532
8653
|
binding = this.registerStyleInput(property, isMapBased, expression, sourceSpan);
|
|
8533
8654
|
}
|
|
@@ -8801,7 +8922,7 @@ function parseProperty(name) {
|
|
|
8801
8922
|
let property = name;
|
|
8802
8923
|
const unitIndex = name.lastIndexOf('.');
|
|
8803
8924
|
if (unitIndex > 0) {
|
|
8804
|
-
suffix = name.
|
|
8925
|
+
suffix = name.slice(unitIndex + 1);
|
|
8805
8926
|
property = name.substring(0, unitIndex);
|
|
8806
8927
|
}
|
|
8807
8928
|
return { property, suffix, hasOverrideFlag };
|
|
@@ -9348,11 +9469,15 @@ class Parser$1 {
|
|
|
9348
9469
|
this._lexer = _lexer;
|
|
9349
9470
|
this.errors = [];
|
|
9350
9471
|
}
|
|
9351
|
-
parseAction(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9472
|
+
parseAction(input, isAssignmentEvent, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9352
9473
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9353
9474
|
const sourceToLex = this._stripComments(input);
|
|
9354
9475
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9355
|
-
|
|
9476
|
+
let flags = 1 /* Action */;
|
|
9477
|
+
if (isAssignmentEvent) {
|
|
9478
|
+
flags |= 2 /* AssignmentEvent */;
|
|
9479
|
+
}
|
|
9480
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, flags, this.errors, 0).parseChain();
|
|
9356
9481
|
return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);
|
|
9357
9482
|
}
|
|
9358
9483
|
parseBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
@@ -9379,7 +9504,7 @@ class Parser$1 {
|
|
|
9379
9504
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9380
9505
|
const sourceToLex = this._stripComments(input);
|
|
9381
9506
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9382
|
-
return new _ParseAST(input, location, absoluteOffset, tokens,
|
|
9507
|
+
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9383
9508
|
.parseChain();
|
|
9384
9509
|
}
|
|
9385
9510
|
/**
|
|
@@ -9410,14 +9535,14 @@ class Parser$1 {
|
|
|
9410
9535
|
*/
|
|
9411
9536
|
parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {
|
|
9412
9537
|
const tokens = this._lexer.tokenize(templateValue);
|
|
9413
|
-
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens,
|
|
9538
|
+
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* None */, this.errors, 0 /* relative offset */);
|
|
9414
9539
|
return parser.parseTemplateBindings({
|
|
9415
9540
|
source: templateKey,
|
|
9416
9541
|
span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
|
|
9417
9542
|
});
|
|
9418
9543
|
}
|
|
9419
|
-
parseInterpolation(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9420
|
-
const { strings, expressions, offsets } = this.splitInterpolation(input, location, interpolationConfig);
|
|
9544
|
+
parseInterpolation(input, location, absoluteOffset, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9545
|
+
const { strings, expressions, offsets } = this.splitInterpolation(input, location, interpolatedTokens, interpolationConfig);
|
|
9421
9546
|
if (expressions.length === 0)
|
|
9422
9547
|
return null;
|
|
9423
9548
|
const expressionNodes = [];
|
|
@@ -9425,7 +9550,7 @@ class Parser$1 {
|
|
|
9425
9550
|
const expressionText = expressions[i].text;
|
|
9426
9551
|
const sourceToLex = this._stripComments(expressionText);
|
|
9427
9552
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9428
|
-
const ast = new _ParseAST(input, location, absoluteOffset, tokens,
|
|
9553
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, offsets[i])
|
|
9429
9554
|
.parseChain();
|
|
9430
9555
|
expressionNodes.push(ast);
|
|
9431
9556
|
}
|
|
@@ -9439,8 +9564,7 @@ class Parser$1 {
|
|
|
9439
9564
|
parseInterpolationExpression(expression, location, absoluteOffset) {
|
|
9440
9565
|
const sourceToLex = this._stripComments(expression);
|
|
9441
9566
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9442
|
-
const ast = new _ParseAST(expression, location, absoluteOffset, tokens,
|
|
9443
|
-
/* parseAction */ false, this.errors, 0)
|
|
9567
|
+
const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9444
9568
|
.parseChain();
|
|
9445
9569
|
const strings = ['', '']; // The prefix and suffix strings are both empty
|
|
9446
9570
|
return this.createInterpolationAst(strings, [ast], expression, location, absoluteOffset);
|
|
@@ -9457,10 +9581,11 @@ class Parser$1 {
|
|
|
9457
9581
|
* `SplitInterpolation` with splits that look like
|
|
9458
9582
|
* <raw text> <expression> <raw text> ... <raw text> <expression> <raw text>
|
|
9459
9583
|
*/
|
|
9460
|
-
splitInterpolation(input, location, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9584
|
+
splitInterpolation(input, location, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9461
9585
|
const strings = [];
|
|
9462
9586
|
const expressions = [];
|
|
9463
9587
|
const offsets = [];
|
|
9588
|
+
const inputToTemplateIndexMap = interpolatedTokens ? getIndexMapForOriginalTemplate(interpolatedTokens) : null;
|
|
9464
9589
|
let i = 0;
|
|
9465
9590
|
let atInterpolation = false;
|
|
9466
9591
|
let extendLastString = false;
|
|
@@ -9495,7 +9620,9 @@ class Parser$1 {
|
|
|
9495
9620
|
this._reportError('Blank expressions are not allowed in interpolated strings', input, `at column ${i} in`, location);
|
|
9496
9621
|
}
|
|
9497
9622
|
expressions.push({ text, start: fullStart, end: fullEnd });
|
|
9498
|
-
|
|
9623
|
+
const startInOriginalTemplate = inputToTemplateIndexMap?.get(fullStart) ?? fullStart;
|
|
9624
|
+
const offset = startInOriginalTemplate + interpStart.length;
|
|
9625
|
+
offsets.push(offset);
|
|
9499
9626
|
i = fullEnd;
|
|
9500
9627
|
atInterpolation = false;
|
|
9501
9628
|
}
|
|
@@ -9611,12 +9738,12 @@ var ParseContextFlags;
|
|
|
9611
9738
|
ParseContextFlags[ParseContextFlags["Writable"] = 1] = "Writable";
|
|
9612
9739
|
})(ParseContextFlags || (ParseContextFlags = {}));
|
|
9613
9740
|
class _ParseAST {
|
|
9614
|
-
constructor(input, location, absoluteOffset, tokens,
|
|
9741
|
+
constructor(input, location, absoluteOffset, tokens, parseFlags, errors, offset) {
|
|
9615
9742
|
this.input = input;
|
|
9616
9743
|
this.location = location;
|
|
9617
9744
|
this.absoluteOffset = absoluteOffset;
|
|
9618
9745
|
this.tokens = tokens;
|
|
9619
|
-
this.
|
|
9746
|
+
this.parseFlags = parseFlags;
|
|
9620
9747
|
this.errors = errors;
|
|
9621
9748
|
this.offset = offset;
|
|
9622
9749
|
this.rparensExpected = 0;
|
|
@@ -9793,7 +9920,7 @@ class _ParseAST {
|
|
|
9793
9920
|
const expr = this.parsePipe();
|
|
9794
9921
|
exprs.push(expr);
|
|
9795
9922
|
if (this.consumeOptionalCharacter($SEMICOLON)) {
|
|
9796
|
-
if (!this.
|
|
9923
|
+
if (!(this.parseFlags & 1 /* Action */)) {
|
|
9797
9924
|
this.error('Binding expression cannot contain chained expression');
|
|
9798
9925
|
}
|
|
9799
9926
|
while (this.consumeOptionalCharacter($SEMICOLON)) {
|
|
@@ -9817,7 +9944,7 @@ class _ParseAST {
|
|
|
9817
9944
|
const start = this.inputIndex;
|
|
9818
9945
|
let result = this.parseExpression();
|
|
9819
9946
|
if (this.consumeOptionalOperator('|')) {
|
|
9820
|
-
if (this.
|
|
9947
|
+
if (this.parseFlags & 1 /* Action */) {
|
|
9821
9948
|
this.error('Cannot have a pipe in an action expression');
|
|
9822
9949
|
}
|
|
9823
9950
|
do {
|
|
@@ -10159,7 +10286,7 @@ class _ParseAST {
|
|
|
10159
10286
|
const nameSpan = this.sourceSpan(nameStart);
|
|
10160
10287
|
let receiver;
|
|
10161
10288
|
if (isSafe) {
|
|
10162
|
-
if (this.
|
|
10289
|
+
if (this.consumeOptionalAssignment()) {
|
|
10163
10290
|
this.error('The \'?.\' operator cannot be used in the assignment');
|
|
10164
10291
|
receiver = new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10165
10292
|
}
|
|
@@ -10168,8 +10295,8 @@ class _ParseAST {
|
|
|
10168
10295
|
}
|
|
10169
10296
|
}
|
|
10170
10297
|
else {
|
|
10171
|
-
if (this.
|
|
10172
|
-
if (!this.
|
|
10298
|
+
if (this.consumeOptionalAssignment()) {
|
|
10299
|
+
if (!(this.parseFlags & 1 /* Action */)) {
|
|
10173
10300
|
this.error('Bindings cannot contain assignments');
|
|
10174
10301
|
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10175
10302
|
}
|
|
@@ -10195,6 +10322,22 @@ class _ParseAST {
|
|
|
10195
10322
|
return isSafe ? new SafeCall(span, sourceSpan, receiver, args, argumentSpan) :
|
|
10196
10323
|
new Call(span, sourceSpan, receiver, args, argumentSpan);
|
|
10197
10324
|
}
|
|
10325
|
+
consumeOptionalAssignment() {
|
|
10326
|
+
// When parsing assignment events (originating from two-way-binding aka banana-in-a-box syntax),
|
|
10327
|
+
// it is valid for the primary expression to be terminated by the non-null operator. This
|
|
10328
|
+
// primary expression is substituted as LHS of the assignment operator to achieve
|
|
10329
|
+
// two-way-binding, such that the LHS could be the non-null operator. The grammar doesn't
|
|
10330
|
+
// naturally allow for this syntax, so assignment events are parsed specially.
|
|
10331
|
+
if ((this.parseFlags & 2 /* AssignmentEvent */) && this.next.isOperator('!') &&
|
|
10332
|
+
this.peek(1).isOperator('=')) {
|
|
10333
|
+
// First skip over the ! operator.
|
|
10334
|
+
this.advance();
|
|
10335
|
+
// Then skip over the = operator, to fully consume the optional assignment operator.
|
|
10336
|
+
this.advance();
|
|
10337
|
+
return true;
|
|
10338
|
+
}
|
|
10339
|
+
return this.consumeOptionalOperator('=');
|
|
10340
|
+
}
|
|
10198
10341
|
parseCallArguments() {
|
|
10199
10342
|
if (this.next.isCharacter($RPAREN))
|
|
10200
10343
|
return [];
|
|
@@ -10487,6 +10630,41 @@ class SimpleExpressionChecker extends RecursiveAstVisitor {
|
|
|
10487
10630
|
this.errors.push('pipes');
|
|
10488
10631
|
}
|
|
10489
10632
|
}
|
|
10633
|
+
/**
|
|
10634
|
+
* Computes the real offset in the original template for indexes in an interpolation.
|
|
10635
|
+
*
|
|
10636
|
+
* Because templates can have encoded HTML entities and the input passed to the parser at this stage
|
|
10637
|
+
* of the compiler is the _decoded_ value, we need to compute the real offset using the original
|
|
10638
|
+
* encoded values in the interpolated tokens. Note that this is only a special case handling for
|
|
10639
|
+
* `MlParserTokenType.ENCODED_ENTITY` token types. All other interpolated tokens are expected to
|
|
10640
|
+
* have parts which exactly match the input string for parsing the interpolation.
|
|
10641
|
+
*
|
|
10642
|
+
* @param interpolatedTokens The tokens for the interpolated value.
|
|
10643
|
+
*
|
|
10644
|
+
* @returns A map of index locations in the decoded template to indexes in the original template
|
|
10645
|
+
*/
|
|
10646
|
+
function getIndexMapForOriginalTemplate(interpolatedTokens) {
|
|
10647
|
+
let offsetMap = new Map();
|
|
10648
|
+
let consumedInOriginalTemplate = 0;
|
|
10649
|
+
let consumedInInput = 0;
|
|
10650
|
+
let tokenIndex = 0;
|
|
10651
|
+
while (tokenIndex < interpolatedTokens.length) {
|
|
10652
|
+
const currentToken = interpolatedTokens[tokenIndex];
|
|
10653
|
+
if (currentToken.type === 9 /* ENCODED_ENTITY */) {
|
|
10654
|
+
const [decoded, encoded] = currentToken.parts;
|
|
10655
|
+
consumedInOriginalTemplate += encoded.length;
|
|
10656
|
+
consumedInInput += decoded.length;
|
|
10657
|
+
}
|
|
10658
|
+
else {
|
|
10659
|
+
const lengthOfParts = currentToken.parts.reduce((sum, current) => sum + current.length, 0);
|
|
10660
|
+
consumedInInput += lengthOfParts;
|
|
10661
|
+
consumedInOriginalTemplate += lengthOfParts;
|
|
10662
|
+
}
|
|
10663
|
+
offsetMap.set(consumedInInput, consumedInOriginalTemplate);
|
|
10664
|
+
tokenIndex++;
|
|
10665
|
+
}
|
|
10666
|
+
return offsetMap;
|
|
10667
|
+
}
|
|
10490
10668
|
|
|
10491
10669
|
/**
|
|
10492
10670
|
* @license
|
|
@@ -13728,7 +13906,7 @@ class EscapedCharacterCursor extends PlainCharacterCursor {
|
|
|
13728
13906
|
}
|
|
13729
13907
|
}
|
|
13730
13908
|
decodeHexDigits(start, length) {
|
|
13731
|
-
const hex = this.input.
|
|
13909
|
+
const hex = this.input.slice(start.internalState.offset, start.internalState.offset + length);
|
|
13732
13910
|
const charCode = parseInt(hex, 16);
|
|
13733
13911
|
if (!isNaN(charCode)) {
|
|
13734
13912
|
return charCode;
|
|
@@ -14884,7 +15062,7 @@ class BindingParser {
|
|
|
14884
15062
|
// Regardless, neither of these values are used in Ivy but are only here to satisfy the
|
|
14885
15063
|
// function signature. This should likely be refactored in the future so that `sourceSpan`
|
|
14886
15064
|
// isn't being used inaccurately.
|
|
14887
|
-
this.parseEvent(propName, expression, sourceSpan, sourceSpan, [], targetEvents, sourceSpan);
|
|
15065
|
+
this.parseEvent(propName, expression, /* isAssignmentEvent */ false, sourceSpan, sourceSpan, [], targetEvents, sourceSpan);
|
|
14888
15066
|
}
|
|
14889
15067
|
else {
|
|
14890
15068
|
this._reportError(`Value of the host listener "${propName}" needs to be a string representing an expression but got "${expression}" (${typeof expression})`, sourceSpan);
|
|
@@ -14892,11 +15070,11 @@ class BindingParser {
|
|
|
14892
15070
|
}
|
|
14893
15071
|
return targetEvents;
|
|
14894
15072
|
}
|
|
14895
|
-
parseInterpolation(value, sourceSpan) {
|
|
15073
|
+
parseInterpolation(value, sourceSpan, interpolatedTokens) {
|
|
14896
15074
|
const sourceInfo = sourceSpan.start.toString();
|
|
14897
15075
|
const absoluteOffset = sourceSpan.fullStart.offset;
|
|
14898
15076
|
try {
|
|
14899
|
-
const ast = this._exprParser.parseInterpolation(value, sourceInfo, absoluteOffset, this._interpolationConfig);
|
|
15077
|
+
const ast = this._exprParser.parseInterpolation(value, sourceInfo, absoluteOffset, interpolatedTokens, this._interpolationConfig);
|
|
14900
15078
|
if (ast)
|
|
14901
15079
|
this._reportExpressionParserErrors(ast.errors, sourceSpan);
|
|
14902
15080
|
return ast;
|
|
@@ -15033,8 +15211,8 @@ class BindingParser {
|
|
|
15033
15211
|
this._parsePropertyAst(name, this._parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
15034
15212
|
}
|
|
15035
15213
|
}
|
|
15036
|
-
parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan) {
|
|
15037
|
-
const expr = this.parseInterpolation(value, valueSpan || sourceSpan);
|
|
15214
|
+
parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan, interpolatedTokens) {
|
|
15215
|
+
const expr = this.parseInterpolation(value, valueSpan || sourceSpan, interpolatedTokens);
|
|
15038
15216
|
if (expr) {
|
|
15039
15217
|
this._parsePropertyAst(name, expr, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
15040
15218
|
return true;
|
|
@@ -15121,30 +15299,30 @@ class BindingParser {
|
|
|
15121
15299
|
return new BoundElementProperty(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
|
|
15122
15300
|
}
|
|
15123
15301
|
// TODO: keySpan should be required but was made optional to avoid changing VE parser.
|
|
15124
|
-
parseEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
15302
|
+
parseEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
15125
15303
|
if (name.length === 0) {
|
|
15126
15304
|
this._reportError(`Event name is missing in binding`, sourceSpan);
|
|
15127
15305
|
}
|
|
15128
15306
|
if (isAnimationLabel(name)) {
|
|
15129
|
-
name = name.
|
|
15307
|
+
name = name.slice(1);
|
|
15130
15308
|
if (keySpan !== undefined) {
|
|
15131
15309
|
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
|
|
15132
15310
|
}
|
|
15133
|
-
this._parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan);
|
|
15311
|
+
this._parseAnimationEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetEvents, keySpan);
|
|
15134
15312
|
}
|
|
15135
15313
|
else {
|
|
15136
|
-
this._parseRegularEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
|
|
15314
|
+
this._parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan);
|
|
15137
15315
|
}
|
|
15138
15316
|
}
|
|
15139
15317
|
calcPossibleSecurityContexts(selector, propName, isAttribute) {
|
|
15140
15318
|
const prop = this._schemaRegistry.getMappedPropName(propName);
|
|
15141
15319
|
return calcPossibleSecurityContexts(this._schemaRegistry, selector, prop, isAttribute);
|
|
15142
15320
|
}
|
|
15143
|
-
_parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
|
|
15321
|
+
_parseAnimationEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetEvents, keySpan) {
|
|
15144
15322
|
const matches = splitAtPeriod(name, [name, '']);
|
|
15145
15323
|
const eventName = matches[0];
|
|
15146
15324
|
const phase = matches[1].toLowerCase();
|
|
15147
|
-
const ast = this._parseAction(expression, handlerSpan);
|
|
15325
|
+
const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
|
|
15148
15326
|
targetEvents.push(new ParsedEvent(eventName, phase, 1 /* Animation */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15149
15327
|
if (eventName.length === 0) {
|
|
15150
15328
|
this._reportError(`Animation event name is missing in binding`, sourceSpan);
|
|
@@ -15158,20 +15336,20 @@ class BindingParser {
|
|
|
15158
15336
|
this._reportError(`The animation trigger output event (@${eventName}) is missing its phase value name (start or done are currently supported)`, sourceSpan);
|
|
15159
15337
|
}
|
|
15160
15338
|
}
|
|
15161
|
-
_parseRegularEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
15339
|
+
_parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
15162
15340
|
// long format: 'target: eventName'
|
|
15163
15341
|
const [target, eventName] = splitAtColon(name, [null, name]);
|
|
15164
|
-
const ast = this._parseAction(expression, handlerSpan);
|
|
15342
|
+
const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
|
|
15165
15343
|
targetMatchableAttrs.push([name, ast.source]);
|
|
15166
15344
|
targetEvents.push(new ParsedEvent(eventName, target, 0 /* Regular */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15167
15345
|
// Don't detect directives for event names for now,
|
|
15168
15346
|
// so don't add the event name to the matchableAttrs
|
|
15169
15347
|
}
|
|
15170
|
-
_parseAction(value, sourceSpan) {
|
|
15348
|
+
_parseAction(value, isAssignmentEvent, sourceSpan) {
|
|
15171
15349
|
const sourceInfo = (sourceSpan && sourceSpan.start || '(unknown').toString();
|
|
15172
15350
|
const absoluteOffset = (sourceSpan && sourceSpan.start) ? sourceSpan.start.offset : 0;
|
|
15173
15351
|
try {
|
|
15174
|
-
const ast = this._exprParser.parseAction(value, sourceInfo, absoluteOffset, this._interpolationConfig);
|
|
15352
|
+
const ast = this._exprParser.parseAction(value, isAssignmentEvent, sourceInfo, absoluteOffset, this._interpolationConfig);
|
|
15175
15353
|
if (ast) {
|
|
15176
15354
|
this._reportExpressionParserErrors(ast.errors, sourceSpan);
|
|
15177
15355
|
}
|
|
@@ -15531,7 +15709,7 @@ class HtmlAstToIvyAst {
|
|
|
15531
15709
|
return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, attribute.keySpan, attribute.valueSpan, attribute.i18n);
|
|
15532
15710
|
}
|
|
15533
15711
|
visitText(text) {
|
|
15534
|
-
return this._visitTextWithInterpolation(text.value, text.sourceSpan, text.i18n);
|
|
15712
|
+
return this._visitTextWithInterpolation(text.value, text.sourceSpan, text.tokens, text.i18n);
|
|
15535
15713
|
}
|
|
15536
15714
|
visitExpansion(expansion) {
|
|
15537
15715
|
if (!expansion.i18n) {
|
|
@@ -15561,7 +15739,7 @@ class HtmlAstToIvyAst {
|
|
|
15561
15739
|
vars[formattedKey] = new BoundText(ast, value.sourceSpan);
|
|
15562
15740
|
}
|
|
15563
15741
|
else {
|
|
15564
|
-
placeholders[key] = this._visitTextWithInterpolation(value.text, value.sourceSpan);
|
|
15742
|
+
placeholders[key] = this._visitTextWithInterpolation(value.text, value.sourceSpan, null);
|
|
15565
15743
|
}
|
|
15566
15744
|
});
|
|
15567
15745
|
return new Icu$1(vars, placeholders, expansion.sourceSpan, message);
|
|
@@ -15633,7 +15811,7 @@ class HtmlAstToIvyAst {
|
|
|
15633
15811
|
const events = [];
|
|
15634
15812
|
const identifier = bindParts[IDENT_KW_IDX];
|
|
15635
15813
|
const keySpan = createKeySpan(srcSpan, bindParts[KW_ON_IDX], identifier);
|
|
15636
|
-
this.bindingParser.parseEvent(identifier, value, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
|
|
15814
|
+
this.bindingParser.parseEvent(identifier, value, /* isAssignmentEvent */ false, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
|
|
15637
15815
|
addEvents(events, boundEvents);
|
|
15638
15816
|
}
|
|
15639
15817
|
else if (bindParts[KW_BINDON_IDX]) {
|
|
@@ -15677,19 +15855,19 @@ class HtmlAstToIvyAst {
|
|
|
15677
15855
|
}
|
|
15678
15856
|
else {
|
|
15679
15857
|
const events = [];
|
|
15680
|
-
this.bindingParser.parseEvent(identifier, value, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
|
|
15858
|
+
this.bindingParser.parseEvent(identifier, value, /* isAssignmentEvent */ false, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events, keySpan);
|
|
15681
15859
|
addEvents(events, boundEvents);
|
|
15682
15860
|
}
|
|
15683
15861
|
return true;
|
|
15684
15862
|
}
|
|
15685
15863
|
// No explicit binding found.
|
|
15686
15864
|
const keySpan = createKeySpan(srcSpan, '' /* prefix */, name);
|
|
15687
|
-
const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan);
|
|
15865
|
+
const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan, attribute.valueTokens ?? null);
|
|
15688
15866
|
return hasBinding;
|
|
15689
15867
|
}
|
|
15690
|
-
_visitTextWithInterpolation(value, sourceSpan, i18n) {
|
|
15868
|
+
_visitTextWithInterpolation(value, sourceSpan, interpolatedTokens, i18n) {
|
|
15691
15869
|
const valueNoNgsp = replaceNgsp(value);
|
|
15692
|
-
const expr = this.bindingParser.parseInterpolation(valueNoNgsp, sourceSpan);
|
|
15870
|
+
const expr = this.bindingParser.parseInterpolation(valueNoNgsp, sourceSpan, interpolatedTokens);
|
|
15693
15871
|
return expr ? new BoundText(expr, sourceSpan, i18n) : new Text$3(valueNoNgsp, sourceSpan);
|
|
15694
15872
|
}
|
|
15695
15873
|
parseVariable(identifier, value, sourceSpan, keySpan, valueSpan, variables) {
|
|
@@ -15715,7 +15893,7 @@ class HtmlAstToIvyAst {
|
|
|
15715
15893
|
}
|
|
15716
15894
|
parseAssignmentEvent(name, expression, sourceSpan, valueSpan, targetMatchableAttrs, boundEvents, keySpan) {
|
|
15717
15895
|
const events = [];
|
|
15718
|
-
this.bindingParser.parseEvent(`${name}Change`, `${expression}=$event`, sourceSpan, valueSpan || sourceSpan, targetMatchableAttrs, events, keySpan);
|
|
15896
|
+
this.bindingParser.parseEvent(`${name}Change`, `${expression} =$event`, /* isAssignmentEvent */ true, sourceSpan, valueSpan || sourceSpan, targetMatchableAttrs, events, keySpan);
|
|
15719
15897
|
addEvents(events, boundEvents);
|
|
15720
15898
|
}
|
|
15721
15899
|
reportError(message, sourceSpan, level = ParseErrorLevel.ERROR) {
|
|
@@ -16503,7 +16681,8 @@ class I18nMetaVisitor {
|
|
|
16503
16681
|
*/
|
|
16504
16682
|
_parseMetadata(meta) {
|
|
16505
16683
|
return typeof meta === 'string' ? parseI18nMeta(meta) :
|
|
16506
|
-
meta instanceof Message ? meta :
|
|
16684
|
+
meta instanceof Message ? meta :
|
|
16685
|
+
{};
|
|
16507
16686
|
}
|
|
16508
16687
|
/**
|
|
16509
16688
|
* Generate (or restore) message id if not specified already.
|
|
@@ -16528,9 +16707,9 @@ class I18nMetaVisitor {
|
|
|
16528
16707
|
// `packages/compiler/src/render3/view/template.ts`).
|
|
16529
16708
|
// In that case we want to reuse the legacy message generated in the 1st pass (see
|
|
16530
16709
|
// `setI18nRefs()`).
|
|
16531
|
-
const previousMessage = meta instanceof Message ?
|
|
16532
|
-
meta :
|
|
16533
|
-
|
|
16710
|
+
const previousMessage = meta instanceof Message ? meta :
|
|
16711
|
+
meta instanceof IcuPlaceholder ? meta.previousMessage :
|
|
16712
|
+
undefined;
|
|
16534
16713
|
message.legacyIds = previousMessage ? previousMessage.legacyIds : [];
|
|
16535
16714
|
}
|
|
16536
16715
|
}
|
|
@@ -16575,10 +16754,14 @@ function i18nMetaToJSDoc(meta) {
|
|
|
16575
16754
|
if (meta.description) {
|
|
16576
16755
|
tags.push({ tagName: "desc" /* Desc */, text: meta.description });
|
|
16577
16756
|
}
|
|
16757
|
+
else {
|
|
16758
|
+
// Suppress the JSCompiler warning that a `@desc` was not given for this message.
|
|
16759
|
+
tags.push({ tagName: "suppress" /* Suppress */, text: '{msgDescriptions}' });
|
|
16760
|
+
}
|
|
16578
16761
|
if (meta.meaning) {
|
|
16579
16762
|
tags.push({ tagName: "meaning" /* Meaning */, text: meta.meaning });
|
|
16580
16763
|
}
|
|
16581
|
-
return
|
|
16764
|
+
return jsDocComment(tags);
|
|
16582
16765
|
}
|
|
16583
16766
|
|
|
16584
16767
|
/** Closure uses `goog.getMsg(message)` to lookup translations */
|
|
@@ -16596,10 +16779,7 @@ function createGoogleGetMsgStatements(variable$1, message, closureVar, params) {
|
|
|
16596
16779
|
// const MSG_... = goog.getMsg(..);
|
|
16597
16780
|
// I18N_X = MSG_...;
|
|
16598
16781
|
const googGetMsgStmt = closureVar.set(variable(GOOG_GET_MSG).callFn(args)).toConstDecl();
|
|
16599
|
-
|
|
16600
|
-
if (metaComment !== null) {
|
|
16601
|
-
googGetMsgStmt.addLeadingComment(metaComment);
|
|
16602
|
-
}
|
|
16782
|
+
googGetMsgStmt.addLeadingComment(i18nMetaToJSDoc(message));
|
|
16603
16783
|
const i18nAssignmentStmt = new ExpressionStatement(variable$1.set(closureVar));
|
|
16604
16784
|
return [googGetMsgStmt, i18nAssignmentStmt];
|
|
16605
16785
|
}
|
|
@@ -16779,13 +16959,27 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
|
|
|
16779
16959
|
scope.getOrCreateSharedContextVar(0);
|
|
16780
16960
|
const bindingStatements = convertActionBinding(scope, implicitReceiverExpr, handler, 'b', eventAst.handlerSpan, implicitReceiverAccesses, EVENT_BINDING_SCOPE_GLOBALS);
|
|
16781
16961
|
const statements = [];
|
|
16782
|
-
|
|
16962
|
+
const variableDeclarations = scope?.variableDeclarations();
|
|
16963
|
+
const restoreViewStatement = scope?.restoreViewStatement();
|
|
16964
|
+
if (variableDeclarations) {
|
|
16783
16965
|
// `variableDeclarations` needs to run first, because
|
|
16784
16966
|
// `restoreViewStatement` depends on the result.
|
|
16785
|
-
statements.push(...
|
|
16786
|
-
statements.unshift(...scope.restoreViewStatement());
|
|
16967
|
+
statements.push(...variableDeclarations);
|
|
16787
16968
|
}
|
|
16788
16969
|
statements.push(...bindingStatements);
|
|
16970
|
+
if (restoreViewStatement) {
|
|
16971
|
+
statements.unshift(restoreViewStatement);
|
|
16972
|
+
// If there's a `restoreView` call, we need to reset the view at the end of the listener
|
|
16973
|
+
// in order to avoid a leak. If there's a `return` statement already, we wrap it in the
|
|
16974
|
+
// call, e.g. `return resetView(ctx.foo())`. Otherwise we add the call as the last statement.
|
|
16975
|
+
const lastStatement = statements[statements.length - 1];
|
|
16976
|
+
if (lastStatement instanceof ReturnStatement) {
|
|
16977
|
+
statements[statements.length - 1] = new ReturnStatement(invokeInstruction(lastStatement.value.sourceSpan, Identifiers.resetView, [lastStatement.value]));
|
|
16978
|
+
}
|
|
16979
|
+
else {
|
|
16980
|
+
statements.push(new ExpressionStatement(invokeInstruction(null, Identifiers.resetView, [])));
|
|
16981
|
+
}
|
|
16982
|
+
}
|
|
16789
16983
|
const eventName = type === 1 /* Animation */ ? prepareSyntheticListenerName(name, phase) : name;
|
|
16790
16984
|
const fnName = handlerName && sanitizeIdentifier(handlerName);
|
|
16791
16985
|
const fnArgs = [];
|
|
@@ -16929,9 +17123,9 @@ class TemplateDefinitionBuilder {
|
|
|
16929
17123
|
this.i18nEnd(null, selfClosingI18nInstruction);
|
|
16930
17124
|
}
|
|
16931
17125
|
// Generate all the creation mode instructions (e.g. resolve bindings in listeners)
|
|
16932
|
-
const creationStatements = this._creationCodeFns
|
|
17126
|
+
const creationStatements = getInstructionStatements(this._creationCodeFns);
|
|
16933
17127
|
// Generate all the update mode instructions (e.g. resolve property or text bindings)
|
|
16934
|
-
const updateStatements = this._updateCodeFns
|
|
17128
|
+
const updateStatements = getInstructionStatements(this._updateCodeFns);
|
|
16935
17129
|
// Variable declaration must occur after binding resolution so we can generate context
|
|
16936
17130
|
// instructions that build on each other.
|
|
16937
17131
|
// e.g. const b = nextContext().$implicit(); const b = nextContext();
|
|
@@ -17084,7 +17278,7 @@ class TemplateDefinitionBuilder {
|
|
|
17084
17278
|
if (Object.keys(icuMapping).length) {
|
|
17085
17279
|
args.push(mapLiteral(icuMapping, true));
|
|
17086
17280
|
}
|
|
17087
|
-
return
|
|
17281
|
+
return invokeInstruction(null, Identifiers.i18nPostprocess, args);
|
|
17088
17282
|
};
|
|
17089
17283
|
}
|
|
17090
17284
|
this.i18nTranslate(meta, params, context.ref, transformFn);
|
|
@@ -17119,14 +17313,12 @@ class TemplateDefinitionBuilder {
|
|
|
17119
17313
|
// setup accumulated bindings
|
|
17120
17314
|
const { index, bindings } = this.i18n;
|
|
17121
17315
|
if (bindings.size) {
|
|
17122
|
-
const
|
|
17123
|
-
|
|
17124
|
-
|
|
17125
|
-
|
|
17126
|
-
|
|
17127
|
-
|
|
17128
|
-
// necessary lifecycle hooks of components/directives are properly flushed.
|
|
17129
|
-
this.updateInstructionChainWithAdvance(this.getConstCount() - 1, Identifiers.i18nExp, chainBindings);
|
|
17316
|
+
for (const binding of bindings) {
|
|
17317
|
+
// for i18n block, advance to the most recent element index (by taking the current number of
|
|
17318
|
+
// elements and subtracting one) before invoking `i18nExp` instructions, to make sure the
|
|
17319
|
+
// necessary lifecycle hooks of components/directives are properly flushed.
|
|
17320
|
+
this.updateInstructionWithAdvance(this.getConstCount() - 1, span, Identifiers.i18nExp, () => this.convertPropertyBinding(binding));
|
|
17321
|
+
}
|
|
17130
17322
|
this.updateInstruction(span, Identifiers.i18nApply, [literal(index)]);
|
|
17131
17323
|
}
|
|
17132
17324
|
if (!selfClosing) {
|
|
@@ -17137,7 +17329,6 @@ class TemplateDefinitionBuilder {
|
|
|
17137
17329
|
i18nAttributesInstruction(nodeIndex, attrs, sourceSpan) {
|
|
17138
17330
|
let hasBindings = false;
|
|
17139
17331
|
const i18nAttrArgs = [];
|
|
17140
|
-
const bindings = [];
|
|
17141
17332
|
attrs.forEach(attr => {
|
|
17142
17333
|
const message = attr.i18n;
|
|
17143
17334
|
const converted = attr.value.visit(this._valueConverter);
|
|
@@ -17148,16 +17339,10 @@ class TemplateDefinitionBuilder {
|
|
|
17148
17339
|
i18nAttrArgs.push(literal(attr.name), this.i18nTranslate(message, params));
|
|
17149
17340
|
converted.expressions.forEach(expression => {
|
|
17150
17341
|
hasBindings = true;
|
|
17151
|
-
|
|
17152
|
-
sourceSpan,
|
|
17153
|
-
value: () => this.convertPropertyBinding(expression),
|
|
17154
|
-
});
|
|
17342
|
+
this.updateInstructionWithAdvance(nodeIndex, sourceSpan, Identifiers.i18nExp, () => this.convertPropertyBinding(expression));
|
|
17155
17343
|
});
|
|
17156
17344
|
}
|
|
17157
17345
|
});
|
|
17158
|
-
if (bindings.length > 0) {
|
|
17159
|
-
this.updateInstructionChainWithAdvance(nodeIndex, Identifiers.i18nExp, bindings);
|
|
17160
|
-
}
|
|
17161
17346
|
if (i18nAttrArgs.length > 0) {
|
|
17162
17347
|
const index = literal(this.allocateDataSlot());
|
|
17163
17348
|
const constIndex = this.addToConsts(literalArr(i18nAttrArgs));
|
|
@@ -17285,11 +17470,9 @@ class TemplateDefinitionBuilder {
|
|
|
17285
17470
|
}
|
|
17286
17471
|
// Generate Listeners (outputs)
|
|
17287
17472
|
if (element.outputs.length > 0) {
|
|
17288
|
-
const
|
|
17289
|
-
|
|
17290
|
-
|
|
17291
|
-
}));
|
|
17292
|
-
this.creationInstructionChain(Identifiers.listener, listeners);
|
|
17473
|
+
for (const outputAst of element.outputs) {
|
|
17474
|
+
this.creationInstruction(outputAst.sourceSpan, Identifiers.listener, this.prepareListenerParameter(element.name, outputAst, elementIndex));
|
|
17475
|
+
}
|
|
17293
17476
|
}
|
|
17294
17477
|
// Note: it's important to keep i18n/i18nStart instructions after i18nAttributes and
|
|
17295
17478
|
// listeners, to make sure i18nAttributes instruction targets current element at runtime.
|
|
@@ -17330,9 +17513,8 @@ class TemplateDefinitionBuilder {
|
|
|
17330
17513
|
const hasValue = value instanceof LiteralPrimitive ? !!value.value : true;
|
|
17331
17514
|
this.allocateBindingSlots(value);
|
|
17332
17515
|
propertyBindings.push({
|
|
17333
|
-
|
|
17334
|
-
|
|
17335
|
-
value: () => hasValue ? this.convertPropertyBinding(value) : emptyValueBindInstruction
|
|
17516
|
+
span: input.sourceSpan,
|
|
17517
|
+
paramsOrFn: getBindingFunctionParams(() => hasValue ? this.convertPropertyBinding(value) : emptyValueBindInstruction, prepareSyntheticPropertyName(input.name))
|
|
17336
17518
|
});
|
|
17337
17519
|
}
|
|
17338
17520
|
else {
|
|
@@ -17369,10 +17551,8 @@ class TemplateDefinitionBuilder {
|
|
|
17369
17551
|
// [prop]="value"
|
|
17370
17552
|
// Collect all the properties so that we can chain into a single function at the end.
|
|
17371
17553
|
propertyBindings.push({
|
|
17372
|
-
|
|
17373
|
-
|
|
17374
|
-
value: () => this.convertPropertyBinding(value),
|
|
17375
|
-
params
|
|
17554
|
+
span: input.sourceSpan,
|
|
17555
|
+
paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(value), attrName, params)
|
|
17376
17556
|
});
|
|
17377
17557
|
}
|
|
17378
17558
|
}
|
|
@@ -17386,10 +17566,8 @@ class TemplateDefinitionBuilder {
|
|
|
17386
17566
|
// [attr.name]="value" or attr.name="{{value}}"
|
|
17387
17567
|
// Collect the attribute bindings so that they can be chained at the end.
|
|
17388
17568
|
attributeBindings.push({
|
|
17389
|
-
|
|
17390
|
-
|
|
17391
|
-
value: () => this.convertPropertyBinding(boundValue),
|
|
17392
|
-
params
|
|
17569
|
+
span: input.sourceSpan,
|
|
17570
|
+
paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(boundValue), attrName, params)
|
|
17393
17571
|
});
|
|
17394
17572
|
}
|
|
17395
17573
|
}
|
|
@@ -17405,11 +17583,11 @@ class TemplateDefinitionBuilder {
|
|
|
17405
17583
|
}
|
|
17406
17584
|
}
|
|
17407
17585
|
});
|
|
17408
|
-
|
|
17409
|
-
this.
|
|
17586
|
+
for (const propertyBinding of propertyBindings) {
|
|
17587
|
+
this.updateInstructionWithAdvance(elementIndex, propertyBinding.span, Identifiers.property, propertyBinding.paramsOrFn);
|
|
17410
17588
|
}
|
|
17411
|
-
|
|
17412
|
-
this.
|
|
17589
|
+
for (const attributeBinding of attributeBindings) {
|
|
17590
|
+
this.updateInstructionWithAdvance(elementIndex, attributeBinding.span, Identifiers.attribute, attributeBinding.paramsOrFn);
|
|
17413
17591
|
}
|
|
17414
17592
|
// Traverse element child nodes
|
|
17415
17593
|
visitAll$1(this, element.children);
|
|
@@ -17488,12 +17666,8 @@ class TemplateDefinitionBuilder {
|
|
|
17488
17666
|
this.templatePropertyBindings(templateIndex, inputs);
|
|
17489
17667
|
}
|
|
17490
17668
|
// Generate listeners for directive output
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
sourceSpan: outputAst.sourceSpan,
|
|
17494
|
-
params: this.prepareListenerParameter('ng_template', outputAst, templateIndex)
|
|
17495
|
-
}));
|
|
17496
|
-
this.creationInstructionChain(Identifiers.listener, listeners);
|
|
17669
|
+
for (const outputAst of template.outputs) {
|
|
17670
|
+
this.creationInstruction(outputAst.sourceSpan, Identifiers.listener, this.prepareListenerParameter('ng_template', outputAst, templateIndex));
|
|
17497
17671
|
}
|
|
17498
17672
|
}
|
|
17499
17673
|
}
|
|
@@ -17548,7 +17722,7 @@ class TemplateDefinitionBuilder {
|
|
|
17548
17722
|
const transformFn = (raw) => {
|
|
17549
17723
|
const params = { ...vars, ...placeholders };
|
|
17550
17724
|
const formatted = i18nFormatPlaceholderNames(params, /* useCamelCase */ false);
|
|
17551
|
-
return
|
|
17725
|
+
return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
|
|
17552
17726
|
};
|
|
17553
17727
|
// in case the whole i18n message is a single ICU - we do not need to
|
|
17554
17728
|
// create a separate top-level translation, we can use the root ref instead
|
|
@@ -17590,32 +17764,33 @@ class TemplateDefinitionBuilder {
|
|
|
17590
17764
|
}
|
|
17591
17765
|
templatePropertyBindings(templateIndex, attrs) {
|
|
17592
17766
|
const propertyBindings = [];
|
|
17593
|
-
|
|
17594
|
-
if (input instanceof BoundAttribute) {
|
|
17595
|
-
|
|
17596
|
-
if (value !== undefined) {
|
|
17597
|
-
this.allocateBindingSlots(value);
|
|
17598
|
-
if (value instanceof Interpolation) {
|
|
17599
|
-
// Params typically contain attribute namespace and value sanitizer, which is applicable
|
|
17600
|
-
// for regular HTML elements, but not applicable for <ng-template> (since props act as
|
|
17601
|
-
// inputs to directives), so keep params array empty.
|
|
17602
|
-
const params = [];
|
|
17603
|
-
// prop="{{value}}" case
|
|
17604
|
-
this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), templateIndex, input.name, input, value, params);
|
|
17605
|
-
}
|
|
17606
|
-
else {
|
|
17607
|
-
// [prop]="value" case
|
|
17608
|
-
propertyBindings.push({
|
|
17609
|
-
name: input.name,
|
|
17610
|
-
sourceSpan: input.sourceSpan,
|
|
17611
|
-
value: () => this.convertPropertyBinding(value)
|
|
17612
|
-
});
|
|
17613
|
-
}
|
|
17614
|
-
}
|
|
17767
|
+
for (const input of attrs) {
|
|
17768
|
+
if (!(input instanceof BoundAttribute)) {
|
|
17769
|
+
continue;
|
|
17615
17770
|
}
|
|
17616
|
-
|
|
17617
|
-
|
|
17618
|
-
|
|
17771
|
+
const value = input.value.visit(this._valueConverter);
|
|
17772
|
+
if (value === undefined) {
|
|
17773
|
+
continue;
|
|
17774
|
+
}
|
|
17775
|
+
this.allocateBindingSlots(value);
|
|
17776
|
+
if (value instanceof Interpolation) {
|
|
17777
|
+
// Params typically contain attribute namespace and value sanitizer, which is applicable
|
|
17778
|
+
// for regular HTML elements, but not applicable for <ng-template> (since props act as
|
|
17779
|
+
// inputs to directives), so keep params array empty.
|
|
17780
|
+
const params = [];
|
|
17781
|
+
// prop="{{value}}" case
|
|
17782
|
+
this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), templateIndex, input.name, input, value, params);
|
|
17783
|
+
}
|
|
17784
|
+
else {
|
|
17785
|
+
// [prop]="value" case
|
|
17786
|
+
propertyBindings.push({
|
|
17787
|
+
span: input.sourceSpan,
|
|
17788
|
+
paramsOrFn: getBindingFunctionParams(() => this.convertPropertyBinding(value), input.name)
|
|
17789
|
+
});
|
|
17790
|
+
}
|
|
17791
|
+
}
|
|
17792
|
+
for (const propertyBinding of propertyBindings) {
|
|
17793
|
+
this.updateInstructionWithAdvance(templateIndex, propertyBinding.span, Identifiers.property, propertyBinding.paramsOrFn);
|
|
17619
17794
|
}
|
|
17620
17795
|
}
|
|
17621
17796
|
// Bindings must only be resolved after all local refs have been visited, so all
|
|
@@ -17623,39 +17798,23 @@ class TemplateDefinitionBuilder {
|
|
|
17623
17798
|
// Otherwise, we wouldn't be able to support local refs that are defined after their
|
|
17624
17799
|
// bindings. e.g. {{ foo }} <div #foo></div>
|
|
17625
17800
|
instructionFn(fns, span, reference, paramsOrFn, prepend = false) {
|
|
17626
|
-
fns[prepend ? 'unshift' : 'push'](
|
|
17627
|
-
const params = Array.isArray(paramsOrFn) ? paramsOrFn : paramsOrFn();
|
|
17628
|
-
return instruction(span, reference, params).toStmt();
|
|
17629
|
-
});
|
|
17801
|
+
fns[prepend ? 'unshift' : 'push']({ span, reference, paramsOrFn });
|
|
17630
17802
|
}
|
|
17631
17803
|
processStylingUpdateInstruction(elementIndex, instruction) {
|
|
17632
17804
|
let allocateBindingSlots = 0;
|
|
17633
17805
|
if (instruction) {
|
|
17634
|
-
const calls
|
|
17635
|
-
instruction.calls.forEach(call => {
|
|
17806
|
+
for (const call of instruction.calls) {
|
|
17636
17807
|
allocateBindingSlots += call.allocateBindingSlots;
|
|
17637
|
-
|
|
17638
|
-
|
|
17639
|
-
value
|
|
17640
|
-
|
|
17641
|
-
this.getUpdateInstructionArguments(value) :
|
|
17642
|
-
this.convertPropertyBinding(value));
|
|
17643
|
-
}
|
|
17644
|
-
});
|
|
17645
|
-
});
|
|
17646
|
-
this.updateInstructionChainWithAdvance(elementIndex, instruction.reference, calls);
|
|
17808
|
+
this.updateInstructionWithAdvance(elementIndex, call.sourceSpan, instruction.reference, () => call.params(value => (call.supportsInterpolation && value instanceof Interpolation) ?
|
|
17809
|
+
this.getUpdateInstructionArguments(value) :
|
|
17810
|
+
this.convertPropertyBinding(value)));
|
|
17811
|
+
}
|
|
17647
17812
|
}
|
|
17648
17813
|
return allocateBindingSlots;
|
|
17649
17814
|
}
|
|
17650
17815
|
creationInstruction(span, reference, paramsOrFn, prepend) {
|
|
17651
17816
|
this.instructionFn(this._creationCodeFns, span, reference, paramsOrFn || [], prepend);
|
|
17652
17817
|
}
|
|
17653
|
-
creationInstructionChain(reference, calls) {
|
|
17654
|
-
const span = calls.length ? calls[0].sourceSpan : null;
|
|
17655
|
-
this._creationCodeFns.push(() => {
|
|
17656
|
-
return chainedInstruction(reference, calls.map(call => call.params()), span).toStmt();
|
|
17657
|
-
});
|
|
17658
|
-
}
|
|
17659
17818
|
updateInstructionWithAdvance(nodeIndex, span, reference, paramsOrFn) {
|
|
17660
17819
|
this.addAdvanceInstructionIfNecessary(nodeIndex, span);
|
|
17661
17820
|
this.updateInstruction(span, reference, paramsOrFn);
|
|
@@ -17663,28 +17822,6 @@ class TemplateDefinitionBuilder {
|
|
|
17663
17822
|
updateInstruction(span, reference, paramsOrFn) {
|
|
17664
17823
|
this.instructionFn(this._updateCodeFns, span, reference, paramsOrFn || []);
|
|
17665
17824
|
}
|
|
17666
|
-
updateInstructionChain(reference, bindings) {
|
|
17667
|
-
const span = bindings.length ? bindings[0].sourceSpan : null;
|
|
17668
|
-
this._updateCodeFns.push(() => {
|
|
17669
|
-
const calls = bindings.map(property => {
|
|
17670
|
-
const value = property.value();
|
|
17671
|
-
const fnParams = Array.isArray(value) ? value : [value];
|
|
17672
|
-
if (property.params) {
|
|
17673
|
-
fnParams.push(...property.params);
|
|
17674
|
-
}
|
|
17675
|
-
if (property.name) {
|
|
17676
|
-
// We want the property name to always be the first function parameter.
|
|
17677
|
-
fnParams.unshift(literal(property.name));
|
|
17678
|
-
}
|
|
17679
|
-
return fnParams;
|
|
17680
|
-
});
|
|
17681
|
-
return chainedInstruction(reference, calls, span).toStmt();
|
|
17682
|
-
});
|
|
17683
|
-
}
|
|
17684
|
-
updateInstructionChainWithAdvance(nodeIndex, reference, bindings) {
|
|
17685
|
-
this.addAdvanceInstructionIfNecessary(nodeIndex, bindings.length ? bindings[0].sourceSpan : null);
|
|
17686
|
-
this.updateInstructionChain(reference, bindings);
|
|
17687
|
-
}
|
|
17688
17825
|
addAdvanceInstructionIfNecessary(nodeIndex, span) {
|
|
17689
17826
|
if (nodeIndex !== this._currentIndex) {
|
|
17690
17827
|
const delta = nodeIndex - this._currentIndex;
|
|
@@ -17970,9 +18107,6 @@ function pureFunctionCallInfo(args) {
|
|
|
17970
18107
|
isVarLength: !identifier,
|
|
17971
18108
|
};
|
|
17972
18109
|
}
|
|
17973
|
-
function instruction(span, reference, params) {
|
|
17974
|
-
return importExpr(reference, null, span).callFn(params, span);
|
|
17975
|
-
}
|
|
17976
18110
|
// e.g. x(2);
|
|
17977
18111
|
function generateNextContextExpr(relativeLevelDiff) {
|
|
17978
18112
|
return importExpr(Identifiers.nextContext)
|
|
@@ -18175,21 +18309,22 @@ class BindingScope {
|
|
|
18175
18309
|
}
|
|
18176
18310
|
}
|
|
18177
18311
|
restoreViewStatement() {
|
|
18178
|
-
const statements = [];
|
|
18179
18312
|
if (this.restoreViewVariable) {
|
|
18180
|
-
const restoreCall =
|
|
18313
|
+
const restoreCall = invokeInstruction(null, Identifiers.restoreView, [this.restoreViewVariable]);
|
|
18181
18314
|
// Either `const restoredCtx = restoreView($state$);` or `restoreView($state$);`
|
|
18182
18315
|
// depending on whether it is being used.
|
|
18183
|
-
|
|
18316
|
+
return this.usesRestoredViewContext ?
|
|
18184
18317
|
variable(RESTORED_VIEW_CONTEXT_NAME).set(restoreCall).toConstDecl() :
|
|
18185
|
-
restoreCall.toStmt()
|
|
18318
|
+
restoreCall.toStmt();
|
|
18186
18319
|
}
|
|
18187
|
-
return
|
|
18320
|
+
return null;
|
|
18188
18321
|
}
|
|
18189
18322
|
viewSnapshotStatements() {
|
|
18190
18323
|
// const $state$ = getCurrentView();
|
|
18191
18324
|
return this.restoreViewVariable ?
|
|
18192
|
-
[
|
|
18325
|
+
[
|
|
18326
|
+
this.restoreViewVariable.set(invokeInstruction(null, Identifiers.getCurrentView, [])).toConstDecl()
|
|
18327
|
+
] :
|
|
18193
18328
|
[];
|
|
18194
18329
|
}
|
|
18195
18330
|
isListenerScope() {
|
|
@@ -18462,6 +18597,20 @@ function isTextNode(node) {
|
|
|
18462
18597
|
function hasTextChildrenOnly(children) {
|
|
18463
18598
|
return children.every(isTextNode);
|
|
18464
18599
|
}
|
|
18600
|
+
function getBindingFunctionParams(deferredParams, name, eagerParams) {
|
|
18601
|
+
return () => {
|
|
18602
|
+
const value = deferredParams();
|
|
18603
|
+
const fnParams = Array.isArray(value) ? value : [value];
|
|
18604
|
+
if (eagerParams) {
|
|
18605
|
+
fnParams.push(...eagerParams);
|
|
18606
|
+
}
|
|
18607
|
+
if (name) {
|
|
18608
|
+
// We want the property name to always be the first function parameter.
|
|
18609
|
+
fnParams.unshift(literal(name));
|
|
18610
|
+
}
|
|
18611
|
+
return fnParams;
|
|
18612
|
+
};
|
|
18613
|
+
}
|
|
18465
18614
|
/** Name of the global variable that is used to determine if we use Closure translations or not */
|
|
18466
18615
|
const NG_I18N_CLOSURE_MODE = 'ngI18nClosureMode';
|
|
18467
18616
|
/**
|
|
@@ -18558,6 +18707,9 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
|
18558
18707
|
if (meta.exportAs !== null) {
|
|
18559
18708
|
definitionMap.set('exportAs', literalArr(meta.exportAs.map(e => literal(e))));
|
|
18560
18709
|
}
|
|
18710
|
+
if (meta.isStandalone) {
|
|
18711
|
+
definitionMap.set('standalone', literal(true));
|
|
18712
|
+
}
|
|
18561
18713
|
return definitionMap;
|
|
18562
18714
|
}
|
|
18563
18715
|
/**
|
|
@@ -18843,14 +18995,14 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
18843
18995
|
if (classAttr !== undefined) {
|
|
18844
18996
|
styleBuilder.registerClassAttr(classAttr);
|
|
18845
18997
|
}
|
|
18846
|
-
const
|
|
18847
|
-
const
|
|
18998
|
+
const createInstructions = [];
|
|
18999
|
+
const updateInstructions = [];
|
|
19000
|
+
const updateVariables = [];
|
|
18848
19001
|
const hostBindingSourceSpan = typeSourceSpan;
|
|
18849
19002
|
// Calculate host event bindings
|
|
18850
19003
|
const eventBindings = bindingParser.createDirectiveHostEventAsts(hostBindingsMetadata.listeners, hostBindingSourceSpan);
|
|
18851
19004
|
if (eventBindings && eventBindings.length) {
|
|
18852
|
-
|
|
18853
|
-
createStatements.push(...listeners);
|
|
19005
|
+
createInstructions.push(...createHostListeners(eventBindings, name));
|
|
18854
19006
|
}
|
|
18855
19007
|
// Calculate the host property bindings
|
|
18856
19008
|
const bindings = bindingParser.createBoundHostProperties(hostBindingsMetadata.properties, hostBindingSourceSpan);
|
|
@@ -18886,7 +19038,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
18886
19038
|
const propertyBindings = [];
|
|
18887
19039
|
const attributeBindings = [];
|
|
18888
19040
|
const syntheticHostBindings = [];
|
|
18889
|
-
|
|
19041
|
+
for (const binding of allOtherBindings) {
|
|
18890
19042
|
// resolve literal arrays and literal objects
|
|
18891
19043
|
const value = binding.expression.visit(getValueConverter());
|
|
18892
19044
|
const bindingExpr = bindingFn(bindingContext, value);
|
|
@@ -18912,7 +19064,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
18912
19064
|
if (sanitizerFn) {
|
|
18913
19065
|
instructionParams.push(sanitizerFn);
|
|
18914
19066
|
}
|
|
18915
|
-
|
|
19067
|
+
updateVariables.push(...bindingExpr.stmts);
|
|
18916
19068
|
if (instruction === Identifiers.hostProperty) {
|
|
18917
19069
|
propertyBindings.push(instructionParams);
|
|
18918
19070
|
}
|
|
@@ -18923,17 +19075,17 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
18923
19075
|
syntheticHostBindings.push(instructionParams);
|
|
18924
19076
|
}
|
|
18925
19077
|
else {
|
|
18926
|
-
|
|
19078
|
+
updateInstructions.push({ reference: instruction, paramsOrFn: instructionParams, span: null });
|
|
18927
19079
|
}
|
|
18928
|
-
});
|
|
18929
|
-
if (propertyBindings.length > 0) {
|
|
18930
|
-
updateStatements.push(chainedInstruction(Identifiers.hostProperty, propertyBindings).toStmt());
|
|
18931
19080
|
}
|
|
18932
|
-
|
|
18933
|
-
|
|
19081
|
+
for (const bindingParams of propertyBindings) {
|
|
19082
|
+
updateInstructions.push({ reference: Identifiers.hostProperty, paramsOrFn: bindingParams, span: null });
|
|
18934
19083
|
}
|
|
18935
|
-
|
|
18936
|
-
|
|
19084
|
+
for (const bindingParams of attributeBindings) {
|
|
19085
|
+
updateInstructions.push({ reference: Identifiers.attribute, paramsOrFn: bindingParams, span: null });
|
|
19086
|
+
}
|
|
19087
|
+
for (const bindingParams of syntheticHostBindings) {
|
|
19088
|
+
updateInstructions.push({ reference: Identifiers.syntheticHostProperty, paramsOrFn: bindingParams, span: null });
|
|
18937
19089
|
}
|
|
18938
19090
|
// since we're dealing with directives/components and both have hostBinding
|
|
18939
19091
|
// functions, we need to generate a special hostAttrs instruction that deals
|
|
@@ -18949,30 +19101,30 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
18949
19101
|
// the update block of a component/directive templateFn/hostBindingsFn so that the bindings
|
|
18950
19102
|
// are evaluated and updated for the element.
|
|
18951
19103
|
styleBuilder.buildUpdateLevelInstructions(getValueConverter()).forEach(instruction => {
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
18955
|
-
|
|
18956
|
-
|
|
18957
|
-
|
|
18958
|
-
|
|
18959
|
-
|
|
19104
|
+
for (const call of instruction.calls) {
|
|
19105
|
+
// we subtract a value of `1` here because the binding slot was already allocated
|
|
19106
|
+
// at the top of this method when all the input bindings were counted.
|
|
19107
|
+
totalHostVarsCount +=
|
|
19108
|
+
Math.max(call.allocateBindingSlots - MIN_STYLING_BINDING_SLOTS_REQUIRED, 0);
|
|
19109
|
+
updateInstructions.push({
|
|
19110
|
+
reference: instruction.reference,
|
|
19111
|
+
paramsOrFn: convertStylingCall(call, bindingContext, bindingFn),
|
|
19112
|
+
span: null
|
|
18960
19113
|
});
|
|
18961
|
-
updateStatements.push(chainedInstruction(instruction.reference, calls).toStmt());
|
|
18962
19114
|
}
|
|
18963
19115
|
});
|
|
18964
19116
|
}
|
|
18965
19117
|
if (totalHostVarsCount) {
|
|
18966
19118
|
definitionMap.set('hostVars', literal(totalHostVarsCount));
|
|
18967
19119
|
}
|
|
18968
|
-
if (
|
|
19120
|
+
if (createInstructions.length > 0 || updateInstructions.length > 0) {
|
|
18969
19121
|
const hostBindingsFnName = name ? `${name}_HostBindings` : null;
|
|
18970
19122
|
const statements = [];
|
|
18971
|
-
if (
|
|
18972
|
-
statements.push(renderFlagCheckIfStmt(1 /* Create */,
|
|
19123
|
+
if (createInstructions.length > 0) {
|
|
19124
|
+
statements.push(renderFlagCheckIfStmt(1 /* Create */, getInstructionStatements(createInstructions)));
|
|
18973
19125
|
}
|
|
18974
|
-
if (
|
|
18975
|
-
statements.push(renderFlagCheckIfStmt(2 /* Update */,
|
|
19126
|
+
if (updateInstructions.length > 0) {
|
|
19127
|
+
statements.push(renderFlagCheckIfStmt(2 /* Update */, updateVariables.concat(getInstructionStatements(updateInstructions))));
|
|
18976
19128
|
}
|
|
18977
19129
|
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], statements, INFERRED_TYPE, null, hostBindingsFnName);
|
|
18978
19130
|
}
|
|
@@ -19008,10 +19160,10 @@ function getBindingNameAndInstruction(binding) {
|
|
|
19008
19160
|
return { bindingName, instruction, isAttribute: !!attrMatches };
|
|
19009
19161
|
}
|
|
19010
19162
|
function createHostListeners(eventBindings, name) {
|
|
19011
|
-
const
|
|
19012
|
-
const
|
|
19163
|
+
const listenerParams = [];
|
|
19164
|
+
const syntheticListenerParams = [];
|
|
19013
19165
|
const instructions = [];
|
|
19014
|
-
|
|
19166
|
+
for (const binding of eventBindings) {
|
|
19015
19167
|
let bindingName = binding.name && sanitizeIdentifier(binding.name);
|
|
19016
19168
|
const bindingFnName = binding.type === 1 /* Animation */ ?
|
|
19017
19169
|
prepareSyntheticListenerFunctionName(bindingName, binding.targetOrPhase) :
|
|
@@ -19019,17 +19171,17 @@ function createHostListeners(eventBindings, name) {
|
|
|
19019
19171
|
const handlerName = name && bindingName ? `${name}_${bindingFnName}_HostBindingHandler` : null;
|
|
19020
19172
|
const params = prepareEventListenerParameters(BoundEvent.fromParsedEvent(binding), handlerName);
|
|
19021
19173
|
if (binding.type == 1 /* Animation */) {
|
|
19022
|
-
|
|
19174
|
+
syntheticListenerParams.push(params);
|
|
19023
19175
|
}
|
|
19024
19176
|
else {
|
|
19025
|
-
|
|
19177
|
+
listenerParams.push(params);
|
|
19026
19178
|
}
|
|
19027
|
-
});
|
|
19028
|
-
if (syntheticListeners.length > 0) {
|
|
19029
|
-
instructions.push(chainedInstruction(Identifiers.syntheticHostListener, syntheticListeners).toStmt());
|
|
19030
19179
|
}
|
|
19031
|
-
|
|
19032
|
-
instructions.push(
|
|
19180
|
+
for (const params of syntheticListenerParams) {
|
|
19181
|
+
instructions.push({ reference: Identifiers.syntheticHostListener, paramsOrFn: params, span: null });
|
|
19182
|
+
}
|
|
19183
|
+
for (const params of listenerParams) {
|
|
19184
|
+
instructions.push({ reference: Identifiers.listener, paramsOrFn: params, span: null });
|
|
19033
19185
|
}
|
|
19034
19186
|
return instructions;
|
|
19035
19187
|
}
|
|
@@ -19150,6 +19302,7 @@ class CompilerFacadeImpl {
|
|
|
19150
19302
|
deps: null,
|
|
19151
19303
|
pipeName: facade.pipeName,
|
|
19152
19304
|
pure: facade.pure,
|
|
19305
|
+
isStandalone: facade.isStandalone,
|
|
19153
19306
|
};
|
|
19154
19307
|
const res = compilePipeFromMetadata(metadata);
|
|
19155
19308
|
return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, []);
|
|
@@ -19216,7 +19369,7 @@ class CompilerFacadeImpl {
|
|
|
19216
19369
|
declarations: facade.declarations.map(wrapReference),
|
|
19217
19370
|
imports: facade.imports.map(wrapReference),
|
|
19218
19371
|
exports: facade.exports.map(wrapReference),
|
|
19219
|
-
|
|
19372
|
+
selectorScopeMode: R3SelectorScopeMode.Inline,
|
|
19220
19373
|
containsForwardDecls: false,
|
|
19221
19374
|
schemas: facade.schemas ? facade.schemas.map(wrapReference) : null,
|
|
19222
19375
|
id: facade.id ? new WrappedNodeExpr(facade.id) : null,
|
|
@@ -19410,6 +19563,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
|
19410
19563
|
deps: null,
|
|
19411
19564
|
typeArgumentCount: 0,
|
|
19412
19565
|
fullInheritance: false,
|
|
19566
|
+
isStandalone: declaration.isStandalone ?? false,
|
|
19413
19567
|
};
|
|
19414
19568
|
}
|
|
19415
19569
|
function convertHostDeclarationToMetadata(host = {}) {
|
|
@@ -19591,6 +19745,7 @@ function convertDeclarePipeFacadeToMetadata(declaration) {
|
|
|
19591
19745
|
pipeName: declaration.name,
|
|
19592
19746
|
deps: null,
|
|
19593
19747
|
pure: declaration.pure ?? true,
|
|
19748
|
+
isStandalone: declaration.isStandalone ?? false,
|
|
19594
19749
|
};
|
|
19595
19750
|
}
|
|
19596
19751
|
function convertDeclareInjectorFacadeToMetadata(declaration) {
|
|
@@ -19617,7 +19772,7 @@ function publishFacade(global) {
|
|
|
19617
19772
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19618
19773
|
* found in the LICENSE file at https://angular.io/license
|
|
19619
19774
|
*/
|
|
19620
|
-
const VERSION = new Version('14.0.0-next.
|
|
19775
|
+
const VERSION = new Version('14.0.0-next.10');
|
|
19621
19776
|
|
|
19622
19777
|
/**
|
|
19623
19778
|
* @license
|
|
@@ -21658,7 +21813,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21658
21813
|
function compileDeclareClassMetadata(metadata) {
|
|
21659
21814
|
const definitionMap = new DefinitionMap();
|
|
21660
21815
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21661
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
21816
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
21662
21817
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21663
21818
|
definitionMap.set('type', metadata.type);
|
|
21664
21819
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -21775,7 +21930,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
21775
21930
|
function createDirectiveDefinitionMap(meta) {
|
|
21776
21931
|
const definitionMap = new DefinitionMap();
|
|
21777
21932
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
21778
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
21933
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
21779
21934
|
// e.g. `type: MyDirective`
|
|
21780
21935
|
definitionMap.set('type', meta.internalType);
|
|
21781
21936
|
// e.g. `selector: 'some-dir'`
|
|
@@ -21996,7 +22151,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
21996
22151
|
function compileDeclareFactoryFunction(meta) {
|
|
21997
22152
|
const definitionMap = new DefinitionMap();
|
|
21998
22153
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
21999
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22154
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22000
22155
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22001
22156
|
definitionMap.set('type', meta.internalType);
|
|
22002
22157
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22038,7 +22193,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22038
22193
|
function createInjectableDefinitionMap(meta) {
|
|
22039
22194
|
const definitionMap = new DefinitionMap();
|
|
22040
22195
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22041
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22196
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22042
22197
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22043
22198
|
definitionMap.set('type', meta.internalType);
|
|
22044
22199
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22096,7 +22251,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22096
22251
|
function createInjectorDefinitionMap(meta) {
|
|
22097
22252
|
const definitionMap = new DefinitionMap();
|
|
22098
22253
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22099
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22254
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22100
22255
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22101
22256
|
definitionMap.set('type', meta.internalType);
|
|
22102
22257
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22133,7 +22288,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22133
22288
|
function createNgModuleDefinitionMap(meta) {
|
|
22134
22289
|
const definitionMap = new DefinitionMap();
|
|
22135
22290
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22136
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22291
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22137
22292
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22138
22293
|
definitionMap.set('type', meta.internalType);
|
|
22139
22294
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22191,7 +22346,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22191
22346
|
function createPipeDefinitionMap(meta) {
|
|
22192
22347
|
const definitionMap = new DefinitionMap();
|
|
22193
22348
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22194
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22349
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22195
22350
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22196
22351
|
// e.g. `type: MyPipe`
|
|
22197
22352
|
definitionMap.set('type', meta.internalType);
|
|
@@ -22241,5 +22396,5 @@ publishFacade(_global);
|
|
|
22241
22396
|
* found in the LICENSE file at https://angular.io/license
|
|
22242
22397
|
*/
|
|
22243
22398
|
|
|
22244
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, 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, R3TargetBinder, 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, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, Element$1 as TmplAstElement, Icu$1 as TmplAstIcu, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, Variable as TmplAstVariable, Token, TokenType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassMetadata, 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, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
|
|
22399
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, 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, R3SelectorScopeMode, R3TargetBinder, 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, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, Element$1 as TmplAstElement, Icu$1 as TmplAstIcu, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, Variable as TmplAstVariable, Token, TokenType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassMetadata, 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, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
|
|
22245
22400
|
//# sourceMappingURL=compiler.mjs.map
|