@angular-eslint/bundled-angular-compiler 18.0.1 → 18.0.2-alpha.1
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/dist/index.js +227 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @license Angular v18.0.
|
|
4
|
+
* @license Angular v18.0.2
|
|
5
5
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
6
6
|
* License: MIT
|
|
7
7
|
*/
|
|
@@ -5053,6 +5053,18 @@ class UnknownBlock {
|
|
|
5053
5053
|
return visitor.visitUnknownBlock(this);
|
|
5054
5054
|
}
|
|
5055
5055
|
}
|
|
5056
|
+
class LetDeclaration$1 {
|
|
5057
|
+
constructor(name, value, sourceSpan, nameSpan, valueSpan) {
|
|
5058
|
+
this.name = name;
|
|
5059
|
+
this.value = value;
|
|
5060
|
+
this.sourceSpan = sourceSpan;
|
|
5061
|
+
this.nameSpan = nameSpan;
|
|
5062
|
+
this.valueSpan = valueSpan;
|
|
5063
|
+
}
|
|
5064
|
+
visit(visitor) {
|
|
5065
|
+
return visitor.visitLetDeclaration(this);
|
|
5066
|
+
}
|
|
5067
|
+
}
|
|
5056
5068
|
class Template {
|
|
5057
5069
|
constructor(
|
|
5058
5070
|
// tagName is the name of the container element, if applicable.
|
|
@@ -5188,6 +5200,7 @@ class RecursiveVisitor$1 {
|
|
|
5188
5200
|
visitIcu(icu) { }
|
|
5189
5201
|
visitDeferredTrigger(trigger) { }
|
|
5190
5202
|
visitUnknownBlock(block) { }
|
|
5203
|
+
visitLetDeclaration(decl) { }
|
|
5191
5204
|
}
|
|
5192
5205
|
function visitAll$1(visitor, nodes) {
|
|
5193
5206
|
const result = [];
|
|
@@ -14229,6 +14242,18 @@ class BlockParameter {
|
|
|
14229
14242
|
return visitor.visitBlockParameter(this, context);
|
|
14230
14243
|
}
|
|
14231
14244
|
}
|
|
14245
|
+
class LetDeclaration {
|
|
14246
|
+
constructor(name, value, sourceSpan, nameSpan, valueSpan) {
|
|
14247
|
+
this.name = name;
|
|
14248
|
+
this.value = value;
|
|
14249
|
+
this.sourceSpan = sourceSpan;
|
|
14250
|
+
this.nameSpan = nameSpan;
|
|
14251
|
+
this.valueSpan = valueSpan;
|
|
14252
|
+
}
|
|
14253
|
+
visit(visitor, context) {
|
|
14254
|
+
return visitor.visitLetDeclaration(this, context);
|
|
14255
|
+
}
|
|
14256
|
+
}
|
|
14232
14257
|
function visitAll(visitor, nodes, context = null) {
|
|
14233
14258
|
const result = [];
|
|
14234
14259
|
const visit = visitor.visit
|
|
@@ -14266,6 +14291,7 @@ class RecursiveVisitor {
|
|
|
14266
14291
|
});
|
|
14267
14292
|
}
|
|
14268
14293
|
visitBlockParameter(ast, context) { }
|
|
14294
|
+
visitLetDeclaration(decl, context) { }
|
|
14269
14295
|
visitChildren(context, cb) {
|
|
14270
14296
|
let results = [];
|
|
14271
14297
|
let t = this;
|
|
@@ -15229,6 +15255,9 @@ class _I18nVisitor {
|
|
|
15229
15255
|
visitBlockParameter(_parameter, _context) {
|
|
15230
15256
|
throw new Error('Unreachable code');
|
|
15231
15257
|
}
|
|
15258
|
+
visitLetDeclaration(decl, context) {
|
|
15259
|
+
return null;
|
|
15260
|
+
}
|
|
15232
15261
|
/**
|
|
15233
15262
|
* Convert, text and interpolated tokens up into text and placeholder pieces.
|
|
15234
15263
|
*
|
|
@@ -17554,6 +17583,8 @@ class _Tokenizer {
|
|
|
17554
17583
|
this._preserveLineEndings = options.preserveLineEndings || false;
|
|
17555
17584
|
this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false;
|
|
17556
17585
|
this._tokenizeBlocks = options.tokenizeBlocks ?? true;
|
|
17586
|
+
// TODO(crisbeto): eventually set this to true.
|
|
17587
|
+
this._tokenizeLet = options.tokenizeLet || false;
|
|
17557
17588
|
try {
|
|
17558
17589
|
this._cursor.init();
|
|
17559
17590
|
}
|
|
@@ -17594,6 +17625,14 @@ class _Tokenizer {
|
|
|
17594
17625
|
this._consumeTagOpen(start);
|
|
17595
17626
|
}
|
|
17596
17627
|
}
|
|
17628
|
+
else if (this._tokenizeLet &&
|
|
17629
|
+
// Use `peek` instead of `attempCharCode` since we
|
|
17630
|
+
// don't want to advance in case it's not `@let`.
|
|
17631
|
+
this._cursor.peek() === $AT &&
|
|
17632
|
+
!this._inInterpolation &&
|
|
17633
|
+
this._attemptStr('@let')) {
|
|
17634
|
+
this._consumeLetDeclaration(start);
|
|
17635
|
+
}
|
|
17597
17636
|
else if (this._tokenizeBlocks && this._attemptCharCode($AT)) {
|
|
17598
17637
|
this._consumeBlockStart(start);
|
|
17599
17638
|
}
|
|
@@ -17614,7 +17653,7 @@ class _Tokenizer {
|
|
|
17614
17653
|
this.handleError(e);
|
|
17615
17654
|
}
|
|
17616
17655
|
}
|
|
17617
|
-
this._beginToken(
|
|
17656
|
+
this._beginToken(33 /* TokenType.EOF */);
|
|
17618
17657
|
this._endToken([]);
|
|
17619
17658
|
}
|
|
17620
17659
|
_getBlockName() {
|
|
@@ -17705,6 +17744,77 @@ class _Tokenizer {
|
|
|
17705
17744
|
this._attemptCharCodeUntilFn(isBlockParameterChar);
|
|
17706
17745
|
}
|
|
17707
17746
|
}
|
|
17747
|
+
_consumeLetDeclaration(start) {
|
|
17748
|
+
this._beginToken(29 /* TokenType.LET_START */, start);
|
|
17749
|
+
// Require at least one white space after the `@let`.
|
|
17750
|
+
if (isWhitespace(this._cursor.peek())) {
|
|
17751
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
17752
|
+
}
|
|
17753
|
+
else {
|
|
17754
|
+
const token = this._endToken([this._cursor.getChars(start)]);
|
|
17755
|
+
token.type = 32 /* TokenType.INCOMPLETE_LET */;
|
|
17756
|
+
return;
|
|
17757
|
+
}
|
|
17758
|
+
const startToken = this._endToken([this._getLetDeclarationName()]);
|
|
17759
|
+
// Skip over white space before the equals character.
|
|
17760
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
17761
|
+
// Expect an equals sign.
|
|
17762
|
+
if (!this._attemptCharCode($EQ)) {
|
|
17763
|
+
startToken.type = 32 /* TokenType.INCOMPLETE_LET */;
|
|
17764
|
+
return;
|
|
17765
|
+
}
|
|
17766
|
+
// Skip spaces after the equals.
|
|
17767
|
+
this._attemptCharCodeUntilFn((code) => isNotWhitespace(code) && !isNewLine(code));
|
|
17768
|
+
this._consumeLetDeclarationValue();
|
|
17769
|
+
// Terminate the `@let` with a semicolon.
|
|
17770
|
+
const endChar = this._cursor.peek();
|
|
17771
|
+
if (endChar === $SEMICOLON) {
|
|
17772
|
+
this._beginToken(31 /* TokenType.LET_END */);
|
|
17773
|
+
this._endToken([]);
|
|
17774
|
+
this._cursor.advance();
|
|
17775
|
+
}
|
|
17776
|
+
else {
|
|
17777
|
+
startToken.type = 32 /* TokenType.INCOMPLETE_LET */;
|
|
17778
|
+
startToken.sourceSpan = this._cursor.getSpan(start);
|
|
17779
|
+
}
|
|
17780
|
+
}
|
|
17781
|
+
_getLetDeclarationName() {
|
|
17782
|
+
const nameCursor = this._cursor.clone();
|
|
17783
|
+
let allowDigit = false;
|
|
17784
|
+
this._attemptCharCodeUntilFn((code) => {
|
|
17785
|
+
// `@let` names can't start with a digit, but digits are valid anywhere else in the name.
|
|
17786
|
+
if (isAsciiLetter(code) || code === $_ || (allowDigit && isDigit(code))) {
|
|
17787
|
+
allowDigit = true;
|
|
17788
|
+
return false;
|
|
17789
|
+
}
|
|
17790
|
+
return true;
|
|
17791
|
+
});
|
|
17792
|
+
return this._cursor.getChars(nameCursor).trim();
|
|
17793
|
+
}
|
|
17794
|
+
_consumeLetDeclarationValue() {
|
|
17795
|
+
const start = this._cursor.clone();
|
|
17796
|
+
this._beginToken(30 /* TokenType.LET_VALUE */, start);
|
|
17797
|
+
while (this._cursor.peek() !== $EOF) {
|
|
17798
|
+
const char = this._cursor.peek();
|
|
17799
|
+
// `@let` declarations terminate with a semicolon.
|
|
17800
|
+
if (char === $SEMICOLON) {
|
|
17801
|
+
break;
|
|
17802
|
+
}
|
|
17803
|
+
// If we hit a quote, skip over its content since we don't care what's inside.
|
|
17804
|
+
if (isQuote(char)) {
|
|
17805
|
+
this._cursor.advance();
|
|
17806
|
+
this._attemptCharCodeUntilFn((inner) => {
|
|
17807
|
+
if (inner === $BACKSLASH) {
|
|
17808
|
+
this._cursor.advance();
|
|
17809
|
+
return false;
|
|
17810
|
+
}
|
|
17811
|
+
return inner === char;
|
|
17812
|
+
});
|
|
17813
|
+
}
|
|
17814
|
+
this._cursor.advance();
|
|
17815
|
+
}
|
|
17816
|
+
this._endToken([this._cursor.getChars(start)]);
|
|
17817
|
+
}
|
|
17708
17818
|
/**
|
|
17709
17819
|
* @returns whether an ICU token has been created
|
|
17710
17820
|
* @internal
|
|
@@ -18635,7 +18745,7 @@ class _TreeBuilder {
|
|
|
18635
18745
|
this._advance();
|
|
18636
18746
|
}
|
|
18637
18747
|
build() {
|
|
18638
|
-
while (this._peek.type !==
|
|
18748
|
+
while (this._peek.type !== 33 /* TokenType.EOF */) {
|
|
18639
18749
|
if (this._peek.type === 0 /* TokenType.TAG_OPEN_START */ ||
|
|
18640
18750
|
this._peek.type === 4 /* TokenType.INCOMPLETE_TAG_OPEN */) {
|
|
18641
18751
|
this._consumeStartTag(this._advance());
|
|
@@ -18672,6 +18782,14 @@ class _TreeBuilder {
|
|
|
18672
18782
|
this._closeVoidElement();
|
|
18673
18783
|
this._consumeIncompleteBlock(this._advance());
|
|
18674
18784
|
}
|
|
18785
|
+
else if (this._peek.type === 29 /* TokenType.LET_START */) {
|
|
18786
|
+
this._closeVoidElement();
|
|
18787
|
+
this._consumeLet(this._advance());
|
|
18788
|
+
}
|
|
18789
|
+
else if (this._peek.type === 32 /* TokenType.INCOMPLETE_LET */) {
|
|
18790
|
+
this._closeVoidElement();
|
|
18791
|
+
this._consumeIncompleteLet(this._advance());
|
|
18792
|
+
}
|
|
18675
18793
|
else {
|
|
18676
18794
|
// Skip all other tokens...
|
|
18677
18795
|
this._advance();
|
|
@@ -18745,7 +18863,7 @@ class _TreeBuilder {
|
|
|
18745
18863
|
if (!exp)
|
|
18746
18864
|
return null;
|
|
18747
18865
|
const end = this._advance();
|
|
18748
|
-
exp.push({ type:
|
|
18866
|
+
exp.push({ type: 33 /* TokenType.EOF */, parts: [], sourceSpan: end.sourceSpan });
|
|
18749
18867
|
// parse everything in between { and }
|
|
18750
18868
|
const expansionCaseParser = new _TreeBuilder(exp, this.getTagDefinition);
|
|
18751
18869
|
expansionCaseParser.build();
|
|
@@ -18785,7 +18903,7 @@ class _TreeBuilder {
|
|
|
18785
18903
|
return null;
|
|
18786
18904
|
}
|
|
18787
18905
|
}
|
|
18788
|
-
if (this._peek.type ===
|
|
18906
|
+
if (this._peek.type === 33 /* TokenType.EOF */) {
|
|
18789
18907
|
this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
|
|
18790
18908
|
return null;
|
|
18791
18909
|
}
|
|
@@ -19015,6 +19133,51 @@ class _TreeBuilder {
|
|
|
19015
19133
|
this.errors.push(TreeError.create(token.parts[0], span, `Incomplete block "${token.parts[0]}". If you meant to write the @ character, ` +
|
|
19016
19134
|
`you should use the "@" HTML entity instead.`));
|
|
19017
19135
|
}
|
|
19136
|
+
_consumeLet(startToken) {
|
|
19137
|
+
const name = startToken.parts[0];
|
|
19138
|
+
let valueToken;
|
|
19139
|
+
let endToken;
|
|
19140
|
+
if (this._peek.type !== 30 /* TokenType.LET_VALUE */) {
|
|
19141
|
+
this.errors.push(TreeError.create(startToken.parts[0], startToken.sourceSpan, `Invalid @let declaration "${name}". Declaration must have a value.`));
|
|
19142
|
+
return;
|
|
19143
|
+
}
|
|
19144
|
+
else {
|
|
19145
|
+
valueToken = this._advance();
|
|
19146
|
+
}
|
|
19147
|
+
// Type cast is necessary here since TS narrowed the type of `peek` above.
|
|
19148
|
+
if (this._peek.type !== 31 /* TokenType.LET_END */) {
|
|
19149
|
+
this.errors.push(TreeError.create(startToken.parts[0], startToken.sourceSpan, `Unterminated @let declaration "${name}". Declaration must be terminated with a semicolon.`));
|
|
19150
|
+
return;
|
|
19151
|
+
}
|
|
19152
|
+
else {
|
|
19153
|
+
endToken = this._advance();
|
|
19154
|
+
}
|
|
19155
|
+
const end = endToken.sourceSpan.fullStart;
|
|
19156
|
+
const span = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);
|
|
19157
|
+
// The start token usually captures the `@let`. Construct a name span by
|
|
19158
|
+
// offsetting the start by the length of any text before the name.
|
|
19159
|
+
const startOffset = startToken.sourceSpan.toString().lastIndexOf(name);
|
|
19160
|
+
const nameStart = startToken.sourceSpan.start.moveBy(startOffset);
|
|
19161
|
+
const nameSpan = new ParseSourceSpan(nameStart, startToken.sourceSpan.end);
|
|
19162
|
+
const node = new LetDeclaration(name, valueToken.parts[0], span, nameSpan, valueToken.sourceSpan);
|
|
19163
|
+
this._addToParent(node);
|
|
19164
|
+
}
|
|
19165
|
+
_consumeIncompleteLet(token) {
|
|
19166
|
+
// Incomplete `@let` declaration may end up with an empty name.
|
|
19167
|
+
const name = token.parts[0] ?? '';
|
|
19168
|
+
const nameString = name ? ` "${name}"` : '';
|
|
19169
|
+
// If there's at least a name, we can salvage an AST node that can be used for completions.
|
|
19170
|
+
if (name.length > 0) {
|
|
19171
|
+
const startOffset = token.sourceSpan.toString().lastIndexOf(name);
|
|
19172
|
+
const nameStart = token.sourceSpan.start.moveBy(startOffset);
|
|
19173
|
+
const nameSpan = new ParseSourceSpan(nameStart, token.sourceSpan.end);
|
|
19174
|
+
const valueSpan = new ParseSourceSpan(token.sourceSpan.start, token.sourceSpan.start.moveBy(0));
|
|
19175
|
+
const node = new LetDeclaration(name, '', token.sourceSpan, nameSpan, valueSpan);
|
|
19176
|
+
this._addToParent(node);
|
|
19177
|
+
}
|
|
19178
|
+
this.errors.push(TreeError.create(token.parts[0], token.sourceSpan, `Incomplete @let declaration${nameString}. ` +
|
|
19179
|
+
`@let declarations must be written as \`@let <name> = <value>;\``));
|
|
19180
|
+
}
|
|
19018
19181
|
_getContainer() {
|
|
19019
19182
|
return this._containerStack.length > 0
|
|
19020
19183
|
? this._containerStack[this._containerStack.length - 1]
|
|
@@ -19243,6 +19406,9 @@ class I18nMetaVisitor {
|
|
|
19243
19406
|
visitBlockParameter(parameter, context) {
|
|
19244
19407
|
return parameter;
|
|
19245
19408
|
}
|
|
19409
|
+
visitLetDeclaration(decl, context) {
|
|
19410
|
+
return decl;
|
|
19411
|
+
}
|
|
19246
19412
|
/**
|
|
19247
19413
|
* Parse the general form `meta` passed into extract the explicit metadata needed to create a
|
|
19248
19414
|
* `Message`.
|
|
@@ -22820,7 +22986,7 @@ function optimizeTrackFns(job) {
|
|
|
22820
22986
|
}
|
|
22821
22987
|
}
|
|
22822
22988
|
function isTrackByFunctionCall(rootView, expr) {
|
|
22823
|
-
if (!(expr instanceof InvokeFunctionExpr) || expr.args.length
|
|
22989
|
+
if (!(expr instanceof InvokeFunctionExpr) || expr.args.length === 0 || expr.args.length > 2) {
|
|
22824
22990
|
return false;
|
|
22825
22991
|
}
|
|
22826
22992
|
if (!(expr.receiver instanceof ReadPropExpr && expr.receiver.receiver instanceof ContextExpr) ||
|
|
@@ -22831,6 +22997,9 @@ function isTrackByFunctionCall(rootView, expr) {
|
|
|
22831
22997
|
if (!(arg0 instanceof ReadVarExpr) || arg0.name !== '$index') {
|
|
22832
22998
|
return false;
|
|
22833
22999
|
}
|
|
23000
|
+
else if (expr.args.length === 1) {
|
|
23001
|
+
return true;
|
|
23002
|
+
}
|
|
22834
23003
|
if (!(arg1 instanceof ReadVarExpr) || arg1.name !== '$item') {
|
|
22835
23004
|
return false;
|
|
22836
23005
|
}
|
|
@@ -23737,6 +23906,7 @@ function ingestNodes(unit, template) {
|
|
|
23737
23906
|
else if (node instanceof ForLoopBlock) {
|
|
23738
23907
|
ingestForBlock(unit, node);
|
|
23739
23908
|
}
|
|
23909
|
+
else if (node instanceof LetDeclaration$1) ;
|
|
23740
23910
|
else {
|
|
23741
23911
|
throw new Error(`Unsupported template node: ${node.constructor.name}`);
|
|
23742
23912
|
}
|
|
@@ -24900,6 +25070,9 @@ class WhitespaceVisitor {
|
|
|
24900
25070
|
visitBlockParameter(parameter, context) {
|
|
24901
25071
|
return parameter;
|
|
24902
25072
|
}
|
|
25073
|
+
visitLetDeclaration(decl, context) {
|
|
25074
|
+
return decl;
|
|
25075
|
+
}
|
|
24903
25076
|
}
|
|
24904
25077
|
function createWhitespaceProcessedTextToken({ type, parts, sourceSpan }) {
|
|
24905
25078
|
return { type, parts: [processWhitespace(parts[0])], sourceSpan };
|
|
@@ -26555,6 +26728,13 @@ class HtmlAstToIvyAst {
|
|
|
26555
26728
|
}
|
|
26556
26729
|
return null;
|
|
26557
26730
|
}
|
|
26731
|
+
visitLetDeclaration(decl, context) {
|
|
26732
|
+
const value = this.bindingParser.parseBinding(decl.value, false, decl.valueSpan, decl.valueSpan.start.offset);
|
|
26733
|
+
if (value.errors.length === 0 && value.ast instanceof EmptyExpr$1) {
|
|
26734
|
+
this.reportError('@let declaration value cannot be empty', decl.valueSpan);
|
|
26735
|
+
}
|
|
26736
|
+
return new LetDeclaration$1(decl.name, value, decl.sourceSpan, decl.nameSpan, decl.valueSpan);
|
|
26737
|
+
}
|
|
26558
26738
|
visitBlockParameter() {
|
|
26559
26739
|
return null;
|
|
26560
26740
|
}
|
|
@@ -26833,6 +27013,9 @@ class NonBindableVisitor {
|
|
|
26833
27013
|
visitBlockParameter(parameter, context) {
|
|
26834
27014
|
return null;
|
|
26835
27015
|
}
|
|
27016
|
+
visitLetDeclaration(decl, context) {
|
|
27017
|
+
return new Text$3(`@let ${decl.name} = ${decl.value};`, decl.sourceSpan);
|
|
27018
|
+
}
|
|
26836
27019
|
}
|
|
26837
27020
|
const NON_BINDABLE_VISITOR = new NonBindableVisitor();
|
|
26838
27021
|
function normalizeAttributeName(attrName) {
|
|
@@ -26867,6 +27050,7 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
26867
27050
|
...options,
|
|
26868
27051
|
tokenizeExpansionForms: true,
|
|
26869
27052
|
tokenizeBlocks: options.enableBlockSyntax ?? true,
|
|
27053
|
+
tokenizeLet: options.enableLetSyntax ?? false,
|
|
26870
27054
|
});
|
|
26871
27055
|
if (!options.alwaysAttemptHtmlToR3AstConversion &&
|
|
26872
27056
|
parseResult.errors &&
|
|
@@ -27636,6 +27820,9 @@ class Scope {
|
|
|
27636
27820
|
visitContent(content) {
|
|
27637
27821
|
this.ingestScopedNode(content);
|
|
27638
27822
|
}
|
|
27823
|
+
visitLetDeclaration(decl) {
|
|
27824
|
+
this.maybeDeclare(decl);
|
|
27825
|
+
}
|
|
27639
27826
|
// Unused visitors.
|
|
27640
27827
|
visitBoundAttribute(attr) { }
|
|
27641
27828
|
visitBoundEvent(event) { }
|
|
@@ -27848,6 +28035,7 @@ class DirectiveBinder {
|
|
|
27848
28035
|
visitIcu(icu) { }
|
|
27849
28036
|
visitDeferredTrigger(trigger) { }
|
|
27850
28037
|
visitUnknownBlock(block) { }
|
|
28038
|
+
visitLetDeclaration(decl) { }
|
|
27851
28039
|
}
|
|
27852
28040
|
/**
|
|
27853
28041
|
* Processes a template and extract metadata about expressions and symbols within.
|
|
@@ -28044,6 +28232,12 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
28044
28232
|
visitBoundText(text) {
|
|
28045
28233
|
text.value.visit(this);
|
|
28046
28234
|
}
|
|
28235
|
+
visitLetDeclaration(decl) {
|
|
28236
|
+
decl.value.visit(this);
|
|
28237
|
+
if (this.rootNode !== null) {
|
|
28238
|
+
this.symbols.set(decl, this.rootNode);
|
|
28239
|
+
}
|
|
28240
|
+
}
|
|
28047
28241
|
visitPipe(ast, context) {
|
|
28048
28242
|
this.usedPipes.add(ast.name);
|
|
28049
28243
|
if (!this.scope.isDeferred) {
|
|
@@ -28078,7 +28272,13 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
28078
28272
|
}
|
|
28079
28273
|
// Check whether the name exists in the current scope. If so, map it. Otherwise, the name is
|
|
28080
28274
|
// probably a property on the top-level component context.
|
|
28081
|
-
|
|
28275
|
+
const target = this.scope.lookup(name);
|
|
28276
|
+
// It's not allowed to read template entities via `this`, however it previously worked by
|
|
28277
|
+
// accident (see #55115). Since `@let` declarations are new, we can fix it from the beginning,
|
|
28278
|
+
// whereas pre-existing template entities will be fixed in #55115.
|
|
28279
|
+
if (target instanceof LetDeclaration$1 && ast.receiver instanceof ThisReceiver) {
|
|
28280
|
+
return;
|
|
28281
|
+
}
|
|
28082
28282
|
if (target !== null) {
|
|
28083
28283
|
this.bindings.set(ast, target);
|
|
28084
28284
|
}
|
|
@@ -28913,7 +29113,7 @@ function publishFacade(global) {
|
|
|
28913
29113
|
* @description
|
|
28914
29114
|
* Entry point for all public APIs of the compiler package.
|
|
28915
29115
|
*/
|
|
28916
|
-
const VERSION = new Version('18.0.
|
|
29116
|
+
const VERSION = new Version('18.0.2');
|
|
28917
29117
|
|
|
28918
29118
|
class CompilerConfig {
|
|
28919
29119
|
constructor({ defaultEncapsulation = exports.ViewEncapsulation.Emulated, preserveWhitespaces, strictInjectionParameters, } = {}) {
|
|
@@ -29138,6 +29338,7 @@ class _Visitor {
|
|
|
29138
29338
|
visitAll(this, block.children, context);
|
|
29139
29339
|
}
|
|
29140
29340
|
visitBlockParameter(parameter, context) { }
|
|
29341
|
+
visitLetDeclaration(decl, context) { }
|
|
29141
29342
|
_init(mode, interpolationConfig) {
|
|
29142
29343
|
this._mode = mode;
|
|
29143
29344
|
this._inI18nBlock = false;
|
|
@@ -29350,8 +29551,8 @@ class XmlParser extends Parser {
|
|
|
29350
29551
|
super(getXmlTagDefinition);
|
|
29351
29552
|
}
|
|
29352
29553
|
parse(source, url, options = {}) {
|
|
29353
|
-
// Blocks aren't supported in an XML context.
|
|
29354
|
-
return super.parse(source, url, { ...options, tokenizeBlocks: false });
|
|
29554
|
+
// Blocks and let declarations aren't supported in an XML context.
|
|
29555
|
+
return super.parse(source, url, { ...options, tokenizeBlocks: false, tokenizeLet: false });
|
|
29355
29556
|
}
|
|
29356
29557
|
}
|
|
29357
29558
|
|
|
@@ -29572,6 +29773,7 @@ class XliffParser {
|
|
|
29572
29773
|
visitExpansionCase(expansionCase, context) { }
|
|
29573
29774
|
visitBlock(block, context) { }
|
|
29574
29775
|
visitBlockParameter(parameter, context) { }
|
|
29776
|
+
visitLetDeclaration(decl, context) { }
|
|
29575
29777
|
_addError(node, message) {
|
|
29576
29778
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
29577
29779
|
}
|
|
@@ -29624,6 +29826,7 @@ class XmlToI18n$2 {
|
|
|
29624
29826
|
visitAttribute(attribute, context) { }
|
|
29625
29827
|
visitBlock(block, context) { }
|
|
29626
29828
|
visitBlockParameter(parameter, context) { }
|
|
29829
|
+
visitLetDeclaration(decl, context) { }
|
|
29627
29830
|
_addError(node, message) {
|
|
29628
29831
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
29629
29832
|
}
|
|
@@ -29883,6 +30086,7 @@ class Xliff2Parser {
|
|
|
29883
30086
|
visitExpansionCase(expansionCase, context) { }
|
|
29884
30087
|
visitBlock(block, context) { }
|
|
29885
30088
|
visitBlockParameter(parameter, context) { }
|
|
30089
|
+
visitLetDeclaration(decl, context) { }
|
|
29886
30090
|
_addError(node, message) {
|
|
29887
30091
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
29888
30092
|
}
|
|
@@ -29952,6 +30156,7 @@ class XmlToI18n$1 {
|
|
|
29952
30156
|
visitAttribute(attribute, context) { }
|
|
29953
30157
|
visitBlock(block, context) { }
|
|
29954
30158
|
visitBlockParameter(parameter, context) { }
|
|
30159
|
+
visitLetDeclaration(decl, context) { }
|
|
29955
30160
|
_addError(node, message) {
|
|
29956
30161
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
29957
30162
|
}
|
|
@@ -30088,6 +30293,7 @@ class XtbParser {
|
|
|
30088
30293
|
visitExpansionCase(expansionCase, context) { }
|
|
30089
30294
|
visitBlock(block, context) { }
|
|
30090
30295
|
visitBlockParameter(block, context) { }
|
|
30296
|
+
visitLetDeclaration(decl, context) { }
|
|
30091
30297
|
_addError(node, message) {
|
|
30092
30298
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
30093
30299
|
}
|
|
@@ -30138,6 +30344,7 @@ class XmlToI18n {
|
|
|
30138
30344
|
visitAttribute(attribute, context) { }
|
|
30139
30345
|
visitBlock(block, context) { }
|
|
30140
30346
|
visitBlockParameter(block, context) { }
|
|
30347
|
+
visitLetDeclaration(decl, context) { }
|
|
30141
30348
|
_addError(node, message) {
|
|
30142
30349
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
30143
30350
|
}
|
|
@@ -30544,7 +30751,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
30544
30751
|
function compileDeclareClassMetadata(metadata) {
|
|
30545
30752
|
const definitionMap = new DefinitionMap();
|
|
30546
30753
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
30547
|
-
definitionMap.set('version', literal('18.0.
|
|
30754
|
+
definitionMap.set('version', literal('18.0.2'));
|
|
30548
30755
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
30549
30756
|
definitionMap.set('type', metadata.type);
|
|
30550
30757
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -30562,7 +30769,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
30562
30769
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
30563
30770
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
30564
30771
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
30565
|
-
definitionMap.set('version', literal('18.0.
|
|
30772
|
+
definitionMap.set('version', literal('18.0.2'));
|
|
30566
30773
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
30567
30774
|
definitionMap.set('type', metadata.type);
|
|
30568
30775
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -30657,7 +30864,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
30657
30864
|
const definitionMap = new DefinitionMap();
|
|
30658
30865
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
30659
30866
|
definitionMap.set('minVersion', literal(minVersion));
|
|
30660
|
-
definitionMap.set('version', literal('18.0.
|
|
30867
|
+
definitionMap.set('version', literal('18.0.2'));
|
|
30661
30868
|
// e.g. `type: MyDirective`
|
|
30662
30869
|
definitionMap.set('type', meta.type.value);
|
|
30663
30870
|
if (meta.isStandalone) {
|
|
@@ -31076,7 +31283,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
31076
31283
|
function compileDeclareFactoryFunction(meta) {
|
|
31077
31284
|
const definitionMap = new DefinitionMap();
|
|
31078
31285
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
31079
|
-
definitionMap.set('version', literal('18.0.
|
|
31286
|
+
definitionMap.set('version', literal('18.0.2'));
|
|
31080
31287
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31081
31288
|
definitionMap.set('type', meta.type.value);
|
|
31082
31289
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -31111,7 +31318,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
31111
31318
|
function createInjectableDefinitionMap(meta) {
|
|
31112
31319
|
const definitionMap = new DefinitionMap();
|
|
31113
31320
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
31114
|
-
definitionMap.set('version', literal('18.0.
|
|
31321
|
+
definitionMap.set('version', literal('18.0.2'));
|
|
31115
31322
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31116
31323
|
definitionMap.set('type', meta.type.value);
|
|
31117
31324
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -31162,7 +31369,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
31162
31369
|
function createInjectorDefinitionMap(meta) {
|
|
31163
31370
|
const definitionMap = new DefinitionMap();
|
|
31164
31371
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
31165
|
-
definitionMap.set('version', literal('18.0.
|
|
31372
|
+
definitionMap.set('version', literal('18.0.2'));
|
|
31166
31373
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31167
31374
|
definitionMap.set('type', meta.type.value);
|
|
31168
31375
|
definitionMap.set('providers', meta.providers);
|
|
@@ -31195,7 +31402,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
31195
31402
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
31196
31403
|
}
|
|
31197
31404
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
31198
|
-
definitionMap.set('version', literal('18.0.
|
|
31405
|
+
definitionMap.set('version', literal('18.0.2'));
|
|
31199
31406
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31200
31407
|
definitionMap.set('type', meta.type.value);
|
|
31201
31408
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -31246,7 +31453,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
31246
31453
|
function createPipeDefinitionMap(meta) {
|
|
31247
31454
|
const definitionMap = new DefinitionMap();
|
|
31248
31455
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
31249
|
-
definitionMap.set('version', literal('18.0.
|
|
31456
|
+
definitionMap.set('version', literal('18.0.2'));
|
|
31250
31457
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
31251
31458
|
// e.g. `type: MyPipe`
|
|
31252
31459
|
definitionMap.set('type', meta.type.value);
|
|
@@ -31328,6 +31535,7 @@ exports.JitEvaluator = JitEvaluator;
|
|
|
31328
31535
|
exports.KeyedRead = KeyedRead;
|
|
31329
31536
|
exports.KeyedWrite = KeyedWrite;
|
|
31330
31537
|
exports.LeadingComment = LeadingComment;
|
|
31538
|
+
exports.LetDeclaration = LetDeclaration;
|
|
31331
31539
|
exports.Lexer = Lexer;
|
|
31332
31540
|
exports.LiteralArray = LiteralArray;
|
|
31333
31541
|
exports.LiteralArrayExpr = LiteralArrayExpr;
|
|
@@ -31404,6 +31612,7 @@ exports.TmplAstIfBlock = IfBlock;
|
|
|
31404
31612
|
exports.TmplAstIfBlockBranch = IfBlockBranch;
|
|
31405
31613
|
exports.TmplAstImmediateDeferredTrigger = ImmediateDeferredTrigger;
|
|
31406
31614
|
exports.TmplAstInteractionDeferredTrigger = InteractionDeferredTrigger;
|
|
31615
|
+
exports.TmplAstLetDeclaration = LetDeclaration$1;
|
|
31407
31616
|
exports.TmplAstRecursiveVisitor = RecursiveVisitor$1;
|
|
31408
31617
|
exports.TmplAstReference = Reference;
|
|
31409
31618
|
exports.TmplAstSwitchBlock = SwitchBlock;
|