@angular/compiler 20.2.0-next.2 → 20.2.0-next.3

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.2.0-next.2
2
+ * @license Angular v20.2.0-next.3
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -18824,7 +18824,7 @@ class Parser {
18824
18824
  parseAction(input, parseSourceSpan, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
18825
18825
  const errors = [];
18826
18826
  this._checkNoInterpolation(errors, input, parseSourceSpan, interpolationConfig);
18827
- const sourceToLex = this._stripComments(input);
18827
+ const { stripped: sourceToLex } = this._stripComments(input);
18828
18828
  const tokens = this._lexer.tokenize(sourceToLex);
18829
18829
  const ast = new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 1 /* ParseFlags.Action */, errors, 0, this._supportsDirectPipeReferences).parseChain();
18830
18830
  return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
@@ -18851,7 +18851,7 @@ class Parser {
18851
18851
  }
18852
18852
  _parseBindingAst(input, parseSourceSpan, absoluteOffset, interpolationConfig, errors) {
18853
18853
  this._checkNoInterpolation(errors, input, parseSourceSpan, interpolationConfig);
18854
- const sourceToLex = this._stripComments(input);
18854
+ const { stripped: sourceToLex } = this._stripComments(input);
18855
18855
  const tokens = this._lexer.tokenize(sourceToLex);
18856
18856
  return new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
18857
18857
  }
@@ -18902,8 +18902,13 @@ class Parser {
18902
18902
  // indexes inside the tokens.
18903
18903
  const expressionSpan = interpolatedTokens?.[i * 2 + 1]?.sourceSpan;
18904
18904
  const expressionText = expressions[i].text;
18905
- const sourceToLex = this._stripComments(expressionText);
18905
+ const { stripped: sourceToLex, hasComments } = this._stripComments(expressionText);
18906
18906
  const tokens = this._lexer.tokenize(sourceToLex);
18907
+ if (hasComments && sourceToLex.trim().length === 0 && tokens.length === 0) {
18908
+ // Empty expressions error are handled futher down, here we only take care of the comment case
18909
+ errors.push(getParseError('Interpolation expression cannot only contain a comment', input, `at column ${expressions[i].start} in`, parseSourceSpan));
18910
+ continue;
18911
+ }
18907
18912
  const ast = new _ParseAST(expressionSpan ? expressionText : input, expressionSpan || parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, offsets[i], this._supportsDirectPipeReferences).parseChain();
18908
18913
  expressionNodes.push(ast);
18909
18914
  }
@@ -18915,7 +18920,7 @@ class Parser {
18915
18920
  * This is used for parsing the switch expression in ICUs.
18916
18921
  */
18917
18922
  parseInterpolationExpression(expression, parseSourceSpan, absoluteOffset) {
18918
- const sourceToLex = this._stripComments(expression);
18923
+ const { stripped: sourceToLex } = this._stripComments(expression);
18919
18924
  const tokens = this._lexer.tokenize(sourceToLex);
18920
18925
  const errors = [];
18921
18926
  const ast = new _ParseAST(expression, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
@@ -19003,7 +19008,9 @@ class Parser {
19003
19008
  }
19004
19009
  _stripComments(input) {
19005
19010
  const i = this._commentStart(input);
19006
- return i != null ? input.substring(0, i) : input;
19011
+ return i != null
19012
+ ? { stripped: input.substring(0, i), hasComments: true }
19013
+ : { stripped: input, hasComments: false };
19007
19014
  }
19008
19015
  _commentStart(input) {
19009
19016
  let outerQuote = null;
@@ -28261,11 +28268,25 @@ class BindingParser {
28261
28268
  return this._isAllowedAssignmentEvent(ast.args[0]);
28262
28269
  }
28263
28270
  if (ast instanceof PropertyRead || ast instanceof KeyedRead) {
28264
- return true;
28271
+ if (!hasRecursiveSafeReceiver(ast)) {
28272
+ return true;
28273
+ }
28265
28274
  }
28266
28275
  return false;
28267
28276
  }
28268
28277
  }
28278
+ function hasRecursiveSafeReceiver(ast) {
28279
+ if (ast instanceof SafePropertyRead || ast instanceof SafeKeyedRead) {
28280
+ return true;
28281
+ }
28282
+ if (ast instanceof ParenthesizedExpression) {
28283
+ return hasRecursiveSafeReceiver(ast.expression);
28284
+ }
28285
+ if (ast instanceof PropertyRead || ast instanceof KeyedRead || ast instanceof Call) {
28286
+ return hasRecursiveSafeReceiver(ast.receiver);
28287
+ }
28288
+ return false;
28289
+ }
28269
28290
  function isLegacyAnimationLabel(name) {
28270
28291
  return name[0] == '@';
28271
28292
  }
@@ -34248,7 +34269,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
34248
34269
  function compileDeclareClassMetadata(metadata) {
34249
34270
  const definitionMap = new DefinitionMap();
34250
34271
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
34251
- definitionMap.set('version', literal('20.2.0-next.2'));
34272
+ definitionMap.set('version', literal('20.2.0-next.3'));
34252
34273
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34253
34274
  definitionMap.set('type', metadata.type);
34254
34275
  definitionMap.set('decorators', metadata.decorators);
@@ -34266,7 +34287,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
34266
34287
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
34267
34288
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
34268
34289
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
34269
- definitionMap.set('version', literal('20.2.0-next.2'));
34290
+ definitionMap.set('version', literal('20.2.0-next.3'));
34270
34291
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34271
34292
  definitionMap.set('type', metadata.type);
34272
34293
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -34361,7 +34382,7 @@ function createDirectiveDefinitionMap(meta) {
34361
34382
  const definitionMap = new DefinitionMap();
34362
34383
  const minVersion = getMinimumVersionForPartialOutput(meta);
34363
34384
  definitionMap.set('minVersion', literal(minVersion));
34364
- definitionMap.set('version', literal('20.2.0-next.2'));
34385
+ definitionMap.set('version', literal('20.2.0-next.3'));
34365
34386
  // e.g. `type: MyDirective`
34366
34387
  definitionMap.set('type', meta.type.value);
34367
34388
  if (meta.isStandalone !== undefined) {
@@ -34777,7 +34798,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34777
34798
  function compileDeclareFactoryFunction(meta) {
34778
34799
  const definitionMap = new DefinitionMap();
34779
34800
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34780
- definitionMap.set('version', literal('20.2.0-next.2'));
34801
+ definitionMap.set('version', literal('20.2.0-next.3'));
34781
34802
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34782
34803
  definitionMap.set('type', meta.type.value);
34783
34804
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34812,7 +34833,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34812
34833
  function createInjectableDefinitionMap(meta) {
34813
34834
  const definitionMap = new DefinitionMap();
34814
34835
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34815
- definitionMap.set('version', literal('20.2.0-next.2'));
34836
+ definitionMap.set('version', literal('20.2.0-next.3'));
34816
34837
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34817
34838
  definitionMap.set('type', meta.type.value);
34818
34839
  // Only generate providedIn property if it has a non-null value
@@ -34863,7 +34884,7 @@ function compileDeclareInjectorFromMetadata(meta) {
34863
34884
  function createInjectorDefinitionMap(meta) {
34864
34885
  const definitionMap = new DefinitionMap();
34865
34886
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
34866
- definitionMap.set('version', literal('20.2.0-next.2'));
34887
+ definitionMap.set('version', literal('20.2.0-next.3'));
34867
34888
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34868
34889
  definitionMap.set('type', meta.type.value);
34869
34890
  definitionMap.set('providers', meta.providers);
@@ -34896,7 +34917,7 @@ function createNgModuleDefinitionMap(meta) {
34896
34917
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
34897
34918
  }
34898
34919
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
34899
- definitionMap.set('version', literal('20.2.0-next.2'));
34920
+ definitionMap.set('version', literal('20.2.0-next.3'));
34900
34921
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34901
34922
  definitionMap.set('type', meta.type.value);
34902
34923
  // We only generate the keys in the metadata if the arrays contain values.
@@ -34947,7 +34968,7 @@ function compileDeclarePipeFromMetadata(meta) {
34947
34968
  function createPipeDefinitionMap(meta) {
34948
34969
  const definitionMap = new DefinitionMap();
34949
34970
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
34950
- definitionMap.set('version', literal('20.2.0-next.2'));
34971
+ definitionMap.set('version', literal('20.2.0-next.3'));
34951
34972
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34952
34973
  // e.g. `type: MyPipe`
34953
34974
  definitionMap.set('type', meta.type.value);
@@ -35103,7 +35124,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
35103
35124
  * @description
35104
35125
  * Entry point for all public APIs of the compiler package.
35105
35126
  */
35106
- const VERSION = new Version('20.2.0-next.2');
35127
+ const VERSION = new Version('20.2.0-next.3');
35107
35128
 
35108
35129
  //////////////////////////////////////
35109
35130
  // THIS FILE HAS GLOBAL SIDE EFFECT //