@angular/compiler 20.1.2 → 20.1.4

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.1.2
2
+ * @license Angular v20.1.4
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 ? input.substring(0, i) : input;
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
- return true;
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
  }
@@ -33757,7 +33778,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
33757
33778
  function compileDeclareClassMetadata(metadata) {
33758
33779
  const definitionMap = new DefinitionMap();
33759
33780
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
33760
- definitionMap.set('version', literal('20.1.2'));
33781
+ definitionMap.set('version', literal('20.1.4'));
33761
33782
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33762
33783
  definitionMap.set('type', metadata.type);
33763
33784
  definitionMap.set('decorators', metadata.decorators);
@@ -33775,7 +33796,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
33775
33796
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
33776
33797
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
33777
33798
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
33778
- definitionMap.set('version', literal('20.1.2'));
33799
+ definitionMap.set('version', literal('20.1.4'));
33779
33800
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33780
33801
  definitionMap.set('type', metadata.type);
33781
33802
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -33870,7 +33891,7 @@ function createDirectiveDefinitionMap(meta) {
33870
33891
  const definitionMap = new DefinitionMap();
33871
33892
  const minVersion = getMinimumVersionForPartialOutput(meta);
33872
33893
  definitionMap.set('minVersion', literal(minVersion));
33873
- definitionMap.set('version', literal('20.1.2'));
33894
+ definitionMap.set('version', literal('20.1.4'));
33874
33895
  // e.g. `type: MyDirective`
33875
33896
  definitionMap.set('type', meta.type.value);
33876
33897
  if (meta.isStandalone !== undefined) {
@@ -34286,7 +34307,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34286
34307
  function compileDeclareFactoryFunction(meta) {
34287
34308
  const definitionMap = new DefinitionMap();
34288
34309
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34289
- definitionMap.set('version', literal('20.1.2'));
34310
+ definitionMap.set('version', literal('20.1.4'));
34290
34311
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34291
34312
  definitionMap.set('type', meta.type.value);
34292
34313
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34321,7 +34342,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34321
34342
  function createInjectableDefinitionMap(meta) {
34322
34343
  const definitionMap = new DefinitionMap();
34323
34344
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34324
- definitionMap.set('version', literal('20.1.2'));
34345
+ definitionMap.set('version', literal('20.1.4'));
34325
34346
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34326
34347
  definitionMap.set('type', meta.type.value);
34327
34348
  // Only generate providedIn property if it has a non-null value
@@ -34372,7 +34393,7 @@ function compileDeclareInjectorFromMetadata(meta) {
34372
34393
  function createInjectorDefinitionMap(meta) {
34373
34394
  const definitionMap = new DefinitionMap();
34374
34395
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
34375
- definitionMap.set('version', literal('20.1.2'));
34396
+ definitionMap.set('version', literal('20.1.4'));
34376
34397
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34377
34398
  definitionMap.set('type', meta.type.value);
34378
34399
  definitionMap.set('providers', meta.providers);
@@ -34405,7 +34426,7 @@ function createNgModuleDefinitionMap(meta) {
34405
34426
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
34406
34427
  }
34407
34428
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
34408
- definitionMap.set('version', literal('20.1.2'));
34429
+ definitionMap.set('version', literal('20.1.4'));
34409
34430
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34410
34431
  definitionMap.set('type', meta.type.value);
34411
34432
  // We only generate the keys in the metadata if the arrays contain values.
@@ -34456,7 +34477,7 @@ function compileDeclarePipeFromMetadata(meta) {
34456
34477
  function createPipeDefinitionMap(meta) {
34457
34478
  const definitionMap = new DefinitionMap();
34458
34479
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
34459
- definitionMap.set('version', literal('20.1.2'));
34480
+ definitionMap.set('version', literal('20.1.4'));
34460
34481
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34461
34482
  // e.g. `type: MyPipe`
34462
34483
  definitionMap.set('type', meta.type.value);
@@ -34612,7 +34633,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
34612
34633
  * @description
34613
34634
  * Entry point for all public APIs of the compiler package.
34614
34635
  */
34615
- const VERSION = new Version('20.1.2');
34636
+ const VERSION = new Version('20.1.4');
34616
34637
 
34617
34638
  //////////////////////////////////////
34618
34639
  // THIS FILE HAS GLOBAL SIDE EFFECT //