Commit graph

36863 commits

Author SHA1 Message Date
Paul Gschwendtner
88f2fe4387 test(migrations): fix batch test for signal input migration (#57883)
The batch test (not running on CI due to memory/resource constraints) currently fails
after refactorings we did recently. This commit fixes that there were
two different instances of `sourceFiles string[]`.

PR Close #57883
2024-09-20 12:19:11 +02:00
Paul Gschwendtner
8b632dbdb6 refactor(migrations): simplify and improve inheritance checking in input migration (#57883)
Instead of running inheritance checking for analyze and migration phases
(in batch mode), we can run once and create a mini-graph in the
compilation unit data. This can then improve lookups and propagation of
incompatibilities.

This commit fixes an issue where a class is chained between three
isolated units and members are overriden. Currently this pattern would
not be checked properly and e.g. an incompatibility of the superclass
would not propagate to derived class, or deeper.

PR Close #57883
2024-09-20 12:19:11 +02:00
Paul Gschwendtner
4ea8ad6f55 refactor(migrations): reduce bytes of merged compilation unit in input migration (#57883)
This reduces the bytes of the merged compilation unit data, so that we
don't have to transer gigabytes of data to every batch worker. This
reduces quota and helps with reliablity of the migration in 1P.

The references metadata was never needed across units, but an initial
idea to e.g. allow for issuing of CLs based on a graph that we build
after changes computation

PR Close #57883
2024-09-20 12:19:11 +02:00
Paul Gschwendtner
4993dd51e6 refactor(migrations): improve ergonomics of performance improvement for reference lookup (#57883)
This would allow us to have better control over reference lookups
without needing a whole new set of `KnownFields` or `KnownInputs`.

PR Close #57883
2024-09-20 12:19:11 +02:00
Paul Gschwendtner
d8aba1d901 refactor(migrations): automatically skip inputs outside of project (#57883)
Currently we support filtering files outside of the project, or source
files via `shouldMigrateInput` option. This works well, but we can
smartly skip inputs in batch migrations if we never saw a source
declaration.

This is an improvement in G3 where we cannot simply limit the migration
to a given directory, because we may include build targets from various
places. E.g. via reverse dependency tracking— so this fixes the issue
naturally.

Notably, an explicit filter would improve reference lookups because we
wouldn't consider the input when determining potential references. That
is because we would know beforehand that those inputs in the `.d.ts`
cannot be migrated inputs— and therefore references with names of the
input would never be verified via expensive type checking.

This is fine for G3 though, and there is no way around this. This is a
slow performance overhead; mostly releveant for VSCode integration.

PR Close #57883
2024-09-20 12:19:11 +02:00
Angular Robot
4112e6fa31 build: update io_bazel_rules_sass digest to 8dac332 (#57892)
See associated pull request for more information.

PR Close #57892
2024-09-20 11:13:48 +02:00
Ulises
b5efabed53 docs: update installation guide (#57701)
PR Close #57701
2024-09-20 11:09:02 +02:00
Angular Robot
bb3b4c6fa0 docs: update Angular CLI help [main] (#57890)
Updated Angular CLI help contents.

PR Close #57890
2024-09-20 11:07:45 +02:00
Alex Rickabaugh
fc59e2a7b7 feat(core): change effect() execution timing & no-op allowSignalWrites (#57874)
This commit flips the flag that was added in 4e890cc, putting the new effect
timing into... effect :)

BREAKING CHANGE:

Generally this PR has two implications:

* effects which are triggered outside of change detection run as part of
  the change detection process instead of as a microtask. Depending on the
  specifics of application/test setup, this can result in them executing
  earlier or later (or requiring additional test steps to trigger; see below
  examples).

* effects which are triggered during change detection (e.g. by input
  signals) run _earlier_, before the component's template.

We've seen a few common failure cases:

* Tests which used to rely on the `Promise` timing of effects now need to
  `await whenStable()` or call `.detectChanges()` in order for effects to
  run.

* Tests which use faked clocks may need to fast-forward/flush the clock to
  cause effects to run.

* `effect()`s triggered during CD could rely on the application being fully
  rendered (for example, they could easily read computed styles, etc). With
  the change, they run before the component's updates and can get incorrect
  answers. The recent `afterRenderEffect()` API is a natural replacement for
  this style of effect.

* `effect()`s which synchronize with the forms system are particularly
  timing-sensitive and might need to adjust their initialization timing.

Fixes #55311
Fixes #55808
Fixes #55644
Fixes #56863

PR Close #57874
2024-09-19 14:17:56 -07:00
Matthieu Riegler
49f7179ded docs(docs-infra): Add dedicated support for decorators. (#57595)
PR Close #57595
2024-09-19 14:16:31 -07:00
Angular Robot
cd24eaf93e build: update cross-repo angular dependencies (#57851)
See associated pull request for more information.

Closes #57833 as a pr takeover

PR Close #57851
2024-09-19 16:29:25 +02:00
Ankur Mishra
9020a50e6d docs: Update Making HTTP requests best practices example (#57876)
PR Close #57876
2024-09-19 14:18:28 +02:00
Luke Schlangen
e598b08af5 docs: fix closing tag slash location (#57405)
PR Close #57405
2024-09-19 12:50:27 +02:00
Harieswaran D
87a724ec1d docs: suggesting a typo error in the document (#57627)
PR Close #57627
2024-09-19 12:49:51 +02:00
Charles Lyding
163f4d0dd5 build(docs-infra): use chunk optimizer for adev builds (#56830)
The Angular build system recently introduced an opt-in chunk optimizer
for application builds. This is now enabled for adev production builds.
It reduces the initial chunk count from 14 to 1 JavaScript file. While
the raw initial total file size does increase by 0.75% (7.3kB), the total
estimated transfer size decreases by 8% (17.8kB). Not only does this
reduce the amount of data that must be sent over the network but it also
reduces the amount of HTTP requests that must be made by the browser.
While the injected HTML module preloads mitigate request cascades, not
needing to make the requests is even better.

PR Close #56830
2024-09-19 12:44:51 +02:00
Joey Perrott
ddbdf224a5 ci: update pullapprove config to enact changes for renovate (#57853)
Enact the pullapprove config for changes to renovate reviews

PR Close #57853
2024-09-19 11:18:35 +02:00
Alan Agius
38de06b2d1 test: disable cache and analytics (#57863)
In Bazel, the `CI` environment variable is not set due to its hermetic nature. As a result, caching is enabled by default, which includes Vite pre-bundling. This is unnecessary in CI environments.

In some cases, this leads to errors during CI runs when the Vite build is closed or canceled prematurely, resulting in the following errors:

```
Error: R] The build was canceled
Error: R] Terminating worker thread [plugin angular-vite-optimize-deps]
```

PR Close #57863
2024-09-19 11:14:23 +02:00
Alex Rickabaugh
4e890cc5ac refactor(core): add support for new effect scheduling. (#56501)
The original effect design for Angular had one "bucket" of effects, which
are scheduled on the microtask queue. This approach got us pretty far, but
as developers have built more complex reactive systems, we've hit the
limitations of this design.

This commit changes the nature of effects significantly. In particular,
effects created in components have a completely new scheduling system, which
executes them as a part of the change detection cycle. This results in
behavior similar to that of nested effects in other reactive frameworks. The
scheduling behavior here uses the "mark for traversal" flag
(`HasChildViewsToRefresh`). This has really nice behavior:

 * if the component is dirty already, effects run following preorder hooks
   (ngOnInit, etc).
 * if the component isn't dirty, it doesn't get change detected only because
   of the dirty effect.

This is not a breaking change, since `effect()` is in developer preview (and
it remains so).

As a part of this redesigned `effect()` behavior, the `allowSignalWrites`
flag was removed. Effects no longer prohibit writing to signals at all. This
decision was taken in response to feedback / observations of usage patterns,
which showed the benefit of the restriction did not justify the DX cost.

The new effect timing is not yet enabled - a future PR will flip the flag.

PR Close #56501
2024-09-18 14:52:25 -07:00
Angular Robot
c6039b5f89 build: update io_bazel_rules_sass digest to 1f2bb53 (#57860)
See associated pull request for more information.

PR Close #57860
2024-09-18 17:48:06 +02:00
Pawel Kozlowski
538dd29755 release: cut the v19.0.0-next.6 release 2024-09-18 17:38:15 +02:00
Pawel Kozlowski
f8666a9bd6 docs: release notes for the v18.2.5 release 2024-09-18 17:33:00 +02:00
Matthieu Riegler
029163c494 docs: adapt the NgModule to the new default : standalone (#57532)
PR Close #57532
2024-09-18 16:53:26 +02:00
Matthieu Riegler
8e8cd86383 docs: add redirect for pipes guide (#57706)
cherry-pick of #57681 that should have targeted `main`. This commit also fixes the wild card redirection

PR Close #57706
2024-09-18 16:51:44 +02:00
zdwg42
66972c6472 docs(forms): fix template-driven docs link (#57867)
PR Close #57867
2024-09-18 16:50:17 +02:00
Kristiyan Kostadinov
f611faadfe fix(compiler-cli): extended diagnostics not validating ICUs (#57845)
The visitor that all extended diagnostics are based on hadn't implemented the `visitIcu` method which meant that it wasn't detecting any code inside of them.

Fixes #57838.

PR Close #57845
2024-09-18 09:48:20 +02:00
Paul Gschwendtner
d0a71a33b1 refactor(migrations): check inheritance in signal queries migration (#57854)
Notably the inheritance checking is less complete as the one in the
input migration. That is because we can't efficiently determine query
fields in the analyze phase of compilation units. Unless we aggresively
consider every field of decorated classes as queries and complexify
the merged metadata significantly, we can't reliably check for cases
where a class is incompatible for migration because it overrides a
member from a class that is in a different compilation unit.

This is an acceptable limitation though (maybe for now), as worst case,
we would migrate the class and the other compilation unit would simply
break. Not ideal, but migrations are impossible to be 100% correct in
general— so not a surprise.

In the future, we may find ways to identify queries more reliably in
analyze phase already. e.g. if the compiler were to include this
metadata in the `.d.ts`, or if we decide to simply add this to the
metadata, accepting potential significant HDD increase.

PR Close #57854
2024-09-18 09:45:20 +02:00
Paul Gschwendtner
e20d2742f4 build: do not run renovate on signal migration TS versioning tests (#57855)
The versions for TypeScript should not be updated.

PR Close #57855
2024-09-18 09:43:11 +02:00
Matthieu Riegler
4231e8f28f fix(core): Handle @let declaration with array when preparingForHydration (#57816)
Before this commit, `@let` decleration with an array where  mistaken for a component in the lView and throwing an unexpected error.

This commit fixes this.

PR Close #57816
2024-09-17 16:29:39 +02:00
Angular Robot
87e025ae78 build: update github/codeql-action action to v3.26.7 (#57843)
See associated pull request for more information.

PR Close #57843
2024-09-17 15:48:12 +02:00
Angular Robot
004e4ca819 build: update all non-major dependencies (#57842)
See associated pull request for more information.

PR Close #57842
2024-09-17 15:47:21 +02:00
Ingila Ejaz
607ea4b67e docs: add fork url in contribution guidelines for new contributors (#57837)
Clicking a clickable repo url in the contribution guide would make it simpler for new contributors to find the repository
PR Close #57837
2024-09-17 15:23:34 +02:00
Paul Gschwendtner
8ecafce2d9 refactor(migrations): do not run optional TCB operations in input migration (#57835)
Optional operations that don't run in the actual application compilation
would then cause fatal diagnostic errors breaking the compiler
initialization at runtime.

We should try to keep the migration as close as possible to the
application build.

PR Close #57835
2024-09-17 11:08:37 +02:00
Paul Gschwendtner
4e05a6f299 refactor(migrations): share problematic pattern detection code (#57835)
This allows us to use the inheritance checks we built for the signal
input migration, inside the queries migration.

PR Close #57835
2024-09-17 11:08:37 +02:00
Paul Gschwendtner
64c76b79db refactor(migrations): prepare for sharing problematic pattern recognition (#57835)
This commit prepares us for sharing the problematic pattern detection,
or inheritance checking. E.g. if a class is manually instantiated, using
certain APIs may not be considered safe. This logic will be shared in
the following commit.

PR Close #57835
2024-09-17 11:08:37 +02:00
Kristiyan Kostadinov
39098f3a9b refactor(compiler): finalize hydrate syntax (#57831)
Finalizes compiler implementation of the new `hydrate` triggers by:
* Reworking the logic that was depending on the `hydrateSpan` to distinguish hydrate triggers from non-hydrate triggers.
* Fixing that the `hydrate when` trigger didn't have a `hydrateSpan`.
* Adding an error if a parameter is passed into a `hydrate` trigger.
* Add an error if other `hydrate` triggers are used with `hydrate never`.
* Replacing the `prefetch` and `hydrate` flags in the template pipeline with a `modifiers` field.
* Fixing an error that was being thrown when reifying `hydrate` triggers in the pipeline.
* Adding quick info support for the `hydrate` keyword in the language service.
* Adding some tests for the new logic.

PR Close #57831
2024-09-17 11:05:17 +02:00
Jessica Janiuk
79b54bba9c refactor(compiler): initial integration of hydrate triggers into the compiler (#57831)
Sets up the AST for hydrate triggers.

PR Close #57831
2024-09-17 11:05:17 +02:00
Paul Gschwendtner
59fe9bc772 feat(migrations): introduce signal input migration as ng generate schematic (#57805)
Introduces a new `ng generate` schematic for migration `@Input()`
declarations to signal inputs.

This migration is the same that is also integrated into the
VSCode extension.

Note: In a follow-up the documentation for this will be improved, and a
flag to report reasons on why certain inputs weren't migrated, is added.

PR Close #57805
2024-09-16 18:06:49 +02:00
Paul Gschwendtner
6cdcf5d6ca refactor(compiler-cli): respect configured file system when parsing tsconfig (#57805)
Whenever the `ngc` binary is used directly to parse configurations, we
should try to respect the configured file system like we do in all other
places. Right now one spot where we escape the FS is for reading
directories to e.g. support tsconfig#includes.

This commit fixes this, implementing TypeScript's read directory method
leveraging the configured FS. The approach taken here was used for a
couple of months/years for Angular Material migrations and no issues
were found.

PR Close #57805
2024-09-16 18:06:49 +02:00
Vlad Boisa
6c3b682330 docs: change spelling to correctly params (#57832)
PR Close #57832
2024-09-16 18:03:53 +02:00
Angular Robot
8e017348ef build: update dependency @inquirer/prompts to v6 (#57821)
See associated pull request for more information.

PR Close #57821
2024-09-16 17:24:26 +02:00
Kristiyan Kostadinov
e5adf92965 feat(core): stabilize @let syntax (#57813)
Removes the `@let` syntax from developer preview.

PR Close #57813
2024-09-16 12:16:12 +02:00
Charles Lyding
149d69e47c refactor(compiler): allow internal style encapsulation helper to directly encapsulate for a component (#57809)
For component stylesheet hot module replacement scenarios, it will be necessarily to directly
encapsulate a component's stylesheet in a single operation. This currently requires the
consumer of the `encapsulateStyle` helper to use the internal Angular attribute values combined
with a find/replace over the entire stylesheet. To avoid both of these, the helper function now
has an optional second parameter which allows direct and full encapsulation of a style for a given
component when the component identifier is known.

PR Close #57809
2024-09-16 12:14:57 +02:00
Pawel Kozlowski
1b1519224d feat(core): mark input, output and model APIs as stable (#57804)
This commit marks the input, output and model APIs as stable
(along with the associated APIs) and thus exits the dev preview
phase for those APIs.

PR Close #57804
2024-09-16 12:13:47 +02:00
Matthieu Riegler
41c212d604 refactor(migrations): Keep standalone:true (#57717)
This commit also adds the support of handling standalone proparties assigned by variables (or via shorthand assignments).

PR Close #57717
2024-09-16 12:12:33 +02:00
Angular Robot
6b066f3a0b build: update cross-repo angular dependencies (#57810)
See associated pull request for more information.

Closes #57806 as a pr takeover

PR Close #57810
2024-09-16 11:38:23 +02:00
Andriy Malish
7526687495 docs: Update CHANGELOG.md (#57726)
Fixing typo: reactoring -> refactoring

PR Close #57726
2024-09-16 11:28:05 +02:00
Samson Amaugo
b0d68b2e6f docs: correct key usage in sectionStyles and update template binding (#57820)
PR Close #57820
2024-09-16 11:26:04 +02:00
Can Özkan
64b78d5ff4 docs: escape pipe ("|") characters in markdown tables to fix rendering issues (#57822)
PR Close #57822
2024-09-16 11:24:55 +02:00
Paweł Maniecki
716f0d53b6 docs: fix typo in requirements for NG8106 (#57772)
"Configuration requirements" referred to the wrong diagnostic (`invalidBananaInBox`)
likely due to a copy-paste error

PR Close #57772
2024-09-16 11:21:28 +02:00
Angular Robot
8a5f3197c0 build: update cross-repo angular dependencies (#57776)
See associated pull request for more information.

Closes #56387 as a pr takeover

PR Close #57776
2024-09-13 16:09:02 +02:00