Commit graph

3566 commits

Author SHA1 Message Date
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
Joey Perrott
557ac51c32 build: migrate to using new jasmine_test (#62131)
Migrate additional targets to jasmine_test

PR Close #62131
2025-06-19 10:06:27 +02:00
Joey Perrott
908c6c1d30 build: split compiler-cli compliance test into more shards (#62119)
It seems that new jasmine_test runner times out with the larger size shards, by splitting into double the shards the test consistently passes as expected

PR Close #62119
2025-06-18 18:20:22 +02:00
Joey Perrott
3a0cfd544d build: migrate to using new jasmine_test (#62086)
Use the new jasmine_test based on rules_js instead of jasmine_node_test from rules_nodejs

PR Close #62086
2025-06-18 08:27:26 +02:00
aldillek
b7ab5fa256 fix(compiler-cli): add signal checks to handle negated calls (#59970)
By adding these checks, we can find scenarios where a signal was expected to be called but wasn't.

PR Close #59970
2025-06-09 09:01:06 -07:00
Paul Gschwendtner
93c74ef492 build: migrate partial compliance tests to rules_js (#61865)
Migrates the partial compliance tests to `rules_js`. Also as part of
this, we re-enable RBE to see if that fixed the issues, or in case
they are already resolved from the RBE side.

PR Close #61865
2025-06-05 12:04:51 +02:00
Angular Robot
ab5b7df073 build: update all non-major dependencies (#61700)
See associated pull request for more information.

PR Close #61700
2025-06-05 10:14:17 +02:00
ivanwonder
cf55d1bdd4 feat(language-service): Support importing the external module's export about the angular metadata. (#61122)
This works for the code actions and completion. When the ls wants to complete
all importable angular metadata in the template, the ls will invoke the function
`ls.getCompletionsAtPosition` and filter the item about the angular. When the
developer selects an item, the ls will get the module specifier from the code action
return by the `ls.getCompletionEntryDetails`.

PR Close #61122
2025-06-04 14:11:20 -04:00
Paul Gschwendtner
d081ef9b06 build: replace all ng_package with new rule from rules_angular (#61843)
Replaces all `ng_package` rule with the new rule from `rules_angular`.

PR Close #61843
2025-06-04 09:13:41 +00:00
Paul Gschwendtner
579618d6d6 build: remove packages/bazel (#61843)
Removes the `@angular/bazel` package as we no longer need it. Yay!

It's replaced by `rules_angular`.

PR Close #61843
2025-06-04 09:13:41 +00:00
AleksanderBodurri
3a9a70de08 refactor(compiler-cli): implement transform to determine debugName from signal functions (#57348)
Implements a compiler transform that attempts to statically analyze variable names and apply them to usages of signal functions like signal, computed, effect, etc.

PR Close #57348
2025-06-03 20:34:12 -04:00
Kristiyan Kostadinov
b1f3d2eab8 refactor(compiler): replace output AST write nodes (#61682)
Similarly to the previous change to the expression AST, these changes replace the `WriteVarExpr`, `WriteKeyExpr` and `WritePropExpr` from the output AST with a binary expression. This is closer aligned to TypeScript and makes it easier to translate code between the two.

PR Close #61682
2025-06-03 11:08:50 -04:00
Kristiyan Kostadinov
eb43e9242d refactor(compiler): account for new assignment AST (#61682)
Reworks the places that were depending on `PropertyWrite` and `KeyedWrite` to account for the new AST structure.

PR Close #61682
2025-06-03 11:08:50 -04:00
Angular Robot
667a600607 build: update dependency yargs to v18 (#61767)
See associated pull request for more information.

PR Close #61767
2025-06-03 07:34:08 -04:00
Paul Gschwendtner
b7c5645f05 build: migrate packages/compiler-cli to ts_project (#61826)
This commit migrates the remaining pieces of `compiler-cli` to
`ts_project`. This involves a few more things during migration:

- the `ng_module` ngc_wrapped rule broke as part of this change, so we
  switched it to `ts_project` too. This logic is soon gone anyway.

- we needed an extra pnpm "package.json" for the linker babel test. This test is
  loading from the real compiler-cli npm package. Babel needs a real
  node module for this, so this solution seems reasonable. It may be
  worth exploring in the future to move this test into an integration
  test though.

- the older integrationtest in compiler-cli is removed as the coverage
  is much better with the compliance test suite and this test.

PR Close #61826
2025-06-03 11:41:52 +02:00
Kristiyan Kostadinov
a70f03a9b4 fix(compiler): move defer trigger assertions out of parser (#61747)
When defer blocks have a reference-based trigger without a parameter, we infer it from the placeholder block. This requires some validations like ensuring that there's only one element in the placeholder. The validations are currently implemented at the parser level which can affect tools like linters that need to pass `preserveWhitespaces: true` in order to get accurate source mappings.

These changes move the validations into the template type checker so that they still get flagged, but much later in the process. Moving them over involves a bit more work, because the template type checker also sets `preserveWhitespaces: true`.

Fixes #61725.

PR Close #61747
2025-05-30 13:44:58 -04:00
Kristiyan Kostadinov
4ed6d4ac33 refactor(compiler-cli): export type used by migrations (#61697)
Re-exports the `FileSystem` type since it's used by some tsurge migrations and because internally the barrel export from `ngtsc/file_system` is removed.

PR Close #61697
2025-05-30 09:50:58 -04:00
Paul Gschwendtner
87f440bb77 build: ensure compiler is properly picked up as runtime dep of compiler-cli (#61566)
Currently when linking the `@angular/compiler-cli` package, the peer
dependency to `compiler` is not resolved and we are trying to make the
compiler dependency available via `data`. This is unidiomatic and
brittle. This commit fixes this.

PR Close #61566
2025-05-29 14:39:11 -04:00
Paul Gschwendtner
fa123803b4 build: update api-gen to work with compiler as ts_project (#61566)
Compiler now would have `.js` files. Those aren't picked up as ESM,
unless we install the `package.json` with `type: module`. Sounds great
on paper, but doesn't work in reality because the way the compiler
packages are available to `api-gen/` is via the old `rules_nodejs`
linker, so the `packages/package.json` wouldn't work; nor do the
`package.json`s of the e.g. compiler-cli package work- because those
already contain the `exports` of the built npm package.

We fix this in a much more reasonable way, and the whole module
resolution problem by leveraging the pnpm linking here. This works as
expected.

PR Close #61566
2025-05-29 14:39:10 -04:00
Kristiyan Kostadinov
289ae50c56 refactor(core): replace propertyInterpolateX with property (#61639)
Replaces the `propertyInterpolateX` instructions with calls to `property` and the `interpolate` helper. This allows us to drop the dedicated interpolation instructions and simplify the runtime for future work.

PR Close #61639
2025-05-26 09:21:23 +00:00
Kristiyan Kostadinov
e412fda709 refactor(core): replace classMapInterpolateX with classMap (#61639)
Replaces the `classMapInterpolateX` instructions with `classMap` plus a call to `interpolate` in order to simplify the runtime. The only difference between `classMapInterpolateX` and `classMap` was that the former passes `keyValueArraySet` into `checkStylingMap` while the latter passes `classKeyValueArraySet`. This doesn't appear to matter, because the interpolation instructions always have a string value which means that the function is never called.

PR Close #61639
2025-05-26 09:21:23 +00:00
Kristiyan Kostadinov
73c81391d6 refactor(core): replace styleMapInterpolateX with styleMap (#61639)
Replaces the `styleMapInterpolateX` instructions with the existing `styleMap` and a passed-in interpolated value in order to simplify the runtime.

PR Close #61639
2025-05-26 09:21:23 +00:00
Kristiyan Kostadinov
2aaea80bfe refactor(core): replace stylePropInterpolateX with styleProp (#61639)
Replaces all of the `stylePropInterpolateX` instructions with the existing `styleProp` with an interpolated value.

PR Close #61639
2025-05-26 09:21:23 +00:00
Jonathan Meier
f3dfad38b4 refactor(compiler-cli): remove hardcoded config for unused standalone imports rule enablement (#61622)
The hardcoded config was introduced because suppressing the diagnostic
via `extendedDiagnostics` in the TS config was unreliable in google3.
This has since been fixed and the workaround is no longer needed.

PR Close #61622
2025-05-26 09:20:25 +00:00
Alan Agius
67a0576598 build: exclude esbuild metadata files from distributable packages (#61636)
Prevents esbuild generated metadata files from being included in build artifacts. This reduces package size and avoids shipping unnecessary internal build data.

PR Close #61636
2025-05-26 08:57:41 +00:00
Joey Perrott
b478a43804 build: migrate localize package to use rules_js (#61613)
Use ts_project to build localize package

PR Close #61613
2025-05-26 08:53:55 +00:00
Alan Agius
e9fcbb8af1 fix(compiler): remove TypeScript from linker (#61618)
This commit removes the direct dependency on TypeScript within the linker, addressing a performance overhead that was adding between 500ms to 1s to compilation times for applications.

The primary cause of this overhead was the linker's direct reliance on TypeScript's which was caused by importing from barrel files. While convenient, barrel files are detrimental to code splitting and code motion. They force the bundling of all exported modules, even if only a subset is actually used.

By removing the usage of this barrel file and restructuring the imports to be more granular, we can avoid unnecessary TypeScript imports.
 Furthermore, TypeScript has now been changed to an optional peer dependency as using only the linker does not require TypeScript.

PR Close #61618
2025-05-26 08:46:00 +00:00
Jonathan Meier
768e71511e refactor(compiler-cli): remove unused transform methods from DtsTransform (#61610)
All usages of the `DtsTransform` interface leave these two methods
`undefined`, so we can remove them, as well as all code invoking them.

PR Close #61610
2025-05-22 13:25:20 -07:00
Alan Agius
6899b27762 build: update all esbuild target to node20 (#61606)
This is the min supported node.js version

PR Close #61606
2025-05-22 13:02:03 -07:00
Kristiyan Kostadinov
32ae421526 refactor(compiler): replace attribute interpolation instructions (#61557)
Replaces the attribute interpolation instructions with `attribute` plus the new `interpolateX` instruction. This allows to reduce our overall instruction footprint.

PR Close #61557
2025-05-21 15:13:47 +00:00
Jonathan Meier
0cf1001715 feat(compiler-cli): support host directives with direct external references in fast type declaration emission (#61469)
In the initial implementation for experimental fast type declaration
emission introduced in e62fb35, external references in host directives
were not supported at all.

This change adds support for direct external references in host
directives. Any other expressions indirectly using external references
are still not supported.

PR Close #61469
2025-05-21 13:46:43 +00:00
Kristiyan Kostadinov
46af02395f fix(compiler): avoid conflicts between HMR code and local symbols (#61550)
Currently we construct the HMR replacement URL inline by calling into the native `URL` constructor. This can cause conflicts with user code that defines a symbol called `URL`.

These changes resolve the issue by moving the URL construction into a separate function. This has a secondary benefit of making the generated code easier to follow and allowing us to update the URL without changing the compiled code.

Fixes #61517.

PR Close #61550
2025-05-21 12:25:25 +00:00
Joey Perrott
7f6bb91c5d build: update compiler-cli to not be stamped when used for the compiler in ng_project (#61535)
The compiler-cli package needs to be unstamped and will the resulting generated code will be stamped as expected.

PR Close #61535
2025-05-21 09:16:06 +00:00
Andrew Scott
c71adb1ad1 fix(compiler-cli): Always retain prior results for all files (#61487)
This change ensures that prior results for all files are retained even when
a request is made such that we only need a shim for a single file. Prior
to this change, any prior results that were not part of the request were discarded.

PR Close #61487
2025-05-21 08:56:53 +00:00
Alan Agius
8f65223bd8 fix(core): update min Node.js support to 20.19, 22.12, and 24.0 (#61499)
This is to match the versions of the Angular CLI.

See: https://github.com/angular/angular-cli/pull/30349

PR Close #61499
2025-05-20 14:15:13 +00:00
Jonathan Meier
2796f18a3d test: set the noCheck TS compiler option in declaration-only emission compliance tests (#61470)
No type-checking is performed in declaration-only emission mode so we
should explicitly disable it in the compliance tests.

This also aligns the compiler configuration with the setup used in
`packages/compiler-cli/test/ngtsc/declaration_only_emission_spec.ts`:
2b3c89dba2/packages/compiler-cli/test/ngtsc/declaration_only_emission_spec.ts (L31).

PR Close #61470
2025-05-20 12:07:18 +00:00
Joey Perrott
abdfbefe74 build: use an unstamped version of compiler-cli for running the angular compiler in ng_project (#61479)
Use an unstamped version of the compiler when it runs in `ng_project` as it will get stamped appropriately
whenever the generated code gets stamped after its usage."

PR Close #61479
2025-05-20 08:46:34 +00:00
Jonathan Meier
77fa204ad1 fix(compiler-cli): rename flag for enabling fast type declaration emission (#61353)
Rename the flag `_geminiAllowEmitDeclarationOnly` to
`_experimentalAllowEmitDeclarationOnly` as a follow-up on a comment in
PR #61334.

PR Close #61353
2025-05-19 08:27:43 +00:00
Kristiyan Kostadinov
7fa3203ee7 refactor(compiler): account for pipes without names (#61328)
Updates the compiler logic to account for pipe definitions that may not have names.

PR Close #61328
2025-05-19 08:24:06 +00:00