Commit graph

3655 commits

Author SHA1 Message Date
SkyZeroZx
3bd91ded43 fix(compiler-cli): resolve import alias in defer blocks (#63966)
Fixes an error where using an alias in a defer block caused the compiler CLI to fail when parsing. The resolution logic in ComponentDecoratorHandler was updated to correctly handle deferred dependencies with aliased imports.

PR Close #63966
2025-09-22 15:52:16 +00:00
Kristiyan Kostadinov
f5b50ec20d refactor: clean up explicit standalone flags from tests (#63963)
Since standalone is the default, we can dropn the `standalone: true` flags from our tests.

PR Close #63963
2025-09-22 14:27:34 +00:00
Jessica Janiuk
2d232b39d4 Revert "refactor(compiler-cli): track member metadata using output AST (#63904)" (#63952)
This reverts commit ffe94b3a89.

PR Close #63952
2025-09-19 18:59:42 +00:00
Jessica Janiuk
9d3cd16f33 Revert "fix(compiler-cli): capture metadata for undecorated fields (#63904)" (#63952)
This reverts commit 4c091abba6.

PR Close #63952
2025-09-19 18:59:41 +00:00
Leon Senft
f008045ded fix(core): do not rename ARIA property bindings to attributes (#63925)
https://github.com/angular/angular/pull/62630 made it so that all ARIA
property bindings would write to their corresponding attribute instead.
The primary motivation for this change was to ensure that ARIA
attributes were always rendered correctly on the server, where the
emulated DOM may not correctly reflect ARIA properties as attributes.
Furthermore, this change added support for binding to ARIA attributes
using the property binding syntax (e.g. `[aria-label]`).

Unfortunately, https://github.com/angular/angular/pull/62630 relied on
the incorrect assumptions that an ARIA property name could be converted
to its attribute name (without hardcoding the conversion), and that the
value of an ARIA property matched its corresponding attribute. For
example, the `ariaLabelledByElements` property's value is an array of
DOM elements, while the corresponding `aria-labelledby` attribute's
value is a string containing the IDs of the DOM elements.

This partially reverts https://github.com/angular/angular/pull/62630 so
that only property bindings with ARIA attribute names (begin with
`aria-`) are converted to attribute bindings.

* `[ariaLabel]` will revert to binding to the `ariaLabel` property.
* `[aria-label]` will continue binding to the `aria-label` attribute.

Note the only difference between `[aria-label]` and `[attr.aria-label]`
is that the former will attempt to bind to inputs of the same name while
the latter will not.

PR Close #63925
2025-09-19 14:50:39 +00:00
Kristiyan Kostadinov
4c091abba6 fix(compiler-cli): capture metadata for undecorated fields (#63904)
Currently if `TestBed.overrideComponent` is used on a class that uses initializer APIs (e.g. `input()`), the initializer metadata will be wiped out, because `overrideComponent` re-compiles the class with the information set by `setClassMetadata`. `setClassMetadata` only captures decorated members at the moment.

These changes introduce some logic to capture the new initializer-based APIs in `setClassMetadata` as well.

Fixes #57944.

PR Close #63904
2025-09-18 21:30:15 +00:00
Kristiyan Kostadinov
ffe94b3a89 refactor(compiler-cli): track member metadata using output AST (#63904)
Reworks the logic that tracks the decorator metadata for members to do so using the output AST, rather than wrapping the TypeScript AST. This makes it easier to programmatically generate new members that weren't part of the TypeScript AST before.

PR Close #63904
2025-09-18 21:30:15 +00:00
Kristiyan Kostadinov
bb381b707e refactor(compiler): integrate regular expression literals into pipeline (#63887)
Adds support for regular expression literals in the template pipeline and adds some logic to optimize non-global ones.

PR Close #63887
2025-09-18 15:08:56 +00:00
Kristiyan Kostadinov
f57b104ccd refactor(compiler-cli): support regular expression literals in AOT compiler (#63887)
Handles regular expression literals across the template type checker and the various translators.

PR Close #63887
2025-09-18 15:08:56 +00:00
Kristiyan Kostadinov
539717f58a feat(core): support regular expressions in templates (#63887)
Updates the template syntax to support inline regular expressions.

PR Close #63887
2025-09-18 15:08:56 +00:00
Andrew Kushnir
ae55578b92 Revert "feat(core): support regular expressions in templates (#63857)" (#63883)
This reverts commit 328a2bf719.

PR Close #63883
2025-09-17 19:36:17 +00:00
Andrew Kushnir
f53c6543db Revert "refactor(compiler-cli): support regular expression literals in AOT compiler (#63857)" (#63883)
This reverts commit f2ef838c06.

PR Close #63883
2025-09-17 19:36:17 +00:00
Andrew Kushnir
0a81784de2 Revert "refactor(compiler): integrate regular expression literals into pipeline (#63857)" (#63883)
This reverts commit dd77233cdf.

PR Close #63883
2025-09-17 19:36:17 +00:00
Kristiyan Kostadinov
dd77233cdf refactor(compiler): integrate regular expression literals into pipeline (#63857)
Adds support for regular expression literals in the template pipeline and adds some logic to optimize non-global ones.

PR Close #63857
2025-09-17 16:06:51 +00:00
Kristiyan Kostadinov
f2ef838c06 refactor(compiler-cli): support regular expression literals in AOT compiler (#63857)
Handles regular expression literals across the template type checker and the various translators.

PR Close #63857
2025-09-17 16:06:51 +00:00
Kristiyan Kostadinov
328a2bf719 feat(core): support regular expressions in templates (#63857)
Updates the template syntax to support inline regular expressions.

PR Close #63857
2025-09-17 16:06:51 +00:00
JoostK
89cf62f907 fix(compiler-cli): only bind inputs that are part of microsyntax to a structural directive (#52453)
Prior to this change the template type-check generator would incorrectly apply inputs
and attributes to a structural directive, where only the bindings as present in microsyntax
are actually bound to the directive. This introduced a problem where usages of template
variables could not be resolved, because the template variables are out-of-scope of the
template element itself.

Closes #49931

PR Close #52453
2025-09-17 16:05:04 +00:00
Kristiyan Kostadinov
7fd3db0423 fix(compiler-cli): remove internal syntax-related flags (#63787)
Removes the `_enableBlockSyntax` and `_enableLetSyntax` flags in favor of detecting them based on the Angular version.

PR Close #63787
2025-09-16 16:51:17 +00:00
Matthieu Riegler
9a16718b13 refactor(core): remove deprecated interpolation option on Components. (#63474)
This option was deprecated by #55778.

BREAKING CHANGE: The `interpolation` option on Components has been removed. Only the default `{{ ... }}` is now supported.

PR Close #63474
2025-09-15 19:35:03 +00:00
Matthieu Riegler
6dff287bb8 refactor(compiler-cli): Add a diagnostic to detect forbiden invocations of required initializers (#63614)
The diagnostic will raise an error when required initializers (input, model, queries) are invoked the context of property initializers and contructors.

Docs will be provided in a follow-up

fixes #63602

PR Close #63614
2025-09-15 19:34:32 +00:00
Kristiyan Kostadinov
0a60e355e1 fix(compiler-cli): signal not invoked diagnostic not raised when input has same name in template (#63754)
The diagnostic that flags signals which haven't been invoked has some logic to skip over inputs, however it was looking at the used directives across the entire template, not the ones on the specific node.

Fixes #63739.

PR Close #63754
2025-09-15 15:50:45 +00:00
Jessica Janiuk
4924108630 refactor(core): dispatch enter and leave animations at the right times (#63450)
This updates the enter and leave logic to use the stored LView data to dispatch the enter and leave animations at the right points in the lifecycle. This should fix issues with signals not being available yet, parallel animations, and also eliminate the need for the element registry.

fixes: #63391
fixes: #63388
fixes: #63369

PR Close #63450
2025-09-10 22:24:00 +00:00
Matthieu Riegler
4d535cfaa4 refactor(core): Error logs links point to the archived version of the docs (#63512)
In order to point the right context, links in error messages will target the archived version of the online doc site (v*.angular.io).

See #44650

PR Close #63512
2025-09-10 22:21:10 +00:00
Angular Robot
7569da13b7 build: update all non-major dependencies (#63661)
See associated pull request for more information.

Closes #63504 as a pr takeover

PR Close #63661
2025-09-10 07:11:54 -07:00
Kristiyan Kostadinov
0571b335b9 feat(compiler-cli): enable type checking of host bindings by default (#63654)
Type checking of host bindings was added in v20. We're now confident enough in it to enable it by default.

BREAKING CHANGE:
* Previously hidden type issues in host bindings may show up in your builds. Either resolve the type issues or set `"typeCheckHostBindings": false` in the `angularCompilerOptions` section of your tsconfig.

PR Close #63654
2025-09-09 14:34:29 -07:00
Matthieu Riegler
8e8a3fe8cf refactor(compiler-cli): add support for if/switch to the non-invoked signal diagnostic (#63502)
This commit adds the support to the existing "interpolated_signal_not_invoked" diagnostic (even though it's not really a interpolation)

PR Close #63502
2025-09-08 13:17:04 -07:00
Kristiyan Kostadinov
c0791e1887 fix(core): drop support for TypeScript 5.8 (#63589)
Updates the version range to drop support for TypeScript 5.8.

BREAKING CHANGE:
* TypeScript versions less than 5.9 are no longer supported.

PR Close #63589
2025-09-05 13:54:40 -07:00
Jessica Janiuk
0a82138d4b fix(compiler): fixes regression with event parsing and animate prefix (#63470)
The new animations was not correctly looking for the `.` when parsing bindings. This resulted in arbitrary event bindings creating animate.leave instruction calls.

fixes: #63466

PR Close #63470
2025-08-29 11:53:30 +00:00
Hongxu Xu
1f4c5f72aa refactor(bazel): reduce build deps (#63348)
clean up deps in bazel build scripts

PR Close #63348
2025-08-28 09:16:10 -07:00
Jessica Janiuk
a0388409e3 fix(compiler): fixes animations on elements with structural directives (#63390)
The animate instructions were getting applied to the container comment nodes as well as the element nodes. This prevents that on the compiler level.

fixes: #63371

PR Close #63390
2025-08-26 09:47:07 -07:00
Joey Perrott
2fcafb65c5 build: rename defaults2.bzl to defaults.bzl (#63383)
Use defaults.bzl for the common macros

PR Close #63383
2025-08-25 15:45:01 -07:00
Joey Perrott
3df1dccebe refactor: various build and import specificer fixes for strict deps (#63323)
Change direct deps in bazel targets and import specifiers within files to maintain strict deps requirements ahead of enabling strict deps tests in the repo

PR Close #63323
2025-08-22 14:45:00 -07:00
Matthieu Riegler
827c3c15f4 fix(compiler): Keep paraenthesis in Nullish + Boolean expression. (#63292)
Ts 5.9 introduced a regression coming from 5.8 when parenthesis aren't generated for expressions like (`(a ?? b) && c`).
This fix works around this explicitly specifying that we want to keep those parenthesis that we're aware of in this specific case;

This change can be reverted if the root issue (https://github.com/microsoft/TypeScript/issues/61369) is fixed. (but let's keep the tests in any case for the coverage)

fixes #63287

PR Close #63292
2025-08-21 12:15:52 +02:00
Kristiyan Kostadinov
7bf4906f27 fix(compiler-cli): account for expression with type arguments during HMR extraction (#63261)
Fixes that the HMR extraction logic didn't accoubnt for expressions with type arguments (e.g. `viewChild('foo', {read: TemplateRef<unknown>})`).

Fixes #63240.

PR Close #63261
2025-08-20 11:31:43 +00:00
ivanwonder
eeeaadc7e9 fix(language-service): Support to resolve the re-export component. (#62585)
In the context of TypeScript (TS), a re-exported symbol is considered a distinct symbol.
This means that a developer can choose to import either the re-exported symbol or
the original symbol. However, in the context of Angular, the re-exported symbol
is treated as the same component because it uses the same selector.

This pull request will utilize the most recent re-export component file to
resolve the module specifier.

PR Close #62585
2025-08-20 09:39:56 +00:00
Jessica Janiuk
cab3adfdd1 fix(compiler): fixes animation event host bindings not firing (#63217)
Host bindings for `(animate.enter)` and `(animate.leave)` were not firing properly. This fixes the compiler ingest to make sure they do fire.

fixes: #63199

PR Close #63217
2025-08-18 15:56:49 +00:00
Joey Perrott
1aa0a8800c build: update the failure message with the correct command (#63219)
Update the failure message for compliance tests to use the correct command for updating the goldens

PR Close #63219
2025-08-18 15:08:56 +00:00
Kristiyan Kostadinov
5b3933f1ae fix(compiler): error when ng-content fallback has translated children (#63156)
Fixes that the pipeline wasn't processing the fallback content of `ng-content` for i18n which resulted in a compiler error further down the line.

Fixes #63065.

PR Close #63156
2025-08-15 09:47:17 +02:00
Angular Robot
d733c69ce9 build: update all non-major dependencies (#62935)
See associated pull request for more information.

PR Close #62935
2025-08-14 22:09:29 +02:00
Jonathan Meier
be7110342b fix(compiler-cli): disallow compiling with the emitDeclarationOnly TS compiler option enabled (#61609)
Running the Angular compiler with declaration-only emission is dangerous
because Angular does not yet support this mode as it relies on the Ivy
compilation which does not run in this mode

In the best case, everything works fine as incidentally there's no
difference in the emitted type declarations (e.g. this is the case for
TS files containing no Angular annotations or only `@Injectable`
annotations).

In the worst case, compilation silently fails in that the compilation
succeeds but the resulting type declarations are missing the Angular
type information and are therefore incomplete. This happens for all
components, directives and modules.

BREAKING CHANGE: The Angular compiler now produces an error when the
the `emitDeclarationOnly` TS compiler option is enabled as this mode is
not supported.

PR Close #61609
2025-08-14 13:03:54 +02:00
Matthieu Riegler
93c735cae7 docs: fix edit links for block/element api entries (#62766)
PR Close #62766
2025-08-14 13:03:00 +02:00
Joey Perrott
c35c0c7f2f build: update to bazel 7.6.0 (#63096)
Update to later version of bazel

PR Close #63096
2025-08-14 13:01:30 +02:00
Paul Gschwendtner
ea78278635 refactor(compiler-cli): ensure JIT transforms with queries work with closure property renaming (#63123)
This map for the JIT transforms accidentally is property-renamed,
breaking the lookups below. This commit fixes this.

PR Close #63123
2025-08-12 13:24:09 -07:00
Joey Perrott
c4dcfdf644 build: update to the latest version of devinfra and rename npm2 workspace (#63093)
Rename the npm2 workspace to npm and use the latest version of devinfra which drops rules_nodejs

PR Close #63093
2025-08-11 10:35:32 -07:00
Kristiyan Kostadinov
a409534d6c feat(core): support as aliases on else if blocks (#63047)
Expands support for the `as` keyword to `@else if` blocks. Previously it was only allowed on `@if`.

PR Close #63047
2025-08-08 08:43:00 -07:00
Kristiyan Kostadinov
c77e51930d fix(compiler-cli): error when type checking host bindings of generic directive (#63061)
Fixes that the compiler was throwing an error if type checking of host bindings is enabled for a generic directive. The problem was that we were always using the `TcbNonGenericDirectiveTypeOp`.

Fixes #63052.

PR Close #63061
2025-08-08 08:42:23 -07:00
Andrew Scott
812463c563 fix(compiler-cli): Ignore diagnostics on ngTemplateContextGuard lines in TCB (#63054)
Deprecated diagnostics can appear on the context guard becaues the
directive itself may be deprecated.

For example, context guards look like `if (i1.NgForOf.ngTemplateContextGuard(_t8, _t9) /*331,378*/) {...}`
and typescript will report the deprecation on the whole element, from
start to end tag, because the span for that node includes it.

fixes https://github.com/angular/vscode-ng-language-service/issues/2203

PR Close #63054
2025-08-07 15:38:38 -07:00
Andrew Scott
45b030b5ce fix(compiler-cli): prevent dom event assertion in TCB generation on older angular versions (#63053)
This fixes an issue caused by
https://github.com/angular/angular/pull/62648 for older versions of
Angular when the newest version of the language service is used. This
prevents the TCB from attempting to use the assertType when it does not
exist.

fixes #63046

PR Close #63053
2025-08-07 15:37:54 -07:00
Ryan Bendel
d24d5742db feat(platform-browser): Add IsolatedShadowDom encapsulation method (#62723)
IsolatedShadowDom encapsulation fixes style leakage in Shadowdom encapsulation by removing sharedstyleshost from dom-renderer IsolatedShadowdom class. Updates docs.

PR Close #62723
2025-08-06 16:48:37 +02:00
ivanwonder
b78de31c94 refactor(language-service): handle the undefined value of a symbol for a type (#63002)
using the `getSymbol` instead of the `type.symbol`, for the primitive type,
the `type.symbol` returns the `undefined` value. The return type of `getSymbol`
includes `undefined`, while `type.symbol` does not.

For example:

```ts
class BarComponent {
   /**
   * @deprecated
   */
  name = ""
}
```

The type of `name` is `string`, the `type.symbol` for the `string`
returns `undefined` here.

e3ef7ff50d/src/services/types.ts (L111)
e3ef7ff50d/src/compiler/types.ts (L6445)

PR Close #63002
2025-08-06 16:46:40 +02:00