Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Compiler parseTemplate AST potentially unintended change in 19.2.2 #60586

@LeonEck

Description

@LeonEck

Which @angular/* package(s) are the source of the bug?

compiler

Is this a regression?

Yes

Description

Between version 19.2.1 and 19.2.2 the keys of several nodes returned from parseTemplate have changed.

Parsing this template: <div></div> returns:

  • "Element$1" in 19.2.1
  • "Element" in 19.2.2

For a reproduction, I built two stackblitz demos. You can run both with node index.js:

This change led to this PR in angular-eslint: angular-eslint/angular-eslint#2320
@JamesHenry In the description, you mention that this could be a sign that a node is now considered stable. However, I think this was an unintentional change. I can't actually find something like "$1" anywhere in the Angular code.
But I did find that in a case like Element, there are two classes with the same name in the compiler package:

And between 19.2.1 and 19.2.2 the dependency rollup was increased by two major versions (from 2 to 4): 044dac9#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R133

And in rollup I found an issue mentioning that "$1" is added to names: rollup/rollup#4637 which was fixed in 3.2.1.

I think this leads to a change in the bundled compiler code:

So I think this change in key names was accidental due to the update of rollup. I am not sure if the compiler API on that level is part of Semantic versioning?
Triggered by the angular-eslint change, we spent a couple of hours today wondering why the key names in the AST would change during a patch update of the Angular Compiler which would prompt us to adjust some of our custom rules. I hope my theory that rollup could play a role here and was adding the "$1" is correct. In which case I just wanted to make everyone aware of this (maybe unnoticed and unintentional) change.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw


Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 19.2.5
Node: 22.14.0
Package Manager: npm 11.2.0
OS: darwin arm64

Angular: 19.2.4
... common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1902.5
@angular-devkit/core         19.2.5
@angular-devkit/schematics   19.2.5
@angular/build               19.2.5
@angular/cdk                 19.2.7
@angular/cli                 19.2.5
@schematics/angular          19.2.5
rxjs                         7.8.2
typescript                   5.8.2
zone.js                      0.15.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions