Commit graph

32478 commits

Author SHA1 Message Date
Vlad Boisa
befa0faaef docs: change the broked link (#60436)
Change the wrong path of the link to a working one.
PR Close #60436
2025-03-18 18:09:31 +01:00
Angular Robot
d9d050e1c1 docs: update Angular CLI help [main] (#60441)
Updated Angular CLI help contents.

PR Close #60441
2025-03-18 18:07:05 +01:00
Angular Robot
7d3ba1a91b build: update cross-repo angular dependencies (#60445)
See associated pull request for more information.

PR Close #60445
2025-03-18 18:06:19 +01:00
Matt Turco
22d3f0562c feat(core): add hook for producer creation side effects (#60333)
Adds a hook in the same style as `postSignalSetFn` for running side effects when a producer has been created. This hook will be passed the reactive node being created.

PR Close #60333
2025-03-18 15:10:01 +01:00
iteriani
69b688c7d1 refactor(core): Add an additional check for the name field for NotFoundError (#60322)
Inside g3, instanceof checks will fail. Instead, check the name field.

PR Close #60322
2025-03-18 15:05:52 +01:00
Andrew Scott
48974c3cf8 fix(core): remove rejectErrors option encourages uncaught exceptions (#60397)
This commit removes the previously added `rejectErrors` option from
`toSignal` which was meant to create similar behavior to what happens
with unhandled errors in `AsyncPipe`.

This option promotes unhandled exceptions and attaches behaviors that we
do not believe are desirable as an option offered by the framework:

* Unhandled errors that are thrown lose the context of where the error
  ocurred. Throwing the error where the signal is read allows error
  handling to be performed at the signal's usage location
* With this feature, the value of the signal remains set to the initial
  value or the previous successful value coming out of the `Observable`.
  We do not feel this is appropriate implicit behavior but should be an
  explicit choice by the application. Signals are built to represent
  state. When an observable stream is converted to a stateful
  representation, there should be a choice made about what state should
  be presented when an error occurs
* If an error occurs but the signal value is never read in its error
  state, this is not an application state error that should result in an
  unhandled exception.
* While Angular does not have error boundaries today, there is likely to
  be investigation in the near future to address increased risk of
  errors thrown from signals such as this in templates. Without
  pre-designing any specifics, it is possible that this type of feature
  would require the error to be thrown from the signal. We are subsequently
  not prepared to commit to stabilizing the `toSignal` API with the
  `rejectErrors` option and its current behavior.

Developers that desire similar behavior to `rejectErrors` have several
options, the simplest of which would be something similar to
`toSignal(myStream.pipe(catchError(() => EMPTY)))`.

PR Close #60397
2025-03-18 14:10:24 +01:00
Alan Agius
bf5d995caa refactor(platform-server): expose internal render method for extensibility (#60416)
The `renderApplication` and `renderModule` methods currently encapsulate the entire rendering process, making it difficult to intercept key phases from a non-Angular context. This change exports the internal `render` method, allowing us to perform operations such as:

- Flushing headers before hydration preparation
- Handling non static redirects (e.g., 302 responses)
- Intercepting router events for additional processing

This refactor serves as an experimental step toward improving the API for better customization and integration in the future.

PR Close #60416
2025-03-18 10:31:44 +01:00
Doug Parker
4930ed3fed refactor(devtools): add support for mutating objects inside signals (#60381)
Angular DevTools now supports mutating objects underneath signals in the property explorer view.

This is done by performing an "immutable update" by recursively copying objects underneath a signal and overwriting the one property specified. For example, if the user attempted to set `foo.bar.baz[2].hello = 'world'` and `bar` was a signal, this would effectively become:

```typescript
foo.bar.set({
  ...foo.bar(),
  baz: [
    ...foo.bar().baz.slice(0, 2),
    {
      ...foo.bar().baz[2],
      hello: 'world',
    },
    ...foo.bar().baz.slice(3),
  ],
})
```

The motivation for immutable updates is because signals and Angular change detection don't really like interior mutability of signal values. If we didn't do this, any kind of comparison or dirty check would prevent the UI from updating. If an application attempts to change a deeply nested property inside a signal, it doesn't work today. DevTools should generally be limited to operations an application could do itself, and the recommended approach to make such a change like this is an immutable update. Creating entirely new objects intentionally breaks referential equality such that the application can properly react to the change.

Unfortunately, it is not possible to make immutable updates in a truly generic sense. You can't just copy a class for instance `({...new MyFoo()}).doSomething()`. We could do something fancier like manually copying over the prototype or something like that, but there is no way to do this without breaking class semantics (ex. the class might reasonably rely on the constructor being called). Therefore we instead reject any mutations to non-primitive objects. In the future, we might expand the set of "primitives" to include other built-ins and well-known objects like `URL` or `Element`, but those are out of scope for now.

I opted to ban mutating the result of a readonly/computed signal. While the mutation is likely to succeed, a subsequent rerun of the `computed` will immediately drop the change. However, I opted to allow mutating the result of a getter property. This has a similar problem because it might be returning a synthetic object which will be invalidated on the next execution, but it is possible and reasonable for a getter to return the same object multiple times such that a mutation may reasonably survive other updates. DevTools can't easily know whether a getter actually will return the same object on each execution or not, so we optimistically assume the reference is stable. If it isn't, the mutation will be lost whenever the getter is re-executed.

PR Close #60381
2025-03-18 10:22:46 +01:00
Doug Parker
3104e43b74 refactor(devtools): fix reading resolutionPath (#60403)
Sometimes `forest` can be empty if the provided roots are empty, and was leading to a "Cannot read `resolutionPath` of `undefined`" error. Now we check the forest has a tree in it before looking up `resolutionPath`.

There might be a separate issue with the fact that the backend script likely shouldn't be emitting an empty forest in the first place. However we already check that a resolution path exists at all, so I think it's fair to also check that a tree was provided. We can separately look into making sure the backend is emitting valid data.

PR Close #60403
2025-03-18 10:19:51 +01:00
Angular Robot
39b1bf614f build: update cross-repo angular dependencies (#60405)
See associated pull request for more information.

PR Close #60405
2025-03-18 10:19:04 +01:00
Angular Robot
4d6cce222b build: update io_bazel_rules_sass digest to ebdb141 (#60428)
See associated pull request for more information.

PR Close #60428
2025-03-18 10:18:16 +01:00
William Mba
c27511e82c docs: fix typo (#60431)
PR Close #60431
2025-03-18 10:11:58 +01:00
Paul Gschwendtner
2ca72faab1 build: improve partial compliance golden generation and add debug logging (#60427)
Improves the partial compliance golden generation to not rely on large
files being transmitted via `stdout`. Instead the files are written
directly as it's done in idiomatic Bazel generation actions.

In addition, we add extra stdout logging for the Bazel action, to see if
the process is actually invoked in RBE workers. Right now those are
occassionally stuck, but neither us, nor the RBE team can see anything
running, and they're occasionally stuck for 1hr.

PR Close #60427
2025-03-18 07:10:43 +00:00
Alan Agius
450c1fcfa4 docs: revise and consolidate server rendering guides (#60383)
This commit updates the server rendering documentation and merges the prerendering, hybrid, and SSR sections for better clarity and organization.

Closes #52884 and closes #60079

PR Close #60383
2025-03-17 18:34:33 +01:00
Matthieu Riegler
a43570d623 docs(docs-infra): fix & enable shared-docs tests (#60409)
This commit includes a refactoring that removes `TableOfContentsScrollSpy` as this is only directly handled via a browser API.

PR Close #60409
2025-03-17 18:33:45 +01:00
Kristiyan Kostadinov
b154fb3911 feat(core): add support for two-way bindings on dynamically-created components (#60342)
Builds on the changes from #60137 to add support for two-way bindings on dynamically-created components. Example usage:

```typescript
import {createComponent, signal, twoWayBinding} from '@angular/core';

const value = signal('');

createComponent(MyCheckbox, {
  bindings: [
    twoWayBinding('value', value),
  ],
});
```

In the example above the value of `MyCheckbox` and the `value` signal will be kept in sync.

PR Close #60342
2025-03-17 14:29:52 +01:00
Kristiyan Kostadinov
bf2b0253bc refactor(compiler-cli): move typeCheckHostBindings option (#60267)
Moves the `typeCheckHostBindings` option into `StrictTemplateOptions` and renames the latter.

PR Close #60267
2025-03-17 14:28:41 +01:00
Kristiyan Kostadinov
1971e57a45 feat(compiler-cli): support type checking of host bindings (#60267)
Historically Angular's type checking only extended to templates, however host bindings can contain expressions as well which can have type checking issues of their own. These changes expand the type checking infrastructure to cover the `host` object literal, `@HostBinding` decorators and `@HostListener` with full language service support coming in future commits.

Note that initially the new functionality is disabled by default and has to be enabled using the `typeCheckHostBindings` compiler flag.

PR Close #60267
2025-03-17 14:28:41 +01:00
Kristiyan Kostadinov
eb4c22e6d9 refactor(compiler-cli): enable type checking of directive classes (#60267)
Updates the directive handler to enable type checking of directives. Currently this only applies to checking of host bindings.

PR Close #60267
2025-03-17 14:28:40 +01:00
Kristiyan Kostadinov
84b3721351 refactor(compiler-cli): produce host binding type checking information for components (#60267)
Sets up the logic that produces the information necessary to type check host bindings of a component. Also introduces a compiler flag for toggling checking of host bindings.

PR Close #60267
2025-03-17 14:28:40 +01:00
Kristiyan Kostadinov
0669709120 refactor(compiler-cli): add logic for synthesizing host element (#60267)
Adds the logic that creates a `HostElement` AST node based on the host bindings of a directive.

PR Close #60267
2025-03-17 14:28:40 +01:00
Kristiyan Kostadinov
b8f2a50c68 refactor(compiler-cli): track host binding information (#60267)
Sets up the infrastructure to track the host bindings of directives for type checking purposes.

PR Close #60267
2025-03-17 14:28:40 +01:00
Kristiyan Kostadinov
7ffcb504df refactor(compiler): account for host element in binder (#60267)
Updates the `R3TargetBinder` to ingest host element nodes.

PR Close #60267
2025-03-17 14:28:40 +01:00
Kristiyan Kostadinov
a34353c736 refactor(compiler): add AST node for host element (#60267)
Adds the `HostElement` AST node that can be used to represent the host of a directive. Also exposes the `BindingParser` type so it's easier to pass around the return value of `makeBindingParser`.

PR Close #60267
2025-03-17 14:28:40 +01:00
Matthieu Riegler
bb7e948bde refactor(core): Add recommendation for string tokens on @Inject (#60326)
While still being supported because of ngUpgrade, string tokens are not recommended. Developers should use InjectionTokens or classes as tokens instead.

PR Close #60326
2025-03-17 12:18:23 +01:00
Kristiyan Kostadinov
04d963c0a5 fix(core): remove unused parameter from listener instruction (#60406)
Removes the `useCapture` parameter from the `listener` instruction, because it's not used.

PR Close #60406
2025-03-17 12:16:03 +01:00
Kristiyan Kostadinov
8953e45a43 fix(core): include input name in error message (#60404)
Includes either the `debugName` or alias of an input in the error message about a value not being available.

Fixes #60199.

PR Close #60404
2025-03-17 12:15:02 +01:00
Angular Robot
1668b9fbb0 build: update babel dependencies to v7.26.10 (#60398)
See associated pull request for more information.

PR Close #60398
2025-03-17 10:29:43 +01:00
Angular Robot
43eb680977 docs: update Angular CLI help [main] (#60400)
Updated Angular CLI help contents.

PR Close #60400
2025-03-17 10:26:48 +01:00
Angular Robot
cc94862eaa build: pin actions/upload-artifact action to 4cec3d8 (#60401)
See associated pull request for more information.

PR Close #60401
2025-03-17 10:26:00 +01:00
Paul Gschwendtner
eb867c3d23 build: upload grpc remote logs for debugging (#60393)
This should be helpful in figuring out why RBE is currently unstable.

PR Close #60393
2025-03-14 19:51:26 +01:00
Jessica Janiuk
b8daf472d8 fix(core): execute timer trigger outside zone (#60392)
This should prevent defer timers from impacting app stability by executing them outside of the zone, similar to other defer triggers.

fixes: #60373

PR Close #60392
2025-03-14 17:01:02 +01:00
Kristiyan Kostadinov
c147a0d6de refactor(migrations): simplify integration of tsurge migrations into the CLI (#60386)
Currently when we reuse a Tsurge migration is reused externally, there's some glue code that needs to be executed in a specific order. The code gets copied between the different migrations which is error-prone and means that bugs may have to be fixed several times.

These changes move the common steps out into a separate function so that only the migration-specific logic (mostly instantiation and logging) is left in the schematic.

PR Close #60386
2025-03-14 14:44:26 +01:00
Alan Agius
80895ea966 ci: disable Renovate updates for @angular/build-tooling (#60387)
The newer version of this package requires Aspect setup which is not configured in this repo.

PR Close #60387
2025-03-14 14:43:24 +01:00
Alan Agius
ea6cc64639 build: update cross-repo angular dependencies (#60387)
See associated pull request for more information.

Closes #59956 as a pr takeover, `@angular/build-tooling` has been rolled back as due to missing `@aspect_rules_js`.

PR Close #60387
2025-03-14 14:43:24 +01:00
Rahat Ahmed
28459060a2 refactor(core): Support and document manually provided internal injections (#60347)
For internal framework values stored in injectors, they are manually
managed and inserted into injectors as needed. Therefore their tokens
don't provide a value or factory. This updates the type to reflect that
and updates the jsdocs a bit.

PR Close #60347
2025-03-14 13:40:40 +01:00
Andrew Scott
997117bb76 refactor(router): Clean up the transition subject (#60357)
This commit cleans up the transition subject a bit so it doesn't use a dummy
initial value. It also avoids copying over data from the previous
request when a new one is created.

PR Close #60357
2025-03-14 11:16:15 +01:00
Andrew Scott
c054d620dd refactor(router): Update to use early return to reduce nesting (#60377)
Updates a switchTap body to use early return to reduce nesting

PR Close #60377
2025-03-14 11:15:28 +01:00
Denis Bendrikov
d79c57d9d7 fix(devtools): eliminate unnecessary scrollbars on injector tree (#59966)
Modify CSS to eliminate unnecessary scrollbars on injector tree

PR Close #59966
2025-03-14 08:38:02 +01:00
Angular Robot
c4360fe0a1 docs: update Angular CLI help [main] (#60375)
Updated Angular CLI help contents.

PR Close #60375
2025-03-14 08:33:27 +01:00
Kristiyan Kostadinov
cd7c170763 fix(upgrade): handle output emitters when downgrading a component (#60369)
The `DowngradeComponentAdapter` adapter was assuming that all outputs are observables, but they can also be `OutputEmitterRef`.

Fixes #60366.

PR Close #60369
2025-03-13 17:36:55 +01:00
Pawel Kozlowski
adecf4c772 refactor(core): pass signal equal function to primitives (#60364)
The signals primitives package understands the equals option now
so we can pass it to the signal / computed creation methods instead
of manually assigning the equality function on a reactive node.

PR Close #60364
2025-03-13 17:24:17 +01:00
Hyron48
55ba1ededd docs: added short explanation about event reply (#60349)
a short explanation about event reply has been added, briefly explaining the phases that compose it

PR Close #60349
2025-03-13 17:03:41 +01:00
Nico Muszalczyk
7a3958546d docs: note that CSS is also taken into account in the max bundle size (#60362)
Closes #60356

PR Close #60362
2025-03-13 15:50:39 +01:00
Matthieu Riegler
f5f2549808 refactor(http): replace overriden method with a ts declare (#60278)
This allows us to drop the useless `super.hasValue()`.

PR Close #60278
2025-03-12 12:27:47 -07:00
Pawel Kozlowski
72ef9ed4a3 refactor(core): prepare integration with Chrome DevTools (#60217)
This commit puts in place infrastructure capable of routing
performance-related, internal framework events directly to
the Chrome DevTools performance panel (custom track).

PR Close #60217
2025-03-12 12:26:27 -07:00
Angular Robot
babc322ce7 build: update all non-major dependencies (#60315)
See associated pull request for more information.

PR Close #60315
2025-03-12 12:25:38 -07:00
Pawel Kozlowski
817021b359 refactor(core): add equal option to the signal and computed creation (#60300)
This change moves more logic to the primitives package by pushing
the equal configuration on a reactive node to the signal and
computed creation utilities.

PR Close #60300
2025-03-12 10:38:27 -07:00
Taygan Caldwell
bc95edf240 refactor: cleanup untracked in core (#60150)
Re-export untracked in core from primitives

PR Close #60150
2025-03-12 10:37:51 -07:00
Andrew Kushnir
9657c7d699 test(core): reduce test flakiness by increasing time delta (#60338)
This commit updates an expected delta range for a duration of a view transition to reduce flakiness of that test.

PR Close #60338
2025-03-12 10:36:36 -07:00