@angular/compiler 20.1.3 → 20.1.5
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/fesm2022/compiler.mjs +41 -18
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +11 -8
- package/package.json +1 -1
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.1.
|
|
2
|
+
* @license Angular v20.1.5
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -18621,7 +18621,7 @@ class Parser {
|
|
|
18621
18621
|
parseAction(input, parseSourceSpan, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
18622
18622
|
const errors = [];
|
|
18623
18623
|
this._checkNoInterpolation(errors, input, parseSourceSpan, interpolationConfig);
|
|
18624
|
-
const sourceToLex = this._stripComments(input);
|
|
18624
|
+
const { stripped: sourceToLex } = this._stripComments(input);
|
|
18625
18625
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18626
18626
|
const ast = new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 1 /* ParseFlags.Action */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
18627
18627
|
return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
|
|
@@ -18648,7 +18648,7 @@ class Parser {
|
|
|
18648
18648
|
}
|
|
18649
18649
|
_parseBindingAst(input, parseSourceSpan, absoluteOffset, interpolationConfig, errors) {
|
|
18650
18650
|
this._checkNoInterpolation(errors, input, parseSourceSpan, interpolationConfig);
|
|
18651
|
-
const sourceToLex = this._stripComments(input);
|
|
18651
|
+
const { stripped: sourceToLex } = this._stripComments(input);
|
|
18652
18652
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18653
18653
|
return new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
18654
18654
|
}
|
|
@@ -18699,8 +18699,13 @@ class Parser {
|
|
|
18699
18699
|
// indexes inside the tokens.
|
|
18700
18700
|
const expressionSpan = interpolatedTokens?.[i * 2 + 1]?.sourceSpan;
|
|
18701
18701
|
const expressionText = expressions[i].text;
|
|
18702
|
-
const sourceToLex = this._stripComments(expressionText);
|
|
18702
|
+
const { stripped: sourceToLex, hasComments } = this._stripComments(expressionText);
|
|
18703
18703
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18704
|
+
if (hasComments && sourceToLex.trim().length === 0 && tokens.length === 0) {
|
|
18705
|
+
// Empty expressions error are handled futher down, here we only take care of the comment case
|
|
18706
|
+
errors.push(getParseError('Interpolation expression cannot only contain a comment', input, `at column ${expressions[i].start} in`, parseSourceSpan));
|
|
18707
|
+
continue;
|
|
18708
|
+
}
|
|
18704
18709
|
const ast = new _ParseAST(expressionSpan ? expressionText : input, expressionSpan || parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, offsets[i], this._supportsDirectPipeReferences).parseChain();
|
|
18705
18710
|
expressionNodes.push(ast);
|
|
18706
18711
|
}
|
|
@@ -18712,7 +18717,7 @@ class Parser {
|
|
|
18712
18717
|
* This is used for parsing the switch expression in ICUs.
|
|
18713
18718
|
*/
|
|
18714
18719
|
parseInterpolationExpression(expression, parseSourceSpan, absoluteOffset) {
|
|
18715
|
-
const sourceToLex = this._stripComments(expression);
|
|
18720
|
+
const { stripped: sourceToLex } = this._stripComments(expression);
|
|
18716
18721
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18717
18722
|
const errors = [];
|
|
18718
18723
|
const ast = new _ParseAST(expression, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
@@ -18800,7 +18805,9 @@ class Parser {
|
|
|
18800
18805
|
}
|
|
18801
18806
|
_stripComments(input) {
|
|
18802
18807
|
const i = this._commentStart(input);
|
|
18803
|
-
return i != null
|
|
18808
|
+
return i != null
|
|
18809
|
+
? { stripped: input.substring(0, i), hasComments: true }
|
|
18810
|
+
: { stripped: input, hasComments: false };
|
|
18804
18811
|
}
|
|
18805
18812
|
_commentStart(input) {
|
|
18806
18813
|
let outerQuote = null;
|
|
@@ -27830,11 +27837,25 @@ class BindingParser {
|
|
|
27830
27837
|
return this._isAllowedAssignmentEvent(ast.args[0]);
|
|
27831
27838
|
}
|
|
27832
27839
|
if (ast instanceof PropertyRead || ast instanceof KeyedRead) {
|
|
27833
|
-
|
|
27840
|
+
if (!hasRecursiveSafeReceiver(ast)) {
|
|
27841
|
+
return true;
|
|
27842
|
+
}
|
|
27834
27843
|
}
|
|
27835
27844
|
return false;
|
|
27836
27845
|
}
|
|
27837
27846
|
}
|
|
27847
|
+
function hasRecursiveSafeReceiver(ast) {
|
|
27848
|
+
if (ast instanceof SafePropertyRead || ast instanceof SafeKeyedRead) {
|
|
27849
|
+
return true;
|
|
27850
|
+
}
|
|
27851
|
+
if (ast instanceof ParenthesizedExpression) {
|
|
27852
|
+
return hasRecursiveSafeReceiver(ast.expression);
|
|
27853
|
+
}
|
|
27854
|
+
if (ast instanceof PropertyRead || ast instanceof KeyedRead || ast instanceof Call) {
|
|
27855
|
+
return hasRecursiveSafeReceiver(ast.receiver);
|
|
27856
|
+
}
|
|
27857
|
+
return false;
|
|
27858
|
+
}
|
|
27838
27859
|
function isLegacyAnimationLabel(name) {
|
|
27839
27860
|
return name[0] == '@';
|
|
27840
27861
|
}
|
|
@@ -30488,7 +30509,8 @@ class R3TargetBinder {
|
|
|
30488
30509
|
// Bind the host element in a separate scope. Note that it only uses the
|
|
30489
30510
|
// `TemplateBinder` since directives don't apply inside a host context.
|
|
30490
30511
|
if (target.host) {
|
|
30491
|
-
|
|
30512
|
+
directives.set(target.host.node, target.host.directives);
|
|
30513
|
+
TemplateBinder.applyWithScope(target.host.node, Scope.apply(target.host.node), expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
30492
30514
|
}
|
|
30493
30515
|
return new R3BoundTarget(target, directives, eagerDirectives, missingDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
|
|
30494
30516
|
}
|
|
@@ -31281,7 +31303,8 @@ class R3BoundTarget {
|
|
|
31281
31303
|
}
|
|
31282
31304
|
if (target instanceof Template ||
|
|
31283
31305
|
target.node instanceof Component$1 ||
|
|
31284
|
-
target.node instanceof Directive$1
|
|
31306
|
+
target.node instanceof Directive$1 ||
|
|
31307
|
+
target.node instanceof HostElement) {
|
|
31285
31308
|
return null;
|
|
31286
31309
|
}
|
|
31287
31310
|
return this.referenceTargetToElement(target.node);
|
|
@@ -33757,7 +33780,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
33757
33780
|
function compileDeclareClassMetadata(metadata) {
|
|
33758
33781
|
const definitionMap = new DefinitionMap();
|
|
33759
33782
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
33760
|
-
definitionMap.set('version', literal('20.1.
|
|
33783
|
+
definitionMap.set('version', literal('20.1.5'));
|
|
33761
33784
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33762
33785
|
definitionMap.set('type', metadata.type);
|
|
33763
33786
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -33775,7 +33798,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
33775
33798
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
33776
33799
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
33777
33800
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
33778
|
-
definitionMap.set('version', literal('20.1.
|
|
33801
|
+
definitionMap.set('version', literal('20.1.5'));
|
|
33779
33802
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33780
33803
|
definitionMap.set('type', metadata.type);
|
|
33781
33804
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -33870,7 +33893,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33870
33893
|
const definitionMap = new DefinitionMap();
|
|
33871
33894
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
33872
33895
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33873
|
-
definitionMap.set('version', literal('20.1.
|
|
33896
|
+
definitionMap.set('version', literal('20.1.5'));
|
|
33874
33897
|
// e.g. `type: MyDirective`
|
|
33875
33898
|
definitionMap.set('type', meta.type.value);
|
|
33876
33899
|
if (meta.isStandalone !== undefined) {
|
|
@@ -34286,7 +34309,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
34286
34309
|
function compileDeclareFactoryFunction(meta) {
|
|
34287
34310
|
const definitionMap = new DefinitionMap();
|
|
34288
34311
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
34289
|
-
definitionMap.set('version', literal('20.1.
|
|
34312
|
+
definitionMap.set('version', literal('20.1.5'));
|
|
34290
34313
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34291
34314
|
definitionMap.set('type', meta.type.value);
|
|
34292
34315
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -34321,7 +34344,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
34321
34344
|
function createInjectableDefinitionMap(meta) {
|
|
34322
34345
|
const definitionMap = new DefinitionMap();
|
|
34323
34346
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
34324
|
-
definitionMap.set('version', literal('20.1.
|
|
34347
|
+
definitionMap.set('version', literal('20.1.5'));
|
|
34325
34348
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34326
34349
|
definitionMap.set('type', meta.type.value);
|
|
34327
34350
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -34372,7 +34395,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
34372
34395
|
function createInjectorDefinitionMap(meta) {
|
|
34373
34396
|
const definitionMap = new DefinitionMap();
|
|
34374
34397
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
34375
|
-
definitionMap.set('version', literal('20.1.
|
|
34398
|
+
definitionMap.set('version', literal('20.1.5'));
|
|
34376
34399
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34377
34400
|
definitionMap.set('type', meta.type.value);
|
|
34378
34401
|
definitionMap.set('providers', meta.providers);
|
|
@@ -34405,7 +34428,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
34405
34428
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
34406
34429
|
}
|
|
34407
34430
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
34408
|
-
definitionMap.set('version', literal('20.1.
|
|
34431
|
+
definitionMap.set('version', literal('20.1.5'));
|
|
34409
34432
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34410
34433
|
definitionMap.set('type', meta.type.value);
|
|
34411
34434
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -34456,7 +34479,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
34456
34479
|
function createPipeDefinitionMap(meta) {
|
|
34457
34480
|
const definitionMap = new DefinitionMap();
|
|
34458
34481
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
34459
|
-
definitionMap.set('version', literal('20.1.
|
|
34482
|
+
definitionMap.set('version', literal('20.1.5'));
|
|
34460
34483
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34461
34484
|
// e.g. `type: MyPipe`
|
|
34462
34485
|
definitionMap.set('type', meta.type.value);
|
|
@@ -34612,7 +34635,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
34612
34635
|
* @description
|
|
34613
34636
|
* Entry point for all public APIs of the compiler package.
|
|
34614
34637
|
*/
|
|
34615
|
-
const VERSION = new Version('20.1.
|
|
34638
|
+
const VERSION = new Version('20.1.5');
|
|
34616
34639
|
|
|
34617
34640
|
//////////////////////////////////////
|
|
34618
34641
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|