Commit graph

13077 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
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
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
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
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
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
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
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
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
Andrew Scott
0b6084e1bf refactor(router): split remainder of describes in integration test file (#60313)
to more easily navigate and identify different suites of integration tests,
this commit splits them into several different files

PR Close #60313
2025-03-11 17:13:27 -07:00
Paul Gschwendtner
4fa5d18e5a feat(bazel): support bundling .d.ts with code splitting (#60321)
Instead of relying on Microsoft's API extractor for `d.ts` bundling,
we are switching to Rollup-based `.d.ts` bundling.

This allows us to support code spliting, even for `.d.ts` files,
allowing for relative imports to be used between entry-points, without
ending up duplicating `.d.ts` definitions in two files. This would otherwise cause
problems with assignability of types.

It also nicely integrates into our existing rollup configuration, and
overall simplifies the `ng_package` rule even further!

Notably `tsup` also uses this rollup plugin, and it seems to work well.
Keep in mind that Microsoft's API extractor is pretty hard to integrate,
caused many problems in the past, and isn't capable of code splitting.
This aligns our d.ts bundling with the .mjs bundling (great alignment).

PR Close #60321
2025-03-11 13:03:08 -07:00
arturovt
526268c262 refactor(core): inline standalone check to be dropped (#60305)
Inlines `standalone` check into the message to be dropped.

PR Close #60305
2025-03-11 13:01:43 -07:00
Andrew Scott
7677578695 refactor(router): Add safe navigation operator (#60314)
Adds safe navigation operator to account for tests spying on navigateByUrl

PR Close #60314
2025-03-11 12:59:43 -07:00
Kristiyan Kostadinov
ef1fd137a9 fix(compiler): incorrect spans for template literals (#60323)
Fixes that we were producing zero-length spans for template literals and template literal elements.

Fixes #60320.
Fixes #60319.

PR Close #60323
2025-03-11 12:59:00 -07:00
AlirezaEbrahimkhani
dcc1a61dfa docs: change xss doc url to angular new documentation (#59915)
PR Close #59915
2025-03-11 12:57:48 -07:00
Kristiyan Kostadinov
8be6e3888b refactor(core): replace internal usages of InjectFlags (#60318)
Replaces all the places where we use `InjectFlags` internally with the `InternalInjectFlags` which has the benefit of being a `const` enum and allowing us to consolidate the flags and object literal eventually.

PR Close #60318
2025-03-11 11:33:09 -07:00
Kristiyan Kostadinov
611baaf069 feat(core): remove InjectFlags from public API (#60318)
Removes the deprecated `InjectFlags` symbol from the `@angular/core` public API, as well as all the places that accept it. The previous commit includes an automated migration to switch over to the new way of passing in flags.

BREAKING CHANGE:
* `InjectFlags` has been removed.
* `inject` no longer accepts `InjectFlags`.
* `Injector.get` no longer accepts `InjectFlags`.
* `EnvironmentInjector.get` no longer accepts `InjectFlags`.
* `TestBed.get` no longer accepts `InjectFlags`.
* `TestBed.inject` no longer accepts `InjectFlags`.

PR Close #60318
2025-03-11 11:33:09 -07:00
Kristiyan Kostadinov
e170d24240 fix(core): add migration away from InjectFlags (#60318)
Adds an automated migration that will switch users from the deprecated `InjectFlags` API to its non-deprecated equivalent.

PR Close #60318
2025-03-11 11:33:09 -07:00
aparzi
de2bfc0913 fix(core): fix removal of a container reference used in the component file (#60210)
During migration a container reference was deleted even though it was used in the component file.

PR Close #60210
2025-03-11 09:26:13 -07:00
Matthieu Riegler
a980ac9a6a refactor(platform-browser): Deprecate the HammerJS integration (#60257)
The HammerJS integration provided by the framework is deprecated

DEPRECATED: HammerJS support is deprecated and will be removed in a future major version.

PR Close #60257
2025-03-11 09:25:28 -07:00
Vlad Boisa
a129ae5c1f docs: fix one broke link by #57591 (#60237)
Fix 1 link in adev toolchain `{@link forRoot}`
PR Close #60237
2025-03-11 09:24:02 -07:00
Matthieu Riegler
c73520bb74 refactor(compiler): remove empty empty string suffix from interpolation instructions (#60066)
With this change, interpolations that don't have a suffix will miss the last argument which was previously an empty string.

PR Close #60066
2025-03-10 16:31:34 -07:00
Matthieu Riegler
e3afa24089 refactor(core): log a warning instead of throwing error on OutputRef.emit when the directive is destroyed. (#60293)
This should not be a hard error, as nothing bad happens but the users should be warned that no event will be emitted.

fixes #60110

PR Close #60293
2025-03-10 16:08:52 -07:00
Matthieu Riegler
db5963797d docs(docs-infra): Extract class constructors (#60302)
fixes #59180

PR Close #60302
2025-03-10 16:05:02 -07:00
Andrew Scott
647550918f refactor(router): split integration test file (#60311)
to more easily navigate and identify different suites of integration tests,
this commit splits them into several different files

PR Close #60311
2025-03-10 16:03:54 -07:00
Jessica Janiuk
a920f87b1c ci: fix timer test flakiness (#60310)
This replaces the TimerScheduler entirely and ensures the callback is called immediately. This should prevent any further flakiness.

PR Close #60310
2025-03-10 15:08:54 -07:00
arturovt
f2a8006591 refactor(core): replace PLATFORM_ID in initTransferState (#60299)
Replaces `PLATFORM_ID` check with the `ngServerMode`.

PR Close #60299
2025-03-10 13:49:23 -07:00
Andrew Scott
ff772d7800 fix(core): fix typing on injector.get to omit 'any' (#60202)
This commit further restricts the deprecated type on injector.get to exclude
all but `string`. Progresses towards #48408

BREAKING CHANGE: The `any` overload has been removed from
`injector.get`. It now only supports `ProviderToken<T>` and (deprecated
since v4) `string`.

PR Close #60202
2025-03-10 13:48:18 -07:00