@angular/compiler 13.2.0-next.2 → 14.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/compiler.mjs +2 -2
- package/esm2020/src/constant_pool.mjs +5 -5
- package/esm2020/src/expression_parser/parser.mjs +11 -13
- package/esm2020/src/jit_compiler_facade.mjs +2 -2
- package/esm2020/src/output/output_ast.mjs +16 -14
- 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_ast.mjs +7 -2
- package/esm2020/src/render3/r3_template_transform.mjs +3 -3
- package/esm2020/src/render3/view/compiler.mjs +7 -18
- package/esm2020/src/render3/view/template.mjs +4 -24
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +55 -81
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2020/compiler.mjs +55 -81
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/package.json +1 -1
- package/src/compiler.d.ts +1 -1
- package/src/expression_parser/parser.d.ts +1 -2
- package/src/output/output_ast.d.ts +21 -19
- package/src/render3/r3_ast.d.ts +2 -2
- package/src/render3/view/template.d.ts +2 -7
package/esm2020/src/version.mjs
CHANGED
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
* Entry point for all public APIs of the compiler package.
|
|
12
12
|
*/
|
|
13
13
|
import { Version } from './util';
|
|
14
|
-
export const VERSION = new Version('
|
|
14
|
+
export const VERSION = new Version('14.0.0-next.0');
|
|
15
15
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy92ZXJzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVIOzs7O0dBSUc7QUFFSCxPQUFPLEVBQUMsT0FBTyxFQUFDLE1BQU0sUUFBUSxDQUFDO0FBRS9CLE1BQU0sQ0FBQyxNQUFNLE9BQU8sR0FBRyxJQUFJLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEdvb2dsZSBMTEMgQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbiAqXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSBhbiBNSVQtc3R5bGUgbGljZW5zZSB0aGF0IGNhbiBiZVxuICogZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZSBhdCBodHRwczovL2FuZ3VsYXIuaW8vbGljZW5zZVxuICovXG5cbi8qKlxuICogQG1vZHVsZVxuICogQGRlc2NyaXB0aW9uXG4gKiBFbnRyeSBwb2ludCBmb3IgYWxsIHB1YmxpYyBBUElzIG9mIHRoZSBjb21waWxlciBwYWNrYWdlLlxuICovXG5cbmltcG9ydCB7VmVyc2lvbn0gZnJvbSAnLi91dGlsJztcblxuZXhwb3J0IGNvbnN0IFZFUlNJT04gPSBuZXcgVmVyc2lvbignMC4wLjAtUExBQ0VIT0xERVInKTtcbiJdfQ==
|
package/fesm2015/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
2
|
+
* @license Angular v14.0.0-next.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1299,14 +1299,15 @@ function wordsToDecimalString(hi, lo) {
|
|
|
1299
1299
|
//// Types
|
|
1300
1300
|
var TypeModifier;
|
|
1301
1301
|
(function (TypeModifier) {
|
|
1302
|
-
TypeModifier[TypeModifier["
|
|
1302
|
+
TypeModifier[TypeModifier["None"] = 0] = "None";
|
|
1303
|
+
TypeModifier[TypeModifier["Const"] = 1] = "Const";
|
|
1303
1304
|
})(TypeModifier || (TypeModifier = {}));
|
|
1304
1305
|
class Type {
|
|
1305
|
-
constructor(modifiers =
|
|
1306
|
+
constructor(modifiers = TypeModifier.None) {
|
|
1306
1307
|
this.modifiers = modifiers;
|
|
1307
1308
|
}
|
|
1308
1309
|
hasModifier(modifier) {
|
|
1309
|
-
return this.modifiers
|
|
1310
|
+
return (this.modifiers & modifier) !== 0;
|
|
1310
1311
|
}
|
|
1311
1312
|
}
|
|
1312
1313
|
var BuiltinTypeName;
|
|
@@ -1559,7 +1560,7 @@ class WriteVarExpr extends Expression {
|
|
|
1559
1560
|
return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan);
|
|
1560
1561
|
}
|
|
1561
1562
|
toConstDecl() {
|
|
1562
|
-
return this.toDeclStmt(INFERRED_TYPE,
|
|
1563
|
+
return this.toDeclStmt(INFERRED_TYPE, StmtModifier.Final);
|
|
1563
1564
|
}
|
|
1564
1565
|
}
|
|
1565
1566
|
class WriteKeyExpr extends Expression {
|
|
@@ -2045,10 +2046,11 @@ const TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
|
|
|
2045
2046
|
//// Statements
|
|
2046
2047
|
var StmtModifier;
|
|
2047
2048
|
(function (StmtModifier) {
|
|
2048
|
-
StmtModifier[StmtModifier["
|
|
2049
|
-
StmtModifier[StmtModifier["
|
|
2050
|
-
StmtModifier[StmtModifier["
|
|
2051
|
-
StmtModifier[StmtModifier["
|
|
2049
|
+
StmtModifier[StmtModifier["None"] = 0] = "None";
|
|
2050
|
+
StmtModifier[StmtModifier["Final"] = 1] = "Final";
|
|
2051
|
+
StmtModifier[StmtModifier["Private"] = 2] = "Private";
|
|
2052
|
+
StmtModifier[StmtModifier["Exported"] = 4] = "Exported";
|
|
2053
|
+
StmtModifier[StmtModifier["Static"] = 8] = "Static";
|
|
2052
2054
|
})(StmtModifier || (StmtModifier = {}));
|
|
2053
2055
|
class LeadingComment {
|
|
2054
2056
|
constructor(text, multiline, trailingNewline) {
|
|
@@ -2070,13 +2072,13 @@ class JSDocComment extends LeadingComment {
|
|
|
2070
2072
|
}
|
|
2071
2073
|
}
|
|
2072
2074
|
class Statement {
|
|
2073
|
-
constructor(modifiers =
|
|
2075
|
+
constructor(modifiers = StmtModifier.None, sourceSpan = null, leadingComments) {
|
|
2074
2076
|
this.modifiers = modifiers;
|
|
2075
2077
|
this.sourceSpan = sourceSpan;
|
|
2076
2078
|
this.leadingComments = leadingComments;
|
|
2077
2079
|
}
|
|
2078
2080
|
hasModifier(modifier) {
|
|
2079
|
-
return this.modifiers
|
|
2081
|
+
return (this.modifiers & modifier) !== 0;
|
|
2080
2082
|
}
|
|
2081
2083
|
addLeadingComment(leadingComment) {
|
|
2082
2084
|
var _a;
|
|
@@ -2117,7 +2119,7 @@ class DeclareFunctionStmt extends Statement {
|
|
|
2117
2119
|
}
|
|
2118
2120
|
class ExpressionStatement extends Statement {
|
|
2119
2121
|
constructor(expr, sourceSpan, leadingComments) {
|
|
2120
|
-
super(
|
|
2122
|
+
super(StmtModifier.None, sourceSpan, leadingComments);
|
|
2121
2123
|
this.expr = expr;
|
|
2122
2124
|
}
|
|
2123
2125
|
isEquivalent(stmt) {
|
|
@@ -2129,7 +2131,7 @@ class ExpressionStatement extends Statement {
|
|
|
2129
2131
|
}
|
|
2130
2132
|
class ReturnStatement extends Statement {
|
|
2131
2133
|
constructor(value, sourceSpan = null, leadingComments) {
|
|
2132
|
-
super(
|
|
2134
|
+
super(StmtModifier.None, sourceSpan, leadingComments);
|
|
2133
2135
|
this.value = value;
|
|
2134
2136
|
}
|
|
2135
2137
|
isEquivalent(stmt) {
|
|
@@ -2141,7 +2143,7 @@ class ReturnStatement extends Statement {
|
|
|
2141
2143
|
}
|
|
2142
2144
|
class IfStmt extends Statement {
|
|
2143
2145
|
constructor(condition, trueCase, falseCase = [], sourceSpan, leadingComments) {
|
|
2144
|
-
super(
|
|
2146
|
+
super(StmtModifier.None, sourceSpan, leadingComments);
|
|
2145
2147
|
this.condition = condition;
|
|
2146
2148
|
this.trueCase = trueCase;
|
|
2147
2149
|
this.falseCase = falseCase;
|
|
@@ -2606,7 +2608,7 @@ class ConstantPool {
|
|
|
2606
2608
|
definition = variable(name).set(literal);
|
|
2607
2609
|
usage = variable(name);
|
|
2608
2610
|
}
|
|
2609
|
-
this.statements.push(definition.toDeclStmt(INFERRED_TYPE,
|
|
2611
|
+
this.statements.push(definition.toDeclStmt(INFERRED_TYPE, StmtModifier.Final));
|
|
2610
2612
|
fixup.fixup(usage);
|
|
2611
2613
|
}
|
|
2612
2614
|
return fixup;
|
|
@@ -2640,9 +2642,9 @@ class ConstantPool {
|
|
|
2640
2642
|
const parameters = resultExpressions.filter(isVariable).map(e => new FnParam(e.name, DYNAMIC_TYPE));
|
|
2641
2643
|
const pureFunctionDeclaration = fn(parameters, [new ReturnStatement(resultMap(resultExpressions))], INFERRED_TYPE);
|
|
2642
2644
|
const name = this.freshName();
|
|
2643
|
-
this.statements.push(variable(name)
|
|
2644
|
-
|
|
2645
|
-
|
|
2645
|
+
this.statements.push(variable(name)
|
|
2646
|
+
.set(pureFunctionDeclaration)
|
|
2647
|
+
.toDeclStmt(INFERRED_TYPE, StmtModifier.Final));
|
|
2646
2648
|
literalFactory = variable(name);
|
|
2647
2649
|
this.literalFactories.set(key, literalFactory);
|
|
2648
2650
|
}
|
|
@@ -3995,7 +3997,12 @@ class Element$1 {
|
|
|
3995
3997
|
}
|
|
3996
3998
|
}
|
|
3997
3999
|
class Template {
|
|
3998
|
-
constructor(
|
|
4000
|
+
constructor(
|
|
4001
|
+
// tagName is the name of the container element, if applicable.
|
|
4002
|
+
// `null` is a special case for when there is a structural directive on an `ng-template` so
|
|
4003
|
+
// the renderer can differentiate between the synthetic template and the one written in the
|
|
4004
|
+
// file.
|
|
4005
|
+
tagName, attributes, inputs, outputs, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
3999
4006
|
this.tagName = tagName;
|
|
4000
4007
|
this.attributes = attributes;
|
|
4001
4008
|
this.inputs = inputs;
|
|
@@ -9468,8 +9475,7 @@ class Parser$1 {
|
|
|
9468
9475
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9469
9476
|
const sourceToLex = this._stripComments(input);
|
|
9470
9477
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9471
|
-
const ast = new _ParseAST(input, location, absoluteOffset, tokens,
|
|
9472
|
-
.parseChain();
|
|
9478
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, true, this.errors, 0).parseChain();
|
|
9473
9479
|
return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);
|
|
9474
9480
|
}
|
|
9475
9481
|
parseBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
@@ -9502,7 +9508,7 @@ class Parser$1 {
|
|
|
9502
9508
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9503
9509
|
const sourceToLex = this._stripComments(input);
|
|
9504
9510
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9505
|
-
return new _ParseAST(input, location, absoluteOffset, tokens,
|
|
9511
|
+
return new _ParseAST(input, location, absoluteOffset, tokens, false, this.errors, 0)
|
|
9506
9512
|
.parseChain();
|
|
9507
9513
|
}
|
|
9508
9514
|
_parseQuote(input, location, absoluteOffset) {
|
|
@@ -9546,7 +9552,7 @@ class Parser$1 {
|
|
|
9546
9552
|
*/
|
|
9547
9553
|
parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {
|
|
9548
9554
|
const tokens = this._lexer.tokenize(templateValue);
|
|
9549
|
-
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens,
|
|
9555
|
+
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, false /* parseAction */, this.errors, 0 /* relative offset */);
|
|
9550
9556
|
return parser.parseTemplateBindings({
|
|
9551
9557
|
source: templateKey,
|
|
9552
9558
|
span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
|
|
@@ -9561,7 +9567,7 @@ class Parser$1 {
|
|
|
9561
9567
|
const expressionText = expressions[i].text;
|
|
9562
9568
|
const sourceToLex = this._stripComments(expressionText);
|
|
9563
9569
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9564
|
-
const ast = new _ParseAST(input, location, absoluteOffset, tokens,
|
|
9570
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, false, this.errors, offsets[i])
|
|
9565
9571
|
.parseChain();
|
|
9566
9572
|
expressionNodes.push(ast);
|
|
9567
9573
|
}
|
|
@@ -9575,7 +9581,7 @@ class Parser$1 {
|
|
|
9575
9581
|
parseInterpolationExpression(expression, location, absoluteOffset) {
|
|
9576
9582
|
const sourceToLex = this._stripComments(expression);
|
|
9577
9583
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9578
|
-
const ast = new _ParseAST(expression, location, absoluteOffset, tokens,
|
|
9584
|
+
const ast = new _ParseAST(expression, location, absoluteOffset, tokens,
|
|
9579
9585
|
/* parseAction */ false, this.errors, 0)
|
|
9580
9586
|
.parseChain();
|
|
9581
9587
|
const strings = ['', '']; // The prefix and suffix strings are both empty
|
|
@@ -9655,7 +9661,7 @@ class Parser$1 {
|
|
|
9655
9661
|
}
|
|
9656
9662
|
_stripComments(input) {
|
|
9657
9663
|
const i = this._commentStart(input);
|
|
9658
|
-
return i != null ? input.substring(0, i)
|
|
9664
|
+
return i != null ? input.substring(0, i) : input;
|
|
9659
9665
|
}
|
|
9660
9666
|
_commentStart(input) {
|
|
9661
9667
|
let outerQuote = null;
|
|
@@ -9747,12 +9753,11 @@ var ParseContextFlags;
|
|
|
9747
9753
|
ParseContextFlags[ParseContextFlags["Writable"] = 1] = "Writable";
|
|
9748
9754
|
})(ParseContextFlags || (ParseContextFlags = {}));
|
|
9749
9755
|
class _ParseAST {
|
|
9750
|
-
constructor(input, location, absoluteOffset, tokens,
|
|
9756
|
+
constructor(input, location, absoluteOffset, tokens, parseAction, errors, offset) {
|
|
9751
9757
|
this.input = input;
|
|
9752
9758
|
this.location = location;
|
|
9753
9759
|
this.absoluteOffset = absoluteOffset;
|
|
9754
9760
|
this.tokens = tokens;
|
|
9755
|
-
this.inputLength = inputLength;
|
|
9756
9761
|
this.parseAction = parseAction;
|
|
9757
9762
|
this.errors = errors;
|
|
9758
9763
|
this.offset = offset;
|
|
@@ -9797,7 +9802,7 @@ class _ParseAST {
|
|
|
9797
9802
|
// No tokens have been processed yet; return the next token's start or the length of the input
|
|
9798
9803
|
// if there is no token.
|
|
9799
9804
|
if (this.tokens.length === 0) {
|
|
9800
|
-
return this.
|
|
9805
|
+
return this.input.length + this.offset;
|
|
9801
9806
|
}
|
|
9802
9807
|
return this.next.index + this.offset;
|
|
9803
9808
|
}
|
|
@@ -9943,7 +9948,7 @@ class _ParseAST {
|
|
|
9943
9948
|
if (exprs.length == 0) {
|
|
9944
9949
|
// We have no expressions so create an empty expression that spans the entire input length
|
|
9945
9950
|
const artificialStart = this.offset;
|
|
9946
|
-
const artificialEnd = this.offset + this.
|
|
9951
|
+
const artificialEnd = this.offset + this.input.length;
|
|
9947
9952
|
return new EmptyExpr(this.span(artificialStart, artificialEnd), this.sourceSpan(artificialStart, artificialEnd));
|
|
9948
9953
|
}
|
|
9949
9954
|
if (exprs.length == 1)
|
|
@@ -9976,7 +9981,7 @@ class _ParseAST {
|
|
|
9976
9981
|
//
|
|
9977
9982
|
// Therefore, we push the end of the `ParseSpan` for this pipe all the way up to the
|
|
9978
9983
|
// beginning of the next token, or until the end of input if the next token is EOF.
|
|
9979
|
-
fullSpanEnd = this.next.index !== -1 ? this.next.index : this.
|
|
9984
|
+
fullSpanEnd = this.next.index !== -1 ? this.next.index : this.input.length + this.offset;
|
|
9980
9985
|
// The `nameSpan` for an empty pipe name is zero-length at the end of any whitespace
|
|
9981
9986
|
// beyond the pipe character.
|
|
9982
9987
|
nameSpan = new ParseSpan(fullSpanEnd, fullSpanEnd).toAbsolute(this.absoluteOffset);
|
|
@@ -15658,8 +15663,8 @@ class HtmlAstToIvyAst {
|
|
|
15658
15663
|
// the wrapping template to prevent unnecessary i18n instructions from being generated. The
|
|
15659
15664
|
// necessary i18n meta information will be extracted from child elements.
|
|
15660
15665
|
const i18n = isTemplateElement && isI18nRootElement ? undefined : element.i18n;
|
|
15661
|
-
|
|
15662
|
-
parsedElement = new Template(
|
|
15666
|
+
const name = parsedElement instanceof Template ? null : parsedElement.name;
|
|
15667
|
+
parsedElement = new Template(name, hoistedAttrs.attributes, hoistedAttrs.inputs, hoistedAttrs.outputs, templateAttrs, [parsedElement], [ /* no references */], templateVariables, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, i18n);
|
|
15663
15668
|
}
|
|
15664
15669
|
if (isI18nRootElement) {
|
|
15665
15670
|
this.inI18nBlock = false;
|
|
@@ -16949,17 +16954,13 @@ function createComponentDefConsts() {
|
|
|
16949
16954
|
};
|
|
16950
16955
|
}
|
|
16951
16956
|
class TemplateDefinitionBuilder {
|
|
16952
|
-
constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName,
|
|
16957
|
+
constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName, _namespace, relativeContextFilePath, i18nUseExternalIds, _constants = createComponentDefConsts()) {
|
|
16953
16958
|
this.constantPool = constantPool;
|
|
16954
16959
|
this.level = level;
|
|
16955
16960
|
this.contextName = contextName;
|
|
16956
16961
|
this.i18nContext = i18nContext;
|
|
16957
16962
|
this.templateIndex = templateIndex;
|
|
16958
16963
|
this.templateName = templateName;
|
|
16959
|
-
this.directiveMatcher = directiveMatcher;
|
|
16960
|
-
this.directives = directives;
|
|
16961
|
-
this.pipeTypeByName = pipeTypeByName;
|
|
16962
|
-
this.pipes = pipes;
|
|
16963
16964
|
this._namespace = _namespace;
|
|
16964
16965
|
this.i18nUseExternalIds = i18nUseExternalIds;
|
|
16965
16966
|
this._constants = _constants;
|
|
@@ -17016,10 +17017,6 @@ class TemplateDefinitionBuilder {
|
|
|
17016
17017
|
// characters with underscores.
|
|
17017
17018
|
this.fileBasedI18nSuffix = relativeContextFilePath.replace(/[^A-Za-z0-9]/g, '_') + '_';
|
|
17018
17019
|
this._valueConverter = new ValueConverter(constantPool, () => this.allocateDataSlot(), (numSlots) => this.allocatePureFunctionSlots(numSlots), (name, localName, slot, value) => {
|
|
17019
|
-
const pipeType = pipeTypeByName.get(name);
|
|
17020
|
-
if (pipeType) {
|
|
17021
|
-
this.pipes.add(pipeType);
|
|
17022
|
-
}
|
|
17023
17020
|
this._bindingScope.set(this.level, localName, value);
|
|
17024
17021
|
this.creationInstruction(null, Identifiers$1.pipe, [literal(slot), literal(name)]);
|
|
17025
17022
|
});
|
|
@@ -17380,8 +17377,6 @@ class TemplateDefinitionBuilder {
|
|
|
17380
17377
|
outputAttrs.push(attr);
|
|
17381
17378
|
}
|
|
17382
17379
|
}
|
|
17383
|
-
// Match directives on non i18n attributes
|
|
17384
|
-
this.matchDirectives(element.name, element);
|
|
17385
17380
|
// Regular element or ng-container creation mode
|
|
17386
17381
|
const parameters = [literal(elementIndex)];
|
|
17387
17382
|
if (!isNgContainer$1) {
|
|
@@ -17597,8 +17592,6 @@ class TemplateDefinitionBuilder {
|
|
|
17597
17592
|
// it based on the parent nodes inside the template instruction.
|
|
17598
17593
|
literal(tagNameWithoutNamespace),
|
|
17599
17594
|
];
|
|
17600
|
-
// find directives matching on a given <ng-template> node
|
|
17601
|
-
this.matchDirectives(NG_TEMPLATE_TAG_NAME, template);
|
|
17602
17595
|
// prepare attributes parameter (including attributes used for directive matching)
|
|
17603
17596
|
const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, template.attributes, template.inputs, template.outputs, undefined /* styles */, template.templateAttrs);
|
|
17604
17597
|
parameters.push(this.addAttrsToConsts(attrsExprs));
|
|
@@ -17609,7 +17602,7 @@ class TemplateDefinitionBuilder {
|
|
|
17609
17602
|
parameters.push(importExpr(Identifiers$1.templateRefExtractor));
|
|
17610
17603
|
}
|
|
17611
17604
|
// Create the template function
|
|
17612
|
-
const templateVisitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, templateIndex, templateName, this.
|
|
17605
|
+
const templateVisitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, templateIndex, templateName, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this._constants);
|
|
17613
17606
|
// Nested templates must not be visited until after their parent templates have completed
|
|
17614
17607
|
// processing, so they are queued here until after the initial pass. Otherwise, we wouldn't
|
|
17615
17608
|
// be able to support bindings in nested templates to local refs that occur after the
|
|
@@ -17887,14 +17880,6 @@ class TemplateDefinitionBuilder {
|
|
|
17887
17880
|
this._tempVariables.push(...stmts);
|
|
17888
17881
|
return args;
|
|
17889
17882
|
}
|
|
17890
|
-
matchDirectives(elementName, elOrTpl) {
|
|
17891
|
-
if (this.directiveMatcher) {
|
|
17892
|
-
const selector = createCssSelector(elementName, getAttrsForDirectiveMatching(elOrTpl));
|
|
17893
|
-
this.directiveMatcher.match(selector, (cssSelector, staticType) => {
|
|
17894
|
-
this.directives.add(staticType);
|
|
17895
|
-
});
|
|
17896
|
-
}
|
|
17897
|
-
}
|
|
17898
17883
|
/**
|
|
17899
17884
|
* Prepares all attribute expression values for the `TAttributes` array.
|
|
17900
17885
|
*
|
|
@@ -18778,23 +18763,12 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
18778
18763
|
/* forceShared */ true));
|
|
18779
18764
|
}
|
|
18780
18765
|
}
|
|
18781
|
-
// Generate the CSS matcher that recognize directive
|
|
18782
|
-
let directiveMatcher = null;
|
|
18783
|
-
if (meta.directives.length > 0) {
|
|
18784
|
-
const matcher = new SelectorMatcher();
|
|
18785
|
-
for (const { selector, type } of meta.directives) {
|
|
18786
|
-
matcher.addSelectables(CssSelector.parse(selector), type);
|
|
18787
|
-
}
|
|
18788
|
-
directiveMatcher = matcher;
|
|
18789
|
-
}
|
|
18790
18766
|
// e.g. `template: function MyComponent_Template(_ctx, _cm) {...}`
|
|
18791
18767
|
const templateTypeName = meta.name;
|
|
18792
18768
|
const templateName = templateTypeName ? `${templateTypeName}_Template` : null;
|
|
18793
|
-
const directivesUsed = new Set();
|
|
18794
|
-
const pipesUsed = new Set();
|
|
18795
18769
|
const changeDetection = meta.changeDetection;
|
|
18796
18770
|
const template = meta.template;
|
|
18797
|
-
const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName,
|
|
18771
|
+
const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName, Identifiers$1.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds);
|
|
18798
18772
|
const templateFunctionExpression = templateBuilder.buildTemplateFunction(template.nodes, []);
|
|
18799
18773
|
// We need to provide this so that dynamically generated components know what
|
|
18800
18774
|
// projected content blocks to pass through to the component when it is instantiated.
|
|
@@ -18822,14 +18796,14 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
18822
18796
|
}
|
|
18823
18797
|
definitionMap.set('template', templateFunctionExpression);
|
|
18824
18798
|
// e.g. `directives: [MyDirective]`
|
|
18825
|
-
if (
|
|
18826
|
-
const directivesList = literalArr(
|
|
18799
|
+
if (meta.directives.length > 0) {
|
|
18800
|
+
const directivesList = literalArr(meta.directives.map(dir => dir.type));
|
|
18827
18801
|
const directivesExpr = compileDeclarationList(directivesList, meta.declarationListEmitMode);
|
|
18828
18802
|
definitionMap.set('directives', directivesExpr);
|
|
18829
18803
|
}
|
|
18830
18804
|
// e.g. `pipes: [MyPipe]`
|
|
18831
|
-
if (
|
|
18832
|
-
const pipesList = literalArr(Array.from(
|
|
18805
|
+
if (meta.pipes.size > 0) {
|
|
18806
|
+
const pipesList = literalArr(Array.from(meta.pipes.values()));
|
|
18833
18807
|
const pipesExpr = compileDeclarationList(pipesList, meta.declarationListEmitMode);
|
|
18834
18808
|
definitionMap.set('pipes', pipesExpr);
|
|
18835
18809
|
}
|
|
@@ -19480,7 +19454,7 @@ class CompilerFacadeImpl {
|
|
|
19480
19454
|
// declaration of $def which is set to the expression being compiled.
|
|
19481
19455
|
const statements = [
|
|
19482
19456
|
...preStatements,
|
|
19483
|
-
new DeclareVarStmt('$def', def, undefined,
|
|
19457
|
+
new DeclareVarStmt('$def', def, undefined, StmtModifier.Exported),
|
|
19484
19458
|
];
|
|
19485
19459
|
const res = this.jitEvaluator.evaluateStatements(sourceUrl, statements, new R3JitReflector(context), /* enableSourceMaps */ true);
|
|
19486
19460
|
return res['$def'];
|
|
@@ -19752,7 +19726,7 @@ function publishFacade(global) {
|
|
|
19752
19726
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19753
19727
|
* found in the LICENSE file at https://angular.io/license
|
|
19754
19728
|
*/
|
|
19755
|
-
const VERSION = new Version('
|
|
19729
|
+
const VERSION = new Version('14.0.0-next.0');
|
|
19756
19730
|
|
|
19757
19731
|
/**
|
|
19758
19732
|
* @license
|
|
@@ -21779,7 +21753,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21779
21753
|
function compileDeclareClassMetadata(metadata) {
|
|
21780
21754
|
const definitionMap = new DefinitionMap();
|
|
21781
21755
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21782
|
-
definitionMap.set('version', literal('
|
|
21756
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
21783
21757
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
21784
21758
|
definitionMap.set('type', metadata.type);
|
|
21785
21759
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -21896,7 +21870,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
21896
21870
|
function createDirectiveDefinitionMap(meta) {
|
|
21897
21871
|
const definitionMap = new DefinitionMap();
|
|
21898
21872
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
21899
|
-
definitionMap.set('version', literal('
|
|
21873
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
21900
21874
|
// e.g. `type: MyDirective`
|
|
21901
21875
|
definitionMap.set('type', meta.internalType);
|
|
21902
21876
|
// e.g. `selector: 'some-dir'`
|
|
@@ -22117,7 +22091,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
22117
22091
|
function compileDeclareFactoryFunction(meta) {
|
|
22118
22092
|
const definitionMap = new DefinitionMap();
|
|
22119
22093
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
22120
|
-
definitionMap.set('version', literal('
|
|
22094
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
22121
22095
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
22122
22096
|
definitionMap.set('type', meta.internalType);
|
|
22123
22097
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22159,7 +22133,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22159
22133
|
function createInjectableDefinitionMap(meta) {
|
|
22160
22134
|
const definitionMap = new DefinitionMap();
|
|
22161
22135
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22162
|
-
definitionMap.set('version', literal('
|
|
22136
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
22163
22137
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
22164
22138
|
definitionMap.set('type', meta.internalType);
|
|
22165
22139
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22217,7 +22191,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22217
22191
|
function createInjectorDefinitionMap(meta) {
|
|
22218
22192
|
const definitionMap = new DefinitionMap();
|
|
22219
22193
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22220
|
-
definitionMap.set('version', literal('
|
|
22194
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
22221
22195
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
22222
22196
|
definitionMap.set('type', meta.internalType);
|
|
22223
22197
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22254,7 +22228,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22254
22228
|
function createNgModuleDefinitionMap(meta) {
|
|
22255
22229
|
const definitionMap = new DefinitionMap();
|
|
22256
22230
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22257
|
-
definitionMap.set('version', literal('
|
|
22231
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
22258
22232
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
22259
22233
|
definitionMap.set('type', meta.internalType);
|
|
22260
22234
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22312,7 +22286,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22312
22286
|
function createPipeDefinitionMap(meta) {
|
|
22313
22287
|
const definitionMap = new DefinitionMap();
|
|
22314
22288
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22315
|
-
definitionMap.set('version', literal('
|
|
22289
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
22316
22290
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
22317
22291
|
// e.g. `type: MyPipe`
|
|
22318
22292
|
definitionMap.set('type', meta.internalType);
|
|
@@ -22362,5 +22336,5 @@ publishFacade(_global);
|
|
|
22362
22336
|
* found in the LICENSE file at https://angular.io/license
|
|
22363
22337
|
*/
|
|
22364
22338
|
|
|
22365
|
-
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, Identifiers, 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, Quote, R3BoundTarget, Identifiers$1 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, 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 };
|
|
22339
|
+
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, Identifiers, 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, Quote, R3BoundTarget, Identifiers$1 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 };
|
|
22366
22340
|
//# sourceMappingURL=compiler.mjs.map
|