@angular/compiler 19.2.4 → 19.2.6

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 v19.2.4
2
+ * @license Angular v19.2.6
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1297,14 +1297,13 @@ class TemplateLiteralElementExpr extends Expression {
1297
1297
  constructor(text, sourceSpan, rawText) {
1298
1298
  super(STRING_TYPE, sourceSpan);
1299
1299
  this.text = text;
1300
- // If `rawText` is not provided, try to extract the raw string from its
1301
- // associated `sourceSpan`. If that is also not available, "fake" the raw
1302
- // string instead by escaping the following control sequences:
1300
+ // If `rawText` is not provided, "fake" the raw string by escaping the following sequences:
1303
1301
  // - "\" would otherwise indicate that the next character is a control character.
1304
1302
  // - "`" and "${" are template string control sequences that would otherwise prematurely
1305
1303
  // indicate the end of the template literal element.
1306
- this.rawText =
1307
- rawText ?? sourceSpan?.toString() ?? escapeForTemplateLiteral(escapeSlashes(text));
1304
+ // Note that we can't rely on the `sourceSpan` here, because it may be incorrect (see
1305
+ // https://github.com/angular/angular/pull/60267#discussion_r1986402524).
1306
+ this.rawText = rawText ?? escapeForTemplateLiteral(escapeSlashes(text));
1308
1307
  }
1309
1308
  visitExpression(visitor, context) {
1310
1309
  return visitor.visitTemplateLiteralElementExpr(this, context);
@@ -16090,7 +16089,7 @@ class _Tokenizer {
16090
16089
  else {
16091
16090
  const name = this._cursor.getChars(nameStart);
16092
16091
  this._cursor.advance();
16093
- const char = NAMED_ENTITIES[name];
16092
+ const char = NAMED_ENTITIES.hasOwnProperty(name) && NAMED_ENTITIES[name];
16094
16093
  if (!char) {
16095
16094
  throw this._createError(_unknownEntityErrorMsg(name), this._cursor.getSpan(start));
16096
16095
  }
@@ -27210,11 +27209,13 @@ const FOR_LOOP_EXPRESSION_PATTERN = /^\s*([0-9A-Za-z_$]*)\s+of\s+([\S\s]*)/;
27210
27209
  /** Pattern for the tracking expression in a for loop block. */
27211
27210
  const FOR_LOOP_TRACK_PATTERN = /^track\s+([\S\s]*)/;
27212
27211
  /** Pattern for the `as` expression in a conditional block. */
27213
- const CONDITIONAL_ALIAS_PATTERN = /^(as\s)+(.*)/;
27212
+ const CONDITIONAL_ALIAS_PATTERN = /^(as\s+)(.*)/;
27214
27213
  /** Pattern used to identify an `else if` block. */
27215
27214
  const ELSE_IF_PATTERN = /^else[^\S\r\n]+if/;
27216
27215
  /** Pattern used to identify a `let` parameter. */
27217
27216
  const FOR_LOOP_LET_PATTERN = /^let\s+([\S\s]*)/;
27217
+ /** Pattern used to validate a JavaScript identifier. */
27218
+ const IDENTIFIER_PATTERN = /^[$A-Z_][0-9A-Z_$]*$/i;
27218
27219
  /**
27219
27220
  * Pattern to group a string into leading whitespace, non whitespace, and trailing whitespace.
27220
27221
  * Useful for getting the variable name span when a span can contain leading and trailing space.
@@ -27562,9 +27563,14 @@ function parseConditionalBlockParameters(block, errors, bindingParser) {
27562
27563
  }
27563
27564
  else {
27564
27565
  const name = aliasMatch[2].trim();
27565
- const variableStart = param.sourceSpan.start.moveBy(aliasMatch[1].length);
27566
- const variableSpan = new ParseSourceSpan(variableStart, variableStart.moveBy(name.length));
27567
- expressionAlias = new Variable(name, name, variableSpan, variableSpan);
27566
+ if (IDENTIFIER_PATTERN.test(name)) {
27567
+ const variableStart = param.sourceSpan.start.moveBy(aliasMatch[1].length);
27568
+ const variableSpan = new ParseSourceSpan(variableStart, variableStart.moveBy(name.length));
27569
+ expressionAlias = new Variable(name, name, variableSpan, variableSpan);
27570
+ }
27571
+ else {
27572
+ errors.push(new ParseError(param.sourceSpan, '"as" expression must be a valid JavaScript identifier'));
27573
+ }
27568
27574
  }
27569
27575
  }
27570
27576
  return { expression, expressionAlias };
@@ -30916,7 +30922,7 @@ function publishFacade(global) {
30916
30922
  * @description
30917
30923
  * Entry point for all public APIs of the compiler package.
30918
30924
  */
30919
- const VERSION = new Version('19.2.4');
30925
+ const VERSION = new Version('19.2.6');
30920
30926
 
30921
30927
  class CompilerConfig {
30922
30928
  defaultEncapsulation;
@@ -32784,7 +32790,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
32784
32790
  function compileDeclareClassMetadata(metadata) {
32785
32791
  const definitionMap = new DefinitionMap();
32786
32792
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
32787
- definitionMap.set('version', literal('19.2.4'));
32793
+ definitionMap.set('version', literal('19.2.6'));
32788
32794
  definitionMap.set('ngImport', importExpr(Identifiers.core));
32789
32795
  definitionMap.set('type', metadata.type);
32790
32796
  definitionMap.set('decorators', metadata.decorators);
@@ -32802,7 +32808,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
32802
32808
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
32803
32809
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
32804
32810
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
32805
- definitionMap.set('version', literal('19.2.4'));
32811
+ definitionMap.set('version', literal('19.2.6'));
32806
32812
  definitionMap.set('ngImport', importExpr(Identifiers.core));
32807
32813
  definitionMap.set('type', metadata.type);
32808
32814
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -32897,7 +32903,7 @@ function createDirectiveDefinitionMap(meta) {
32897
32903
  const definitionMap = new DefinitionMap();
32898
32904
  const minVersion = getMinimumVersionForPartialOutput(meta);
32899
32905
  definitionMap.set('minVersion', literal(minVersion));
32900
- definitionMap.set('version', literal('19.2.4'));
32906
+ definitionMap.set('version', literal('19.2.6'));
32901
32907
  // e.g. `type: MyDirective`
32902
32908
  definitionMap.set('type', meta.type.value);
32903
32909
  if (meta.isStandalone !== undefined) {
@@ -33313,7 +33319,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
33313
33319
  function compileDeclareFactoryFunction(meta) {
33314
33320
  const definitionMap = new DefinitionMap();
33315
33321
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
33316
- definitionMap.set('version', literal('19.2.4'));
33322
+ definitionMap.set('version', literal('19.2.6'));
33317
33323
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33318
33324
  definitionMap.set('type', meta.type.value);
33319
33325
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -33348,7 +33354,7 @@ function compileDeclareInjectableFromMetadata(meta) {
33348
33354
  function createInjectableDefinitionMap(meta) {
33349
33355
  const definitionMap = new DefinitionMap();
33350
33356
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
33351
- definitionMap.set('version', literal('19.2.4'));
33357
+ definitionMap.set('version', literal('19.2.6'));
33352
33358
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33353
33359
  definitionMap.set('type', meta.type.value);
33354
33360
  // Only generate providedIn property if it has a non-null value
@@ -33399,7 +33405,7 @@ function compileDeclareInjectorFromMetadata(meta) {
33399
33405
  function createInjectorDefinitionMap(meta) {
33400
33406
  const definitionMap = new DefinitionMap();
33401
33407
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
33402
- definitionMap.set('version', literal('19.2.4'));
33408
+ definitionMap.set('version', literal('19.2.6'));
33403
33409
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33404
33410
  definitionMap.set('type', meta.type.value);
33405
33411
  definitionMap.set('providers', meta.providers);
@@ -33432,7 +33438,7 @@ function createNgModuleDefinitionMap(meta) {
33432
33438
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
33433
33439
  }
33434
33440
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
33435
- definitionMap.set('version', literal('19.2.4'));
33441
+ definitionMap.set('version', literal('19.2.6'));
33436
33442
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33437
33443
  definitionMap.set('type', meta.type.value);
33438
33444
  // We only generate the keys in the metadata if the arrays contain values.
@@ -33483,7 +33489,7 @@ function compileDeclarePipeFromMetadata(meta) {
33483
33489
  function createPipeDefinitionMap(meta) {
33484
33490
  const definitionMap = new DefinitionMap();
33485
33491
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
33486
- definitionMap.set('version', literal('19.2.4'));
33492
+ definitionMap.set('version', literal('19.2.6'));
33487
33493
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33488
33494
  // e.g. `type: MyPipe`
33489
33495
  definitionMap.set('type', meta.type.value);