@angular/compiler 13.3.0 → 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/compiler_util/expression_converter.mjs +1 -11
- package/esm2020/src/expression_parser/ast.mjs +1 -35
- package/esm2020/src/expression_parser/parser.mjs +3 -22
- package/esm2020/src/jit_compiler_facade.mjs +6 -3
- package/esm2020/src/ml_parser/lexer.mjs +2 -2
- 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/view/api.mjs +1 -1
- package/esm2020/src/render3/view/compiler.mjs +4 -1
- 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 +21 -8
- package/esm2020/src/selector.mjs +3 -3
- package/esm2020/src/shadow_css.mjs +2 -2
- package/esm2020/src/template_parser/binding_parser.mjs +2 -2
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +97 -99
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/compiler.mjs +95 -97
- 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/ast.d.ts +0 -25
- package/src/expression_parser/parser.d.ts +0 -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/template.d.ts +1 -1
package/fesm2015/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
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
|
|
@@ -2800,6 +2800,7 @@ Identifiers.stylePropInterpolate7 = { name: 'ɵɵstylePropInterpolate7', moduleN
|
|
|
2800
2800
|
Identifiers.stylePropInterpolate8 = { name: 'ɵɵstylePropInterpolate8', moduleName: CORE };
|
|
2801
2801
|
Identifiers.stylePropInterpolateV = { name: 'ɵɵstylePropInterpolateV', moduleName: CORE };
|
|
2802
2802
|
Identifiers.nextContext = { name: 'ɵɵnextContext', moduleName: CORE };
|
|
2803
|
+
Identifiers.resetView = { name: 'ɵɵresetView', moduleName: CORE };
|
|
2803
2804
|
Identifiers.templateCreate = { name: 'ɵɵtemplate', moduleName: CORE };
|
|
2804
2805
|
Identifiers.text = { name: 'ɵɵtext', moduleName: CORE };
|
|
2805
2806
|
Identifiers.enableBindings = { name: 'ɵɵenableBindings', moduleName: CORE };
|
|
@@ -2910,6 +2911,7 @@ Identifiers.ModuleWithProviders = {
|
|
|
2910
2911
|
Identifiers.defineNgModule = { name: 'ɵɵdefineNgModule', moduleName: CORE };
|
|
2911
2912
|
Identifiers.declareNgModule = { name: 'ɵɵngDeclareNgModule', moduleName: CORE };
|
|
2912
2913
|
Identifiers.setNgModuleScope = { name: 'ɵɵsetNgModuleScope', moduleName: CORE };
|
|
2914
|
+
Identifiers.registerNgModuleType = { name: 'ɵɵregisterNgModuleType', moduleName: CORE };
|
|
2913
2915
|
Identifiers.PipeDeclaration = { name: 'ɵɵPipeDeclaration', moduleName: CORE };
|
|
2914
2916
|
Identifiers.definePipe = { name: 'ɵɵdefinePipe', moduleName: CORE };
|
|
2915
2917
|
Identifiers.declarePipe = { name: 'ɵɵngDeclarePipe', moduleName: CORE };
|
|
@@ -5416,7 +5418,7 @@ class ParseLocation {
|
|
|
5416
5418
|
const ch = source.charCodeAt(offset);
|
|
5417
5419
|
if (ch == $LF) {
|
|
5418
5420
|
line--;
|
|
5419
|
-
const priorLine = source.
|
|
5421
|
+
const priorLine = source.substring(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
|
|
5420
5422
|
col = priorLine > 0 ? offset - priorLine : offset;
|
|
5421
5423
|
}
|
|
5422
5424
|
else {
|
|
@@ -5971,20 +5973,49 @@ class R3JitReflector {
|
|
|
5971
5973
|
* Use of this source code is governed by an MIT-style license that can be
|
|
5972
5974
|
* found in the LICENSE file at https://angular.io/license
|
|
5973
5975
|
*/
|
|
5976
|
+
/**
|
|
5977
|
+
* How the selector scope of an NgModule (its declarations, imports, and exports) should be emitted
|
|
5978
|
+
* as a part of the NgModule definition.
|
|
5979
|
+
*/
|
|
5980
|
+
var R3SelectorScopeMode;
|
|
5981
|
+
(function (R3SelectorScopeMode) {
|
|
5982
|
+
/**
|
|
5983
|
+
* Emit the declarations inline into the module definition.
|
|
5984
|
+
*
|
|
5985
|
+
* This option is useful in certain contexts where it's known that JIT support is required. The
|
|
5986
|
+
* tradeoff here is that this emit style prevents directives and pipes from being tree-shaken if
|
|
5987
|
+
* they are unused, but the NgModule is used.
|
|
5988
|
+
*/
|
|
5989
|
+
R3SelectorScopeMode[R3SelectorScopeMode["Inline"] = 0] = "Inline";
|
|
5990
|
+
/**
|
|
5991
|
+
* Emit the declarations using a side effectful function call, `ɵɵsetNgModuleScope`, that is
|
|
5992
|
+
* guarded with the `ngJitMode` flag.
|
|
5993
|
+
*
|
|
5994
|
+
* This form of emit supports JIT and can be optimized away if the `ngJitMode` flag is set to
|
|
5995
|
+
* false, which allows unused directives and pipes to be tree-shaken.
|
|
5996
|
+
*/
|
|
5997
|
+
R3SelectorScopeMode[R3SelectorScopeMode["SideEffect"] = 1] = "SideEffect";
|
|
5998
|
+
/**
|
|
5999
|
+
* Don't generate selector scopes at all.
|
|
6000
|
+
*
|
|
6001
|
+
* This is useful for contexts where JIT support is known to be unnecessary.
|
|
6002
|
+
*/
|
|
6003
|
+
R3SelectorScopeMode[R3SelectorScopeMode["Omit"] = 2] = "Omit";
|
|
6004
|
+
})(R3SelectorScopeMode || (R3SelectorScopeMode = {}));
|
|
5974
6005
|
/**
|
|
5975
6006
|
* Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.
|
|
5976
6007
|
*/
|
|
5977
6008
|
function compileNgModule(meta) {
|
|
5978
|
-
const { internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls,
|
|
6009
|
+
const { adjacentType, internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, selectorScopeMode, id } = meta;
|
|
5979
6010
|
const statements = [];
|
|
5980
6011
|
const definitionMap = new DefinitionMap();
|
|
5981
6012
|
definitionMap.set('type', internalType);
|
|
5982
6013
|
if (bootstrap.length > 0) {
|
|
5983
6014
|
definitionMap.set('bootstrap', refsToArray(bootstrap, containsForwardDecls));
|
|
5984
6015
|
}
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
6016
|
+
if (selectorScopeMode === R3SelectorScopeMode.Inline) {
|
|
6017
|
+
// If requested to emit scope information inline, pass the `declarations`, `imports` and
|
|
6018
|
+
// `exports` to the `ɵɵdefineNgModule()` call directly.
|
|
5988
6019
|
if (declarations.length > 0) {
|
|
5989
6020
|
definitionMap.set('declarations', refsToArray(declarations, containsForwardDecls));
|
|
5990
6021
|
}
|
|
@@ -5995,19 +6026,27 @@ function compileNgModule(meta) {
|
|
|
5995
6026
|
definitionMap.set('exports', refsToArray(exports, containsForwardDecls));
|
|
5996
6027
|
}
|
|
5997
6028
|
}
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6029
|
+
else if (selectorScopeMode === R3SelectorScopeMode.SideEffect) {
|
|
6030
|
+
// In this mode, scope information is not passed into `ɵɵdefineNgModule` as it
|
|
6031
|
+
// would prevent tree-shaking of the declarations, imports and exports references. Instead, it's
|
|
6032
|
+
// patched onto the NgModule definition with a `ɵɵsetNgModuleScope` call that's guarded by the
|
|
6033
|
+
// `ngJitMode` flag.
|
|
6001
6034
|
const setNgModuleScopeCall = generateSetNgModuleScopeCall(meta);
|
|
6002
6035
|
if (setNgModuleScopeCall !== null) {
|
|
6003
6036
|
statements.push(setNgModuleScopeCall);
|
|
6004
6037
|
}
|
|
6005
6038
|
}
|
|
6039
|
+
else {
|
|
6040
|
+
// Selector scope emit was not requested, so skip it.
|
|
6041
|
+
}
|
|
6006
6042
|
if (schemas !== null && schemas.length > 0) {
|
|
6007
6043
|
definitionMap.set('schemas', literalArr(schemas.map(ref => ref.value)));
|
|
6008
6044
|
}
|
|
6009
6045
|
if (id !== null) {
|
|
6010
6046
|
definitionMap.set('id', id);
|
|
6047
|
+
// Generate a side-effectful call to register this NgModule by its id, as per the semantics of
|
|
6048
|
+
// NgModule ids.
|
|
6049
|
+
statements.push(importExpr(Identifiers.registerNgModuleType).callFn([adjacentType, id]).toStmt());
|
|
6011
6050
|
}
|
|
6012
6051
|
const expression = importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()], undefined, true);
|
|
6013
6052
|
const type = createNgModuleType(meta);
|
|
@@ -6103,6 +6142,9 @@ function compilePipeFromMetadata(metadata) {
|
|
|
6103
6142
|
definitionMapValues.push({ key: 'type', value: metadata.type.value, quoted: false });
|
|
6104
6143
|
// e.g. `pure: true`
|
|
6105
6144
|
definitionMapValues.push({ key: 'pure', value: literal(metadata.pure), quoted: false });
|
|
6145
|
+
if (metadata.isStandalone) {
|
|
6146
|
+
definitionMapValues.push({ key: 'standalone', value: literal(true), quoted: false });
|
|
6147
|
+
}
|
|
6106
6148
|
const expression = importExpr(Identifiers.definePipe).callFn([literalMap(definitionMapValues)], undefined, true);
|
|
6107
6149
|
const type = createPipeType(metadata);
|
|
6108
6150
|
return { expression, type, statements: [] };
|
|
@@ -6157,33 +6199,6 @@ class ASTWithName extends AST {
|
|
|
6157
6199
|
this.nameSpan = nameSpan;
|
|
6158
6200
|
}
|
|
6159
6201
|
}
|
|
6160
|
-
/**
|
|
6161
|
-
* Represents a quoted expression of the form:
|
|
6162
|
-
*
|
|
6163
|
-
* quote = prefix `:` uninterpretedExpression
|
|
6164
|
-
* prefix = identifier
|
|
6165
|
-
* uninterpretedExpression = arbitrary string
|
|
6166
|
-
*
|
|
6167
|
-
* A quoted expression is meant to be pre-processed by an AST transformer that
|
|
6168
|
-
* converts it into another AST that no longer contains quoted expressions.
|
|
6169
|
-
* It is meant to allow third-party developers to extend Angular template
|
|
6170
|
-
* expression language. The `uninterpretedExpression` part of the quote is
|
|
6171
|
-
* therefore not interpreted by the Angular's own expression parser.
|
|
6172
|
-
*/
|
|
6173
|
-
class Quote extends AST {
|
|
6174
|
-
constructor(span, sourceSpan, prefix, uninterpretedExpression, location) {
|
|
6175
|
-
super(span, sourceSpan);
|
|
6176
|
-
this.prefix = prefix;
|
|
6177
|
-
this.uninterpretedExpression = uninterpretedExpression;
|
|
6178
|
-
this.location = location;
|
|
6179
|
-
}
|
|
6180
|
-
visit(visitor, context = null) {
|
|
6181
|
-
return visitor.visitQuote(this, context);
|
|
6182
|
-
}
|
|
6183
|
-
toString() {
|
|
6184
|
-
return 'Quote';
|
|
6185
|
-
}
|
|
6186
|
-
}
|
|
6187
6202
|
class EmptyExpr extends AST {
|
|
6188
6203
|
visit(visitor, context = null) {
|
|
6189
6204
|
// do nothing
|
|
@@ -6564,7 +6579,6 @@ class RecursiveAstVisitor {
|
|
|
6564
6579
|
this.visit(ast.receiver, context);
|
|
6565
6580
|
this.visitAll(ast.args, context);
|
|
6566
6581
|
}
|
|
6567
|
-
visitQuote(ast, context) { }
|
|
6568
6582
|
// This is not part of the AstVisitor interface, just a helper method
|
|
6569
6583
|
visitAll(asts, context) {
|
|
6570
6584
|
for (const ast of asts) {
|
|
@@ -6647,9 +6661,6 @@ class AstTransformer {
|
|
|
6647
6661
|
visitChain(ast, context) {
|
|
6648
6662
|
return new Chain(ast.span, ast.sourceSpan, this.visitAll(ast.expressions));
|
|
6649
6663
|
}
|
|
6650
|
-
visitQuote(ast, context) {
|
|
6651
|
-
return new Quote(ast.span, ast.sourceSpan, ast.prefix, ast.uninterpretedExpression, ast.location);
|
|
6652
|
-
}
|
|
6653
6664
|
visitSafeKeyedRead(ast, context) {
|
|
6654
6665
|
return new SafeKeyedRead(ast.span, ast.sourceSpan, ast.receiver.visit(this), ast.key.visit(this));
|
|
6655
6666
|
}
|
|
@@ -6812,9 +6823,6 @@ class AstMemoryEfficientTransformer {
|
|
|
6812
6823
|
}
|
|
6813
6824
|
return ast;
|
|
6814
6825
|
}
|
|
6815
|
-
visitQuote(ast, context) {
|
|
6816
|
-
return ast;
|
|
6817
|
-
}
|
|
6818
6826
|
visitSafeKeyedRead(ast, context) {
|
|
6819
6827
|
const obj = ast.receiver.visit(this);
|
|
6820
6828
|
const key = ast.key.visit(this);
|
|
@@ -7288,10 +7296,6 @@ class _AstToIrVisitor {
|
|
|
7288
7296
|
visitAll(asts, mode) {
|
|
7289
7297
|
return asts.map(ast => this._visit(ast, mode));
|
|
7290
7298
|
}
|
|
7291
|
-
visitQuote(ast, mode) {
|
|
7292
|
-
throw new Error(`Quotes are not supported for evaluation!
|
|
7293
|
-
Statement: ${ast.uninterpretedExpression} located at ${ast.location}`);
|
|
7294
|
-
}
|
|
7295
7299
|
visitCall(ast, mode) {
|
|
7296
7300
|
const leftMostSafe = this.leftMostSafeNode(ast);
|
|
7297
7301
|
if (leftMostSafe) {
|
|
@@ -7477,9 +7481,6 @@ class _AstToIrVisitor {
|
|
|
7477
7481
|
visitPropertyWrite(ast) {
|
|
7478
7482
|
return null;
|
|
7479
7483
|
},
|
|
7480
|
-
visitQuote(ast) {
|
|
7481
|
-
return null;
|
|
7482
|
-
},
|
|
7483
7484
|
visitSafePropertyRead(ast) {
|
|
7484
7485
|
return visit(this, ast.receiver) || ast;
|
|
7485
7486
|
},
|
|
@@ -7556,9 +7557,6 @@ class _AstToIrVisitor {
|
|
|
7556
7557
|
visitPropertyWrite(ast) {
|
|
7557
7558
|
return false;
|
|
7558
7559
|
},
|
|
7559
|
-
visitQuote(ast) {
|
|
7560
|
-
return false;
|
|
7561
|
-
},
|
|
7562
7560
|
visitSafePropertyRead(ast) {
|
|
7563
7561
|
return false;
|
|
7564
7562
|
},
|
|
@@ -8001,7 +7999,7 @@ class ShadowCss {
|
|
|
8001
7999
|
this._scopeSelector(rule.selector, scopeSelector, hostSelector, this.strictStyling);
|
|
8002
8000
|
}
|
|
8003
8001
|
else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
|
|
8004
|
-
rule.selector.startsWith('@document')) {
|
|
8002
|
+
rule.selector.startsWith('@document') || rule.selector.startsWith('@layer')) {
|
|
8005
8003
|
content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
|
|
8006
8004
|
}
|
|
8007
8005
|
else if (rule.selector.startsWith('@font-face') || rule.selector.startsWith('@page')) {
|
|
@@ -8464,7 +8462,7 @@ function parse(value) {
|
|
|
8464
8462
|
}
|
|
8465
8463
|
}
|
|
8466
8464
|
if (currentProp && valueStart) {
|
|
8467
|
-
const styleVal = value.
|
|
8465
|
+
const styleVal = value.slice(valueStart).trim();
|
|
8468
8466
|
styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal);
|
|
8469
8467
|
}
|
|
8470
8468
|
return styles;
|
|
@@ -8642,7 +8640,7 @@ class StylingBuilder {
|
|
|
8642
8640
|
const isClass = !isStyle && (name === 'class' || prefix === 'class.' || prefix === 'class!');
|
|
8643
8641
|
if (isStyle || isClass) {
|
|
8644
8642
|
const isMapBased = name.charAt(5) !== '.'; // style.prop or class.prop makes this a no
|
|
8645
|
-
const property = name.
|
|
8643
|
+
const property = name.slice(isMapBased ? 5 : 6); // the dot explains why there's a +1
|
|
8646
8644
|
if (isStyle) {
|
|
8647
8645
|
binding = this.registerStyleInput(property, isMapBased, expression, sourceSpan);
|
|
8648
8646
|
}
|
|
@@ -8916,7 +8914,7 @@ function parseProperty(name) {
|
|
|
8916
8914
|
let property = name;
|
|
8917
8915
|
const unitIndex = name.lastIndexOf('.');
|
|
8918
8916
|
if (unitIndex > 0) {
|
|
8919
|
-
suffix = name.
|
|
8917
|
+
suffix = name.slice(unitIndex + 1);
|
|
8920
8918
|
property = name.substring(0, unitIndex);
|
|
8921
8919
|
}
|
|
8922
8920
|
return { property, suffix, hasOverrideFlag };
|
|
@@ -9495,31 +9493,12 @@ class Parser$1 {
|
|
|
9495
9493
|
this.errors.push(new ParserError(message, input, errLocation, ctxLocation));
|
|
9496
9494
|
}
|
|
9497
9495
|
_parseBindingAst(input, location, absoluteOffset, interpolationConfig) {
|
|
9498
|
-
// Quotes expressions use 3rd-party expression language. We don't want to use
|
|
9499
|
-
// our lexer or parser for that, so we check for that ahead of time.
|
|
9500
|
-
const quote = this._parseQuote(input, location, absoluteOffset);
|
|
9501
|
-
if (quote != null) {
|
|
9502
|
-
return quote;
|
|
9503
|
-
}
|
|
9504
9496
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9505
9497
|
const sourceToLex = this._stripComments(input);
|
|
9506
9498
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9507
9499
|
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9508
9500
|
.parseChain();
|
|
9509
9501
|
}
|
|
9510
|
-
_parseQuote(input, location, absoluteOffset) {
|
|
9511
|
-
if (input == null)
|
|
9512
|
-
return null;
|
|
9513
|
-
const prefixSeparatorIndex = input.indexOf(':');
|
|
9514
|
-
if (prefixSeparatorIndex == -1)
|
|
9515
|
-
return null;
|
|
9516
|
-
const prefix = input.substring(0, prefixSeparatorIndex).trim();
|
|
9517
|
-
if (!isIdentifier(prefix))
|
|
9518
|
-
return null;
|
|
9519
|
-
const uninterpretedExpression = input.substring(prefixSeparatorIndex + 1);
|
|
9520
|
-
const span = new ParseSpan(0, input.length);
|
|
9521
|
-
return new Quote(span, span.toAbsolute(absoluteOffset), prefix, uninterpretedExpression, location);
|
|
9522
|
-
}
|
|
9523
9502
|
/**
|
|
9524
9503
|
* Parse microsyntax template expression and return a list of bindings or
|
|
9525
9504
|
* parsing errors in case the given expression is invalid.
|
|
@@ -13921,7 +13900,7 @@ class EscapedCharacterCursor extends PlainCharacterCursor {
|
|
|
13921
13900
|
}
|
|
13922
13901
|
}
|
|
13923
13902
|
decodeHexDigits(start, length) {
|
|
13924
|
-
const hex = this.input.
|
|
13903
|
+
const hex = this.input.slice(start.internalState.offset, start.internalState.offset + length);
|
|
13925
13904
|
const charCode = parseInt(hex, 16);
|
|
13926
13905
|
if (!isNaN(charCode)) {
|
|
13927
13906
|
return charCode;
|
|
@@ -15320,7 +15299,7 @@ class BindingParser {
|
|
|
15320
15299
|
this._reportError(`Event name is missing in binding`, sourceSpan);
|
|
15321
15300
|
}
|
|
15322
15301
|
if (isAnimationLabel(name)) {
|
|
15323
|
-
name = name.
|
|
15302
|
+
name = name.slice(1);
|
|
15324
15303
|
if (keySpan !== undefined) {
|
|
15325
15304
|
keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
|
|
15326
15305
|
}
|
|
@@ -16978,13 +16957,27 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
|
|
|
16978
16957
|
scope.getOrCreateSharedContextVar(0);
|
|
16979
16958
|
const bindingStatements = convertActionBinding(scope, implicitReceiverExpr, handler, 'b', eventAst.handlerSpan, implicitReceiverAccesses, EVENT_BINDING_SCOPE_GLOBALS);
|
|
16980
16959
|
const statements = [];
|
|
16981
|
-
|
|
16960
|
+
const variableDeclarations = scope === null || scope === void 0 ? void 0 : scope.variableDeclarations();
|
|
16961
|
+
const restoreViewStatement = scope === null || scope === void 0 ? void 0 : scope.restoreViewStatement();
|
|
16962
|
+
if (variableDeclarations) {
|
|
16982
16963
|
// `variableDeclarations` needs to run first, because
|
|
16983
16964
|
// `restoreViewStatement` depends on the result.
|
|
16984
|
-
statements.push(...
|
|
16985
|
-
statements.unshift(...scope.restoreViewStatement());
|
|
16965
|
+
statements.push(...variableDeclarations);
|
|
16986
16966
|
}
|
|
16987
16967
|
statements.push(...bindingStatements);
|
|
16968
|
+
if (restoreViewStatement) {
|
|
16969
|
+
statements.unshift(restoreViewStatement);
|
|
16970
|
+
// If there's a `restoreView` call, we need to reset the view at the end of the listener
|
|
16971
|
+
// in order to avoid a leak. If there's a `return` statement already, we wrap it in the
|
|
16972
|
+
// call, e.g. `return resetView(ctx.foo())`. Otherwise we add the call as the last statement.
|
|
16973
|
+
const lastStatement = statements[statements.length - 1];
|
|
16974
|
+
if (lastStatement instanceof ReturnStatement) {
|
|
16975
|
+
statements[statements.length - 1] = new ReturnStatement(invokeInstruction(lastStatement.value.sourceSpan, Identifiers.resetView, [lastStatement.value]));
|
|
16976
|
+
}
|
|
16977
|
+
else {
|
|
16978
|
+
statements.push(new ExpressionStatement(invokeInstruction(null, Identifiers.resetView, [])));
|
|
16979
|
+
}
|
|
16980
|
+
}
|
|
16988
16981
|
const eventName = type === 1 /* Animation */ ? prepareSyntheticListenerName(name, phase) : name;
|
|
16989
16982
|
const fnName = handlerName && sanitizeIdentifier(handlerName);
|
|
16990
16983
|
const fnArgs = [];
|
|
@@ -18316,16 +18309,15 @@ class BindingScope {
|
|
|
18316
18309
|
}
|
|
18317
18310
|
}
|
|
18318
18311
|
restoreViewStatement() {
|
|
18319
|
-
const statements = [];
|
|
18320
18312
|
if (this.restoreViewVariable) {
|
|
18321
18313
|
const restoreCall = invokeInstruction(null, Identifiers.restoreView, [this.restoreViewVariable]);
|
|
18322
18314
|
// Either `const restoredCtx = restoreView($state$);` or `restoreView($state$);`
|
|
18323
18315
|
// depending on whether it is being used.
|
|
18324
|
-
|
|
18316
|
+
return this.usesRestoredViewContext ?
|
|
18325
18317
|
variable(RESTORED_VIEW_CONTEXT_NAME).set(restoreCall).toConstDecl() :
|
|
18326
|
-
restoreCall.toStmt()
|
|
18318
|
+
restoreCall.toStmt();
|
|
18327
18319
|
}
|
|
18328
|
-
return
|
|
18320
|
+
return null;
|
|
18329
18321
|
}
|
|
18330
18322
|
viewSnapshotStatements() {
|
|
18331
18323
|
// const $state$ = getCurrentView();
|
|
@@ -18715,6 +18707,9 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
|
18715
18707
|
if (meta.exportAs !== null) {
|
|
18716
18708
|
definitionMap.set('exportAs', literalArr(meta.exportAs.map(e => literal(e))));
|
|
18717
18709
|
}
|
|
18710
|
+
if (meta.isStandalone) {
|
|
18711
|
+
definitionMap.set('standalone', literal(true));
|
|
18712
|
+
}
|
|
18718
18713
|
return definitionMap;
|
|
18719
18714
|
}
|
|
18720
18715
|
/**
|
|
@@ -19307,6 +19302,7 @@ class CompilerFacadeImpl {
|
|
|
19307
19302
|
deps: null,
|
|
19308
19303
|
pipeName: facade.pipeName,
|
|
19309
19304
|
pure: facade.pure,
|
|
19305
|
+
isStandalone: facade.isStandalone,
|
|
19310
19306
|
};
|
|
19311
19307
|
const res = compilePipeFromMetadata(metadata);
|
|
19312
19308
|
return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, []);
|
|
@@ -19375,7 +19371,7 @@ class CompilerFacadeImpl {
|
|
|
19375
19371
|
declarations: facade.declarations.map(wrapReference),
|
|
19376
19372
|
imports: facade.imports.map(wrapReference),
|
|
19377
19373
|
exports: facade.exports.map(wrapReference),
|
|
19378
|
-
|
|
19374
|
+
selectorScopeMode: R3SelectorScopeMode.Inline,
|
|
19379
19375
|
containsForwardDecls: false,
|
|
19380
19376
|
schemas: facade.schemas ? facade.schemas.map(wrapReference) : null,
|
|
19381
19377
|
id: facade.id ? new WrappedNodeExpr(facade.id) : null,
|
|
@@ -19517,7 +19513,7 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
|
19517
19513
|
return Object.assign(Object.assign({}, facade), { typeArgumentCount: 0, typeSourceSpan: facade.typeSourceSpan, type: wrapReference(facade.type), internalType: new WrappedNodeExpr(facade.type), deps: null, host: extractHostBindings(facade.propMetadata, facade.typeSourceSpan, facade.host), inputs: Object.assign(Object.assign({}, inputsFromMetadata), inputsFromType), outputs: Object.assign(Object.assign({}, outputsFromMetadata), outputsFromType), queries: facade.queries.map(convertToR3QueryMetadata), providers: facade.providers != null ? new WrappedNodeExpr(facade.providers) : null, viewQueries: facade.viewQueries.map(convertToR3QueryMetadata), fullInheritance: false });
|
|
19518
19514
|
}
|
|
19519
19515
|
function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
19520
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19516
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
19521
19517
|
return {
|
|
19522
19518
|
name: declaration.type.name,
|
|
19523
19519
|
type: wrapReference(declaration.type),
|
|
@@ -19537,6 +19533,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
|
19537
19533
|
deps: null,
|
|
19538
19534
|
typeArgumentCount: 0,
|
|
19539
19535
|
fullInheritance: false,
|
|
19536
|
+
isStandalone: (_j = declaration.isStandalone) !== null && _j !== void 0 ? _j : false,
|
|
19540
19537
|
};
|
|
19541
19538
|
}
|
|
19542
19539
|
function convertHostDeclarationToMetadata(host = {}) {
|
|
@@ -19700,7 +19697,7 @@ function parseInputOutputs(values) {
|
|
|
19700
19697
|
}, {});
|
|
19701
19698
|
}
|
|
19702
19699
|
function convertDeclarePipeFacadeToMetadata(declaration) {
|
|
19703
|
-
var _a;
|
|
19700
|
+
var _a, _b;
|
|
19704
19701
|
return {
|
|
19705
19702
|
name: declaration.type.name,
|
|
19706
19703
|
type: wrapReference(declaration.type),
|
|
@@ -19709,6 +19706,7 @@ function convertDeclarePipeFacadeToMetadata(declaration) {
|
|
|
19709
19706
|
pipeName: declaration.name,
|
|
19710
19707
|
deps: null,
|
|
19711
19708
|
pure: (_a = declaration.pure) !== null && _a !== void 0 ? _a : true,
|
|
19709
|
+
isStandalone: (_b = declaration.isStandalone) !== null && _b !== void 0 ? _b : false,
|
|
19712
19710
|
};
|
|
19713
19711
|
}
|
|
19714
19712
|
function convertDeclareInjectorFacadeToMetadata(declaration) {
|
|
@@ -19735,7 +19733,7 @@ function publishFacade(global) {
|
|
|
19735
19733
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19736
19734
|
* found in the LICENSE file at https://angular.io/license
|
|
19737
19735
|
*/
|
|
19738
|
-
const VERSION = new Version('
|
|
19736
|
+
const VERSION = new Version('14.0.0-next.10');
|
|
19739
19737
|
|
|
19740
19738
|
/**
|
|
19741
19739
|
* @license
|
|
@@ -21762,7 +21760,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21762
21760
|
function compileDeclareClassMetadata(metadata) {
|
|
21763
21761
|
const definitionMap = new DefinitionMap();
|
|
21764
21762
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21765
|
-
definitionMap.set('version', literal('
|
|
21763
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
21766
21764
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21767
21765
|
definitionMap.set('type', metadata.type);
|
|
21768
21766
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -21879,7 +21877,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
21879
21877
|
function createDirectiveDefinitionMap(meta) {
|
|
21880
21878
|
const definitionMap = new DefinitionMap();
|
|
21881
21879
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
21882
|
-
definitionMap.set('version', literal('
|
|
21880
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
21883
21881
|
// e.g. `type: MyDirective`
|
|
21884
21882
|
definitionMap.set('type', meta.internalType);
|
|
21885
21883
|
// e.g. `selector: 'some-dir'`
|
|
@@ -22100,7 +22098,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
22100
22098
|
function compileDeclareFactoryFunction(meta) {
|
|
22101
22099
|
const definitionMap = new DefinitionMap();
|
|
22102
22100
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
22103
|
-
definitionMap.set('version', literal('
|
|
22101
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22104
22102
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22105
22103
|
definitionMap.set('type', meta.internalType);
|
|
22106
22104
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22142,7 +22140,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22142
22140
|
function createInjectableDefinitionMap(meta) {
|
|
22143
22141
|
const definitionMap = new DefinitionMap();
|
|
22144
22142
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22145
|
-
definitionMap.set('version', literal('
|
|
22143
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22146
22144
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22147
22145
|
definitionMap.set('type', meta.internalType);
|
|
22148
22146
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22200,7 +22198,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22200
22198
|
function createInjectorDefinitionMap(meta) {
|
|
22201
22199
|
const definitionMap = new DefinitionMap();
|
|
22202
22200
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22203
|
-
definitionMap.set('version', literal('
|
|
22201
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22204
22202
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22205
22203
|
definitionMap.set('type', meta.internalType);
|
|
22206
22204
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22237,7 +22235,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22237
22235
|
function createNgModuleDefinitionMap(meta) {
|
|
22238
22236
|
const definitionMap = new DefinitionMap();
|
|
22239
22237
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22240
|
-
definitionMap.set('version', literal('
|
|
22238
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22241
22239
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22242
22240
|
definitionMap.set('type', meta.internalType);
|
|
22243
22241
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22295,7 +22293,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22295
22293
|
function createPipeDefinitionMap(meta) {
|
|
22296
22294
|
const definitionMap = new DefinitionMap();
|
|
22297
22295
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22298
|
-
definitionMap.set('version', literal('
|
|
22296
|
+
definitionMap.set('version', literal('14.0.0-next.10'));
|
|
22299
22297
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22300
22298
|
// e.g. `type: MyPipe`
|
|
22301
22299
|
definitionMap.set('type', meta.internalType);
|
|
@@ -22345,5 +22343,5 @@ publishFacade(_global);
|
|
|
22345
22343
|
* found in the LICENSE file at https://angular.io/license
|
|
22346
22344
|
*/
|
|
22347
22345
|
|
|
22348
|
-
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,
|
|
22346
|
+
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 };
|
|
22349
22347
|
//# sourceMappingURL=compiler.mjs.map
|