Commit graph

3604 commits

Author SHA1 Message Date
Kristiyan Kostadinov
fb1fc823c4 fix(compiler-cli): correctly type check host listeners to own outputs (#62965)
Currently the code that type checks host bindings assumes that all listeners are bound to the DOM, however that's not the case since host bindings can also bind to own outputs.

These changes update the TCB to generate the proper code for type checking such outputs.

Fixes #62783.

PR Close #62965
2025-08-05 10:04:25 +02:00
Joey Perrott
82cc576e6f build: use pnpm as the package manager instead of yarn (#62924)
Use pnpm instead of yarn as the package manager and interaction tool for the repo

PR Close #62924
2025-07-31 22:06:27 +00:00
Joey Perrott
cbc258eec8 build: remove ts_project_interop infrastructure (#62908)
Remove the interop macros and final usages

PR Close #62908
2025-07-31 09:12:58 +00:00
Joey Perrott
008ed216d3 build: remove usages of runtime_rnjs_interop (#62908)
Remove all usages of the runtime_rnjs_interop feature

PR Close #62908
2025-07-31 09:12:58 +00:00
Joey Perrott
49b7729e88 build: remove usages of rules_nodejs (#62885)
Remove rules_nodejs usages with direct migrations to rule_js alternatives

PR Close #62885
2025-07-30 08:51:27 +00:00
cexbrayat
c4917074f1 fix(compiler-cli): display proper function in NG8117 message (#62842)
The diagnostic was displaying `'Function in text interpolation should be invoked: ect Object]()` instead of `'Function in text interpolation should be invoked: firstName()'.

PR Close #62842
2025-07-29 17:22:28 +00:00
Joey Perrott
29195f1710 build: use ts_project based extract_types (#62875)
Use the extract_types that pulls from ts_project deps

PR Close #62875
2025-07-29 17:14:26 +00:00
Joey Perrott
32c00ab416 build: standardize usage of js_binary (#62860)
Remove usages of nodejs_binary and use a commonly defined js_binary macro

PR Close #62860
2025-07-29 06:43:44 +02:00
Kristiyan Kostadinov
632eba519c build: update to the TypeScript 5.9 RC (#62815)
Updates the repo the release candidate of TypeScript 5.9.

PR Close #62815
2025-07-25 13:39:12 +02:00
Joey Perrott
caee6ff8e7 build: remove all usages of @bazel/runfiles (#62804)
Remove usages of @bazel/runfiles throughout the repository

PR Close #62804
2025-07-25 10:04:55 +02:00
Kristiyan Kostadinov
7767aa640c fix(compiler): allow more characters in square-bracketed attribute names (#62742)
Currently the HTML parser will stop parsing as soon as it hits an end character in the name of an attribute (e.g. `/` or `>`). This ends up being problematic with some third-party packages like Tailwind which uses a wider range of characters for its class names. While the characters are fine when inside the `class` attribute, our current parser behavior prevents users from setting those classes conditionally through `[class.]` bindings.

These changes adjust the parser to handle such cases.

Fixes #61671.

PR Close #62742
2025-07-23 11:06:47 -04:00
Jessica Janiuk
882522c1ad refactor(compiler): Tree shake Element Registry (#62682)
This creates a feature to detect usages of animate.leave and only enables the element removal registry when necessary

PR Close #62682
2025-07-23 09:37:16 -04:00
Jessica Janiuk
6b1f4b9e8b feat(core): add enter and leave animation instructions (#62682)
This adds the instructions to support enter and leave animations on nodes.

PR Close #62682
2025-07-23 09:37:16 -04:00
Joey Perrott
f5d9d084b6 build: move nodejs_test to js_test (#62709)
Move nodejs_test to js_test and remove unnecessary files after move

PR Close #62709
2025-07-22 10:07:13 -04:00
Leon Senft
4138aca91f feat(core): render ARIA property bindings as attributes (#62630)
Allow binding to ARIA attributes using property binding syntax _without_
the `attr.` prefix. For example, `[aria-label]="expr"` is now valid, and
equivalent to `[ariaLabel]="expr"`. Both examples bind to either a
matching input or the `aria-label` HTML attribute, rather than the
`ariaLabel` DOM property.

Binding ARIA properties as attributes will ensure they are rendered
correctly on the server, where the emulated DOM may not correctly
reflect ARIA properties as attributes.

Reuse the DOM schema registry from the compiler to map property names in
type check blocks.

PR Close #62630
2025-07-22 06:59:00 -04:00
Joey Perrott
8bf97d1370 build: remove all usages of the interop_deps attr for ts_project and ng_project (#62732)
Remove all of the usages of interop_deps as attributes in the repo

PR Close #62732
2025-07-21 13:03:09 -04:00
Joey Perrott
23d58777b4 build: migrate to new toolchain usage for api goldens (#62688)
Migrate api golden usage to be based on rules_js toolchain implementation

PR Close #62688
2025-07-17 18:13:42 -04:00
Joey Perrott
0f4bf56266 build: migrate ts_library usages to ts_project (#62673)
Migrate new ts_library usages to ts_project

PR Close #62673
2025-07-17 13:59:37 -04:00
Jessica Janiuk
fc8247de95 refactor(core): add compiler support for animation instructions (#62528)
this adds the compiler code to support the animate instructions.

PR Close #62528
2025-07-16 16:44:16 -04:00
Rafael Camara
5abfe4a899 feat(compiler-cli): add diagnostic for uninvoked functions in text interpolation (#59191)
This commit adds a new extended diagnostic to detect uninvoked functions in text interpolation.

PR Close #59191
2025-07-16 16:30:37 -04:00
Kristiyan Kostadinov
527bd778a7 fix(compiler-cli): infer type of event target for void elements (#62648)
Currently we infer the target of DOM events to be `EventTarget | null` which is consistent with the built-in types for `addEventListener`. This is due to the fact that users can dispatch custom events, or the event might've bubbled. However, this typing is also inconvenient for some other common use cases like `<input (input)="query($event.target.value)">`, because we don't have the ability to type cast in a template.

These changes aim to make some of the cases simpler by inferring the type of `$event.target` if the event is bound on a void element which guarantees that it couldn't have bubbled.

PR Close #62648
2025-07-16 12:40:25 +02:00
Kristiyan Kostadinov
a1e3f2bcd1 fix(compiler): incorrect spans for left side of binary operation (#62641)
Fixes that the span for the `left` side of a `Binary` AST included the range up to and including the operator.

Fixes #62617.

PR Close #62641
2025-07-15 07:57:32 -07:00
ivanwonder
d64dd27a02 feat(language-service): support to report the deprecated API in the template (#62054)
In the Typescript Language Service, these diagnostics are reported as suggestion diagnostics.
This will report the deprecated `Component`, `Directive`, etc.

Fixes https://github.com/angular/angular/issues/59343

PR Close #62054
2025-07-14 15:44:24 -07:00
Kristiyan Kostadinov
745ea44394 feat(core): support TypeScript 5.9 (#62541)
Updates the repo to support TypeScript 5.9 and expands the allowed version range.

PR Close #62541
2025-07-14 14:04:58 -07:00
Joey Perrott
15bb25805f build: use esbuild from aspect rules (#62568)
Use the esbuild ruleset from aspect rules instead of via @bazel/esbuild

PR Close #62568
2025-07-10 13:45:15 -07:00
Joey Perrott
49813c5d85 build: migrate esbuild usages to aspect_rules_esbuild esbuild rule (#62529)
Migrate more usages of esbuild to new toolchain

PR Close #62529
2025-07-09 12:41:27 -07:00
Paul Gschwendtner
acdd5d998a refactor(compiler): fix import manager to be closure property renaming-compatible (#62517)
The `generateUniqueIdentifier` helper relies on the internal `identifiers` property of a `ts.SourceFile`.
As this is not a public-facing API, it is not included in the externs provided to Closure Compiler.
Consequently, it is susceptible to being renamed during advanced optimizations, which would lead to runtime failures.

To prevent this, the property is now accessed via a string literal (`sf['identifiers']`). This change ensures that
the property name is preserved through the compilation process. An explanatory comment has been added to clarify the
necessity of this approach for future reference.

PR Close #62517
2025-07-08 11:31:07 +00:00
Kristiyan Kostadinov
238e2ad4f5 fix(compiler-cli): use proper name for diagnostic type (#62479)
Currently when a diagnostic happens in a template, we always say "Error occurs in ...", however we have other types of diagnostics as well.

PR Close #62479
2025-07-07 15:29:38 +00:00
Paul Gschwendtner
bd6d043767 refactor(compiler-cli): ensure mock file system can be loaded in the browser (#62493)
The mock file system currently relies on some NodeJS logic. This blocks
the convenient use of the mock file system in the browser. The file
system is useful for creating tests to verify e.g. that our transforms
can work in the browser.

PR Close #62493
2025-07-07 12:59:25 +02:00
Paul Gschwendtner
c575286812 refactor: fix closure compatibility errors in compiler (#62493)
The static fields may be part of advanced compilations where the
receiver would change as part of the static field collapsing
optimization.

The optimization requires us to use the explicit class name, over
`this` that would change to e.g. `globalThis`.

PR Close #62493
2025-07-07 12:59:25 +02:00
Matthieu Riegler
5c54cb87a5 docs: improve support for decorator APIs (#60411)
The commit introduce the distinction between

- class like decorators (like Component, Interface, NgModule. They are formatted like classes/interfaces, with each attribute being documents.
- function like decorators (Attribute, Host, Optional...)

PR Close #60411
2025-07-03 11:51:34 +00:00
Paul Gschwendtner
b49f2db814 refactor(compiler-cli): do not rely on url when loading file system logic (#62431)
When executing the compiler-cli in the browser, or some parts of it—
modules like `url` are stubbed out with `{}`. This commit accounts for
this.

PR Close #62431
2025-07-02 17:05:28 +00:00
Paul Gschwendtner
0eff1f0353 refactor(compiler-cli): avoid eager typescript top-level usages (#62431)
For some internal refactorings, we want to avoid any direct top-level
`typescript` runtime usages. Usages that interact with `ts` after
synchronous module loading are fine.

More context in:
https://docs.google.com/document/d/1_h8AQRbM3LJrwIlUfGzGzxuwqFu0QI2-5eUTFI6gWws/edit?tab=t.0#heading=h.nunsebe2s3h0.

PR Close #62431
2025-07-02 17:05:28 +00:00
Kristiyan Kostadinov
8fbe558cbc perf(core): move property remapping for dom properties to compiler (#62421)
Since we know that DOM properties won't go to an inputs, we can move the remapping logic to the compiler, saving us some processing on the client.

PR Close #62421
2025-07-02 14:28:12 +00:00
Angular Robot
d0b7439313 build: update all non-major dependencies (#62419)
See associated pull request for more information.

PR Close #62419
2025-07-02 14:20:48 +00:00
Jessica Janiuk
d7b94e0072 refactor(core): rename all animations package symbols (#62399)
Renames all animations package references with a "legacy" prefix for later easy cleanup.

PR Close #62399
2025-07-01 13:45:45 +00:00
Angular Robot
df1a61fea2 build: update all non-major dependencies (#62323)
See associated pull request for more information.

Closes #62317 as a pr takeover

PR Close #62323
2025-06-27 08:35:22 +00:00
Kristiyan Kostadinov
089ad0ee15 fix(compiler): produce more accurate errors for interpolations (#62258)
Currently when there's a parser error in interpolated text, the compiler reports an error on the entire text node. This can be really noisy in long strings.

These changes switch to reporting the errors on the specific expressions that caused them.

PR Close #62258
2025-06-25 16:58:56 +00:00
Jannik Lassahn
20c1f991e6 feat(language-service): add semantic tokens for templates (#60260)
Adds support for `getEncodedSemanticClassifications` to the language service.
The service now classifies components in a template as the `class` type.

PR Close #60260
2025-06-24 16:27:46 +00:00
Joey Perrott
36d5048429 build: migrate final non-zone.js jasmine tests (#62169)
Migrate the final remaining non-zone.js package jasmine tests to the new toolchain

PR Close #62169
2025-06-24 08:46:39 +00:00
Kristiyan Kostadinov
a40abf09f1 build: fix failing test (#62214)
Fixes a test that's failing, because a few PRs landed at the same time.

PR Close #62214
2025-06-23 15:38:18 +02:00
Kristiyan Kostadinov
d25a6a0120 fix(compiler-cli): handle initializer APIs wrapped in type casts (#62203)
Fixes that the logic recognizing initializer APIs didn't account for the expression being wrapped in an `as` expresion or in a parenthesized expression. This was already accounted for in the diagnostic so these changes align the behavior between them.

Fixes #62197.

PR Close #62203
2025-06-23 14:26:05 +02:00
Kristiyan Kostadinov
5e9707dc84 refactor(compiler): consolidate error classes (#62160)
Currently we have a `ParserError` that is used for the expression parser and a `ParseError` that is used everywhere else. These changes consolidate them into the `ParseError` to avoid confusion and make it easier to add more context in the future.

PR Close #62160
2025-06-23 14:25:28 +02:00
Kristiyan Kostadinov
6b5e6b7ff7 refactor(compiler): always generate DOM-only templates for blocks (#62096)
Block templates can't have directives so we can always generate them as DOM-only.

PR Close #62096
2025-06-23 14:24:09 +02:00
Kristiyan Kostadinov
2b4b98ded6 refactor(compiler): produce DOM-only instructions (#62096)
Reworks the compiler so that it produces DOM-only instructions and updates the relevant tests.

PR Close #62096
2025-06-23 14:24:09 +02:00
Kristiyan Kostadinov
3afd3046d7 refactor(compiler): track whether component has directive dependencies (#62096)
Adds a field to the directive's metadata tracking whether it has directive dependencies. Knowing this will allow the pipeline to decide whether to produce DOM-only or full instructions.

PR Close #62096
2025-06-23 14:24:09 +02:00
Kristiyan Kostadinov
0dcf230d52 feat(compiler): add support for new binary assignment operators (#62064)
Updates the remainder of the compiler to handle the new assignment operators and sets up more tests, including for the runtime.

PR Close #62064
2025-06-23 14:23:29 +02:00
ivanwonder
ac1d400306 refactor(language-service): resolve module specifier for a directive exported by multiple different files (#62100)
When providing the code action for the directive that is exported by multiple modules
in different files, the directive must save all the TS completion entry data
for every module to compute the module specifier.

When providing a completion item, because the LS only supports displaying one directive
at a time, the first one will be picked.

PR Close #62100
2025-06-23 14:16:30 +02:00
Kristiyan Kostadinov
ed5062a91c fix(compiler-cli): add suggestion when pipe is missing (#62146)
Adds some suggestions for potential pipes to be imported when raising the missing pipe diagnostic.

Fixes #62136.

PR Close #62146
2025-06-20 10:30:04 +02:00
ivanwonder
5d2e85920e feat(language-service): support to fix missing required inputs diagnostic (#50911)
Support to add the missing required inputs into the element and append
after the last attribute of the element.

But it skips the structural directive shorthand attribute. For example,
`<a *ngFor=""></a>`, its shorthand is `<ng-template ngFor>`, the `valueSpan`
of the `ngFor` is empty, and the info is lost, so it can't use to insert
the missing attribute after it.

PR Close #50911
2025-06-19 10:13:26 +02:00