@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/fesm2015/testing.mjs
CHANGED
package/fesm2020/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 {
|
|
@@ -2042,10 +2043,11 @@ const TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
|
|
|
2042
2043
|
//// Statements
|
|
2043
2044
|
var StmtModifier;
|
|
2044
2045
|
(function (StmtModifier) {
|
|
2045
|
-
StmtModifier[StmtModifier["
|
|
2046
|
-
StmtModifier[StmtModifier["
|
|
2047
|
-
StmtModifier[StmtModifier["
|
|
2048
|
-
StmtModifier[StmtModifier["
|
|
2046
|
+
StmtModifier[StmtModifier["None"] = 0] = "None";
|
|
2047
|
+
StmtModifier[StmtModifier["Final"] = 1] = "Final";
|
|
2048
|
+
StmtModifier[StmtModifier["Private"] = 2] = "Private";
|
|
2049
|
+
StmtModifier[StmtModifier["Exported"] = 4] = "Exported";
|
|
2050
|
+
StmtModifier[StmtModifier["Static"] = 8] = "Static";
|
|
2049
2051
|
})(StmtModifier || (StmtModifier = {}));
|
|
2050
2052
|
class LeadingComment {
|
|
2051
2053
|
constructor(text, multiline, trailingNewline) {
|
|
@@ -2067,13 +2069,13 @@ class JSDocComment extends LeadingComment {
|
|
|
2067
2069
|
}
|
|
2068
2070
|
}
|
|
2069
2071
|
class Statement {
|
|
2070
|
-
constructor(modifiers =
|
|
2072
|
+
constructor(modifiers = StmtModifier.None, sourceSpan = null, leadingComments) {
|
|
2071
2073
|
this.modifiers = modifiers;
|
|
2072
2074
|
this.sourceSpan = sourceSpan;
|
|
2073
2075
|
this.leadingComments = leadingComments;
|
|
2074
2076
|
}
|
|
2075
2077
|
hasModifier(modifier) {
|
|
2076
|
-
return this.modifiers
|
|
2078
|
+
return (this.modifiers & modifier) !== 0;
|
|
2077
2079
|
}
|
|
2078
2080
|
addLeadingComment(leadingComment) {
|
|
2079
2081
|
this.leadingComments = this.leadingComments ?? [];
|
|
@@ -2113,7 +2115,7 @@ class DeclareFunctionStmt extends Statement {
|
|
|
2113
2115
|
}
|
|
2114
2116
|
class ExpressionStatement extends Statement {
|
|
2115
2117
|
constructor(expr, sourceSpan, leadingComments) {
|
|
2116
|
-
super(
|
|
2118
|
+
super(StmtModifier.None, sourceSpan, leadingComments);
|
|
2117
2119
|
this.expr = expr;
|
|
2118
2120
|
}
|
|
2119
2121
|
isEquivalent(stmt) {
|
|
@@ -2125,7 +2127,7 @@ class ExpressionStatement extends Statement {
|
|
|
2125
2127
|
}
|
|
2126
2128
|
class ReturnStatement extends Statement {
|
|
2127
2129
|
constructor(value, sourceSpan = null, leadingComments) {
|
|
2128
|
-
super(
|
|
2130
|
+
super(StmtModifier.None, sourceSpan, leadingComments);
|
|
2129
2131
|
this.value = value;
|
|
2130
2132
|
}
|
|
2131
2133
|
isEquivalent(stmt) {
|
|
@@ -2137,7 +2139,7 @@ class ReturnStatement extends Statement {
|
|
|
2137
2139
|
}
|
|
2138
2140
|
class IfStmt extends Statement {
|
|
2139
2141
|
constructor(condition, trueCase, falseCase = [], sourceSpan, leadingComments) {
|
|
2140
|
-
super(
|
|
2142
|
+
super(StmtModifier.None, sourceSpan, leadingComments);
|
|
2141
2143
|
this.condition = condition;
|
|
2142
2144
|
this.trueCase = trueCase;
|
|
2143
2145
|
this.falseCase = falseCase;
|
|
@@ -2602,7 +2604,7 @@ class ConstantPool {
|
|
|
2602
2604
|
definition = variable(name).set(literal);
|
|
2603
2605
|
usage = variable(name);
|
|
2604
2606
|
}
|
|
2605
|
-
this.statements.push(definition.toDeclStmt(INFERRED_TYPE,
|
|
2607
|
+
this.statements.push(definition.toDeclStmt(INFERRED_TYPE, StmtModifier.Final));
|
|
2606
2608
|
fixup.fixup(usage);
|
|
2607
2609
|
}
|
|
2608
2610
|
return fixup;
|
|
@@ -2636,9 +2638,9 @@ class ConstantPool {
|
|
|
2636
2638
|
const parameters = resultExpressions.filter(isVariable).map(e => new FnParam(e.name, DYNAMIC_TYPE));
|
|
2637
2639
|
const pureFunctionDeclaration = fn(parameters, [new ReturnStatement(resultMap(resultExpressions))], INFERRED_TYPE);
|
|
2638
2640
|
const name = this.freshName();
|
|
2639
|
-
this.statements.push(variable(name)
|
|
2640
|
-
|
|
2641
|
-
|
|
2641
|
+
this.statements.push(variable(name)
|
|
2642
|
+
.set(pureFunctionDeclaration)
|
|
2643
|
+
.toDeclStmt(INFERRED_TYPE, StmtModifier.Final));
|
|
2642
2644
|
literalFactory = variable(name);
|
|
2643
2645
|
this.literalFactories.set(key, literalFactory);
|
|
2644
2646
|
}
|
|
@@ -3991,7 +3993,12 @@ class Element$1 {
|
|
|
3991
3993
|
}
|
|
3992
3994
|
}
|
|
3993
3995
|
class Template {
|
|
3994
|
-
constructor(
|
|
3996
|
+
constructor(
|
|
3997
|
+
// tagName is the name of the container element, if applicable.
|
|
3998
|
+
// `null` is a special case for when there is a structural directive on an `ng-template` so
|
|
3999
|
+
// the renderer can differentiate between the synthetic template and the one written in the
|
|
4000
|
+
// file.
|
|
4001
|
+
tagName, attributes, inputs, outputs, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
3995
4002
|
this.tagName = tagName;
|
|
3996
4003
|
this.attributes = attributes;
|
|
3997
4004
|
this.inputs = inputs;
|
|
@@ -9476,8 +9483,7 @@ class Parser$1 {
|
|
|
9476
9483
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9477
9484
|
const sourceToLex = this._stripComments(input);
|
|
9478
9485
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9479
|
-
const ast = new _ParseAST(input, location, absoluteOffset, tokens,
|
|
9480
|
-
.parseChain();
|
|
9486
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, true, this.errors, 0).parseChain();
|
|
9481
9487
|
return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);
|
|
9482
9488
|
}
|
|
9483
9489
|
parseBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
@@ -9510,7 +9516,7 @@ class Parser$1 {
|
|
|
9510
9516
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9511
9517
|
const sourceToLex = this._stripComments(input);
|
|
9512
9518
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9513
|
-
return new _ParseAST(input, location, absoluteOffset, tokens,
|
|
9519
|
+
return new _ParseAST(input, location, absoluteOffset, tokens, false, this.errors, 0)
|
|
9514
9520
|
.parseChain();
|
|
9515
9521
|
}
|
|
9516
9522
|
_parseQuote(input, location, absoluteOffset) {
|
|
@@ -9554,7 +9560,7 @@ class Parser$1 {
|
|
|
9554
9560
|
*/
|
|
9555
9561
|
parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {
|
|
9556
9562
|
const tokens = this._lexer.tokenize(templateValue);
|
|
9557
|
-
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens,
|
|
9563
|
+
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, false /* parseAction */, this.errors, 0 /* relative offset */);
|
|
9558
9564
|
return parser.parseTemplateBindings({
|
|
9559
9565
|
source: templateKey,
|
|
9560
9566
|
span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
|
|
@@ -9569,7 +9575,7 @@ class Parser$1 {
|
|
|
9569
9575
|
const expressionText = expressions[i].text;
|
|
9570
9576
|
const sourceToLex = this._stripComments(expressionText);
|
|
9571
9577
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9572
|
-
const ast = new _ParseAST(input, location, absoluteOffset, tokens,
|
|
9578
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, false, this.errors, offsets[i])
|
|
9573
9579
|
.parseChain();
|
|
9574
9580
|
expressionNodes.push(ast);
|
|
9575
9581
|
}
|
|
@@ -9583,7 +9589,7 @@ class Parser$1 {
|
|
|
9583
9589
|
parseInterpolationExpression(expression, location, absoluteOffset) {
|
|
9584
9590
|
const sourceToLex = this._stripComments(expression);
|
|
9585
9591
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9586
|
-
const ast = new _ParseAST(expression, location, absoluteOffset, tokens,
|
|
9592
|
+
const ast = new _ParseAST(expression, location, absoluteOffset, tokens,
|
|
9587
9593
|
/* parseAction */ false, this.errors, 0)
|
|
9588
9594
|
.parseChain();
|
|
9589
9595
|
const strings = ['', '']; // The prefix and suffix strings are both empty
|
|
@@ -9663,7 +9669,7 @@ class Parser$1 {
|
|
|
9663
9669
|
}
|
|
9664
9670
|
_stripComments(input) {
|
|
9665
9671
|
const i = this._commentStart(input);
|
|
9666
|
-
return i != null ? input.substring(0, i)
|
|
9672
|
+
return i != null ? input.substring(0, i) : input;
|
|
9667
9673
|
}
|
|
9668
9674
|
_commentStart(input) {
|
|
9669
9675
|
let outerQuote = null;
|
|
@@ -9755,12 +9761,11 @@ var ParseContextFlags;
|
|
|
9755
9761
|
ParseContextFlags[ParseContextFlags["Writable"] = 1] = "Writable";
|
|
9756
9762
|
})(ParseContextFlags || (ParseContextFlags = {}));
|
|
9757
9763
|
class _ParseAST {
|
|
9758
|
-
constructor(input, location, absoluteOffset, tokens,
|
|
9764
|
+
constructor(input, location, absoluteOffset, tokens, parseAction, errors, offset) {
|
|
9759
9765
|
this.input = input;
|
|
9760
9766
|
this.location = location;
|
|
9761
9767
|
this.absoluteOffset = absoluteOffset;
|
|
9762
9768
|
this.tokens = tokens;
|
|
9763
|
-
this.inputLength = inputLength;
|
|
9764
9769
|
this.parseAction = parseAction;
|
|
9765
9770
|
this.errors = errors;
|
|
9766
9771
|
this.offset = offset;
|
|
@@ -9805,7 +9810,7 @@ class _ParseAST {
|
|
|
9805
9810
|
// No tokens have been processed yet; return the next token's start or the length of the input
|
|
9806
9811
|
// if there is no token.
|
|
9807
9812
|
if (this.tokens.length === 0) {
|
|
9808
|
-
return this.
|
|
9813
|
+
return this.input.length + this.offset;
|
|
9809
9814
|
}
|
|
9810
9815
|
return this.next.index + this.offset;
|
|
9811
9816
|
}
|
|
@@ -9951,7 +9956,7 @@ class _ParseAST {
|
|
|
9951
9956
|
if (exprs.length == 0) {
|
|
9952
9957
|
// We have no expressions so create an empty expression that spans the entire input length
|
|
9953
9958
|
const artificialStart = this.offset;
|
|
9954
|
-
const artificialEnd = this.offset + this.
|
|
9959
|
+
const artificialEnd = this.offset + this.input.length;
|
|
9955
9960
|
return new EmptyExpr(this.span(artificialStart, artificialEnd), this.sourceSpan(artificialStart, artificialEnd));
|
|
9956
9961
|
}
|
|
9957
9962
|
if (exprs.length == 1)
|
|
@@ -9984,7 +9989,7 @@ class _ParseAST {
|
|
|
9984
9989
|
//
|
|
9985
9990
|
// Therefore, we push the end of the `ParseSpan` for this pipe all the way up to the
|
|
9986
9991
|
// beginning of the next token, or until the end of input if the next token is EOF.
|
|
9987
|
-
fullSpanEnd = this.next.index !== -1 ? this.next.index : this.
|
|
9992
|
+
fullSpanEnd = this.next.index !== -1 ? this.next.index : this.input.length + this.offset;
|
|
9988
9993
|
// The `nameSpan` for an empty pipe name is zero-length at the end of any whitespace
|
|
9989
9994
|
// beyond the pipe character.
|
|
9990
9995
|
nameSpan = new ParseSpan(fullSpanEnd, fullSpanEnd).toAbsolute(this.absoluteOffset);
|
|
@@ -15664,8 +15669,8 @@ class HtmlAstToIvyAst {
|
|
|
15664
15669
|
// the wrapping template to prevent unnecessary i18n instructions from being generated. The
|
|
15665
15670
|
// necessary i18n meta information will be extracted from child elements.
|
|
15666
15671
|
const i18n = isTemplateElement && isI18nRootElement ? undefined : element.i18n;
|
|
15667
|
-
|
|
15668
|
-
parsedElement = new Template(
|
|
15672
|
+
const name = parsedElement instanceof Template ? null : parsedElement.name;
|
|
15673
|
+
parsedElement = new Template(name, hoistedAttrs.attributes, hoistedAttrs.inputs, hoistedAttrs.outputs, templateAttrs, [parsedElement], [ /* no references */], templateVariables, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, i18n);
|
|
15669
15674
|
}
|
|
15670
15675
|
if (isI18nRootElement) {
|
|
15671
15676
|
this.inI18nBlock = false;
|
|
@@ -16953,17 +16958,13 @@ function createComponentDefConsts() {
|
|
|
16953
16958
|
};
|
|
16954
16959
|
}
|
|
16955
16960
|
class TemplateDefinitionBuilder {
|
|
16956
|
-
constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName,
|
|
16961
|
+
constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName, _namespace, relativeContextFilePath, i18nUseExternalIds, _constants = createComponentDefConsts()) {
|
|
16957
16962
|
this.constantPool = constantPool;
|
|
16958
16963
|
this.level = level;
|
|
16959
16964
|
this.contextName = contextName;
|
|
16960
16965
|
this.i18nContext = i18nContext;
|
|
16961
16966
|
this.templateIndex = templateIndex;
|
|
16962
16967
|
this.templateName = templateName;
|
|
16963
|
-
this.directiveMatcher = directiveMatcher;
|
|
16964
|
-
this.directives = directives;
|
|
16965
|
-
this.pipeTypeByName = pipeTypeByName;
|
|
16966
|
-
this.pipes = pipes;
|
|
16967
16968
|
this._namespace = _namespace;
|
|
16968
16969
|
this.i18nUseExternalIds = i18nUseExternalIds;
|
|
16969
16970
|
this._constants = _constants;
|
|
@@ -17020,10 +17021,6 @@ class TemplateDefinitionBuilder {
|
|
|
17020
17021
|
// characters with underscores.
|
|
17021
17022
|
this.fileBasedI18nSuffix = relativeContextFilePath.replace(/[^A-Za-z0-9]/g, '_') + '_';
|
|
17022
17023
|
this._valueConverter = new ValueConverter(constantPool, () => this.allocateDataSlot(), (numSlots) => this.allocatePureFunctionSlots(numSlots), (name, localName, slot, value) => {
|
|
17023
|
-
const pipeType = pipeTypeByName.get(name);
|
|
17024
|
-
if (pipeType) {
|
|
17025
|
-
this.pipes.add(pipeType);
|
|
17026
|
-
}
|
|
17027
17024
|
this._bindingScope.set(this.level, localName, value);
|
|
17028
17025
|
this.creationInstruction(null, Identifiers$1.pipe, [literal(slot), literal(name)]);
|
|
17029
17026
|
});
|
|
@@ -17383,8 +17380,6 @@ class TemplateDefinitionBuilder {
|
|
|
17383
17380
|
outputAttrs.push(attr);
|
|
17384
17381
|
}
|
|
17385
17382
|
}
|
|
17386
|
-
// Match directives on non i18n attributes
|
|
17387
|
-
this.matchDirectives(element.name, element);
|
|
17388
17383
|
// Regular element or ng-container creation mode
|
|
17389
17384
|
const parameters = [literal(elementIndex)];
|
|
17390
17385
|
if (!isNgContainer$1) {
|
|
@@ -17599,8 +17594,6 @@ class TemplateDefinitionBuilder {
|
|
|
17599
17594
|
// it based on the parent nodes inside the template instruction.
|
|
17600
17595
|
literal(tagNameWithoutNamespace),
|
|
17601
17596
|
];
|
|
17602
|
-
// find directives matching on a given <ng-template> node
|
|
17603
|
-
this.matchDirectives(NG_TEMPLATE_TAG_NAME, template);
|
|
17604
17597
|
// prepare attributes parameter (including attributes used for directive matching)
|
|
17605
17598
|
const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, template.attributes, template.inputs, template.outputs, undefined /* styles */, template.templateAttrs);
|
|
17606
17599
|
parameters.push(this.addAttrsToConsts(attrsExprs));
|
|
@@ -17611,7 +17604,7 @@ class TemplateDefinitionBuilder {
|
|
|
17611
17604
|
parameters.push(importExpr(Identifiers$1.templateRefExtractor));
|
|
17612
17605
|
}
|
|
17613
17606
|
// Create the template function
|
|
17614
|
-
const templateVisitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, templateIndex, templateName, this.
|
|
17607
|
+
const templateVisitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, templateIndex, templateName, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this._constants);
|
|
17615
17608
|
// Nested templates must not be visited until after their parent templates have completed
|
|
17616
17609
|
// processing, so they are queued here until after the initial pass. Otherwise, we wouldn't
|
|
17617
17610
|
// be able to support bindings in nested templates to local refs that occur after the
|
|
@@ -17889,14 +17882,6 @@ class TemplateDefinitionBuilder {
|
|
|
17889
17882
|
this._tempVariables.push(...stmts);
|
|
17890
17883
|
return args;
|
|
17891
17884
|
}
|
|
17892
|
-
matchDirectives(elementName, elOrTpl) {
|
|
17893
|
-
if (this.directiveMatcher) {
|
|
17894
|
-
const selector = createCssSelector(elementName, getAttrsForDirectiveMatching(elOrTpl));
|
|
17895
|
-
this.directiveMatcher.match(selector, (cssSelector, staticType) => {
|
|
17896
|
-
this.directives.add(staticType);
|
|
17897
|
-
});
|
|
17898
|
-
}
|
|
17899
|
-
}
|
|
17900
17885
|
/**
|
|
17901
17886
|
* Prepares all attribute expression values for the `TAttributes` array.
|
|
17902
17887
|
*
|
|
@@ -18780,23 +18765,12 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
18780
18765
|
/* forceShared */ true));
|
|
18781
18766
|
}
|
|
18782
18767
|
}
|
|
18783
|
-
// Generate the CSS matcher that recognize directive
|
|
18784
|
-
let directiveMatcher = null;
|
|
18785
|
-
if (meta.directives.length > 0) {
|
|
18786
|
-
const matcher = new SelectorMatcher();
|
|
18787
|
-
for (const { selector, type } of meta.directives) {
|
|
18788
|
-
matcher.addSelectables(CssSelector.parse(selector), type);
|
|
18789
|
-
}
|
|
18790
|
-
directiveMatcher = matcher;
|
|
18791
|
-
}
|
|
18792
18768
|
// e.g. `template: function MyComponent_Template(_ctx, _cm) {...}`
|
|
18793
18769
|
const templateTypeName = meta.name;
|
|
18794
18770
|
const templateName = templateTypeName ? `${templateTypeName}_Template` : null;
|
|
18795
|
-
const directivesUsed = new Set();
|
|
18796
|
-
const pipesUsed = new Set();
|
|
18797
18771
|
const changeDetection = meta.changeDetection;
|
|
18798
18772
|
const template = meta.template;
|
|
18799
|
-
const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName,
|
|
18773
|
+
const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName, Identifiers$1.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds);
|
|
18800
18774
|
const templateFunctionExpression = templateBuilder.buildTemplateFunction(template.nodes, []);
|
|
18801
18775
|
// We need to provide this so that dynamically generated components know what
|
|
18802
18776
|
// projected content blocks to pass through to the component when it is instantiated.
|
|
@@ -18824,14 +18798,14 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
18824
18798
|
}
|
|
18825
18799
|
definitionMap.set('template', templateFunctionExpression);
|
|
18826
18800
|
// e.g. `directives: [MyDirective]`
|
|
18827
|
-
if (
|
|
18828
|
-
const directivesList = literalArr(
|
|
18801
|
+
if (meta.directives.length > 0) {
|
|
18802
|
+
const directivesList = literalArr(meta.directives.map(dir => dir.type));
|
|
18829
18803
|
const directivesExpr = compileDeclarationList(directivesList, meta.declarationListEmitMode);
|
|
18830
18804
|
definitionMap.set('directives', directivesExpr);
|
|
18831
18805
|
}
|
|
18832
18806
|
// e.g. `pipes: [MyPipe]`
|
|
18833
|
-
if (
|
|
18834
|
-
const pipesList = literalArr(Array.from(
|
|
18807
|
+
if (meta.pipes.size > 0) {
|
|
18808
|
+
const pipesList = literalArr(Array.from(meta.pipes.values()));
|
|
18835
18809
|
const pipesExpr = compileDeclarationList(pipesList, meta.declarationListEmitMode);
|
|
18836
18810
|
definitionMap.set('pipes', pipesExpr);
|
|
18837
18811
|
}
|
|
@@ -19494,7 +19468,7 @@ class CompilerFacadeImpl {
|
|
|
19494
19468
|
// declaration of $def which is set to the expression being compiled.
|
|
19495
19469
|
const statements = [
|
|
19496
19470
|
...preStatements,
|
|
19497
|
-
new DeclareVarStmt('$def', def, undefined,
|
|
19471
|
+
new DeclareVarStmt('$def', def, undefined, StmtModifier.Exported),
|
|
19498
19472
|
];
|
|
19499
19473
|
const res = this.jitEvaluator.evaluateStatements(sourceUrl, statements, new R3JitReflector(context), /* enableSourceMaps */ true);
|
|
19500
19474
|
return res['$def'];
|
|
@@ -19793,7 +19767,7 @@ function publishFacade(global) {
|
|
|
19793
19767
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19794
19768
|
* found in the LICENSE file at https://angular.io/license
|
|
19795
19769
|
*/
|
|
19796
|
-
const VERSION = new Version('
|
|
19770
|
+
const VERSION = new Version('14.0.0-next.0');
|
|
19797
19771
|
|
|
19798
19772
|
/**
|
|
19799
19773
|
* @license
|
|
@@ -21834,7 +21808,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21834
21808
|
function compileDeclareClassMetadata(metadata) {
|
|
21835
21809
|
const definitionMap = new DefinitionMap();
|
|
21836
21810
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21837
|
-
definitionMap.set('version', literal('
|
|
21811
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
21838
21812
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
21839
21813
|
definitionMap.set('type', metadata.type);
|
|
21840
21814
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -21951,7 +21925,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
21951
21925
|
function createDirectiveDefinitionMap(meta) {
|
|
21952
21926
|
const definitionMap = new DefinitionMap();
|
|
21953
21927
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
21954
|
-
definitionMap.set('version', literal('
|
|
21928
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
21955
21929
|
// e.g. `type: MyDirective`
|
|
21956
21930
|
definitionMap.set('type', meta.internalType);
|
|
21957
21931
|
// e.g. `selector: 'some-dir'`
|
|
@@ -22172,7 +22146,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
22172
22146
|
function compileDeclareFactoryFunction(meta) {
|
|
22173
22147
|
const definitionMap = new DefinitionMap();
|
|
22174
22148
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
22175
|
-
definitionMap.set('version', literal('
|
|
22149
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
22176
22150
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
22177
22151
|
definitionMap.set('type', meta.internalType);
|
|
22178
22152
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22214,7 +22188,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22214
22188
|
function createInjectableDefinitionMap(meta) {
|
|
22215
22189
|
const definitionMap = new DefinitionMap();
|
|
22216
22190
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22217
|
-
definitionMap.set('version', literal('
|
|
22191
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
22218
22192
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
22219
22193
|
definitionMap.set('type', meta.internalType);
|
|
22220
22194
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22272,7 +22246,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22272
22246
|
function createInjectorDefinitionMap(meta) {
|
|
22273
22247
|
const definitionMap = new DefinitionMap();
|
|
22274
22248
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22275
|
-
definitionMap.set('version', literal('
|
|
22249
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
22276
22250
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
22277
22251
|
definitionMap.set('type', meta.internalType);
|
|
22278
22252
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22309,7 +22283,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22309
22283
|
function createNgModuleDefinitionMap(meta) {
|
|
22310
22284
|
const definitionMap = new DefinitionMap();
|
|
22311
22285
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22312
|
-
definitionMap.set('version', literal('
|
|
22286
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
22313
22287
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
22314
22288
|
definitionMap.set('type', meta.internalType);
|
|
22315
22289
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22367,7 +22341,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22367
22341
|
function createPipeDefinitionMap(meta) {
|
|
22368
22342
|
const definitionMap = new DefinitionMap();
|
|
22369
22343
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22370
|
-
definitionMap.set('version', literal('
|
|
22344
|
+
definitionMap.set('version', literal('14.0.0-next.0'));
|
|
22371
22345
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
22372
22346
|
// e.g. `type: MyPipe`
|
|
22373
22347
|
definitionMap.set('type', meta.internalType);
|
|
@@ -22417,5 +22391,5 @@ publishFacade(_global);
|
|
|
22417
22391
|
* found in the LICENSE file at https://angular.io/license
|
|
22418
22392
|
*/
|
|
22419
22393
|
|
|
22420
|
-
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 };
|
|
22394
|
+
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 };
|
|
22421
22395
|
//# sourceMappingURL=compiler.mjs.map
|