5618 Commits

Author SHA1 Message Date
Paul Gschwendtner aa04a4a22f refactor(migrations): ensure tsurge can properly emit references in g3 (#62447)
Currently when Tsurge runs in g3, it creates a bare bones Angular
compiler plugin. The tsconfigs from compilation units may set options
like "useHostForImportGeneration", but the Ngtsc logic doesn't enable
because the `fileNameToModuleName` method is not defined on the host.

This can break reference emission for Tsurge analyzers/programs and
result in subtle differences to real `ng_module` compilations. This
commit fixes this by making the method available in 1P Tsurge.

Notably, reference emission can occur during analysis— so even if
migrations aren't "emitting TS -> JS" output.

PR Close #62447
2025-07-03 09:36:17 +00:00
Shuaib Hasan Akib 85d6474d8c refactor(core): update NG0303 error message (#62363)
This adds mention of the `input()` signal function
to the error message.

PR Close #62363
2025-06-30 08:15:12 +00:00
Joan a06ec75735 docs: fix broken link on assertNotInReactiveContext ref page (#62360)
PR Close #62360
2025-06-30 08:13:45 +00:00
Matthieu Riegler ac7fe2c6f2 docs: remove list of APIs with a providers array. (#62296)
fixes #62295

PR Close #62296
2025-06-27 07:45:24 +00:00
Joey Perrott 31e3eb20f9 build: migrate to use web test runner rules (#62294)
Migrate karma tests throughout the repo to use the new web test runner based rule instead

PR Close #62294
2025-06-26 17:20:49 +00:00
arturovt fb7bfa6149 refactor(common): replace forEach with index loop for Domino compatibility (#62290)
In this commit, the use of `images.forEach` was replaced with a traditional `for (let i = 0; ...)` loop to ensure compatibility with Domino. Domino may return a custom internal data structure (e.g., a lazily evaluated query result) that does not fully support standard iteration protocols like `forEach` or `for...of`.

Naturally, this would never happen in any browser. It occurs only in unit tests when using `renderApplication()`, because Domino's `querySelectorAll` returns the following:

```js
var nodes = select(selector, context);
return nodes.item ? nodes : new NodeList(nodes);
```

In certain unit tests, it returns an object like:
`{ root: document, filter: function(e) { ... }, lastModTime: 1, done: true, cache: [] }`,
which means that the object does not have a `forEach` method.

As a result, this causes an `afterAll` error: `forEach is not a function`.

PR Close #62290
2025-06-26 12:01:37 +00:00
Angular Robot 8822d6c1bc build: update cross-repo angular dependencies (#62274)
See associated pull request for more information.

PR Close #62274
2025-06-26 08:18:51 +00:00
Rodrigo Damazio Bovendorp 2b4098cd76 docs(core): mark after{Next,Every}Render overloads as stable (#62153)
Your blog post signaled that afterNextRender and afterEveryRender
are now stable:
https://angular.love/angular-20-whats-new#Signal%20related%20APIs

However, only 1 of the overloads of those was marked as stable.

I detected this because angular-eslint errors on calls even to
to the publicApi overload - and while that should probably be
fixed on their end, your announcement wasn't specific about only
one overload being stable, so I assume this was an oversight.

angular-eslint related issue:
https://github.com/angular-eslint/angular-eslint/issues/2534

PR Close #62153
2025-06-25 17:00:20 +00:00
Matthieu Riegler a2e6f317a7 fix(core): allow to set a resource in an error state (#62253)
A resource is error state should still remain writable.

fixes #62241

PR Close #62253
2025-06-25 13:20:43 +00:00
arturovt b40c9d0e59 refactor(common): move ngServerMode check outside tap() to enable tree-shaking (#62238)
In this commit, the `ngServerMode` check is moved outside the RxJS `pipe()` to ensure that server-only logic is excluded from client bundles. Previously, the `tap()` operator and its closure were always included in the output, even though `ngServerMode` was false on the client and the side effect was never triggered.

By guarding the observable chain earlier, this reduces the RxJS stack frame depth, which simplifies debugging by avoiding unnecessary operator noise in client-side stack traces.

The resulting logic is also easier to reason about and avoids evaluating `HttpResponse` instances where not needed.

PR Close #62238
2025-06-25 11:13:22 +00:00
arturovt 4c00238a69 fix(core): avoid injecting ErrorHandler from a destroyed injector (#61886)
This commit prevents lazy injection of the internal `ErrorHandler` from a destroyed injector, as it would result in another "destroyed injector" error.

PR Close #61886
2025-06-24 14:13:34 +00:00
arturovt e7d259b0dc refactor(core): drop injection context assertion in production (#62038)
Drops `assertInInjectionContext` call in production in `afterNextRender`.

PR Close #62038
2025-06-24 12:24:10 +00:00
Kristiyan Kostadinov 369f03ad7f fix(core): unable to retrieve defer blocks in tests when component injects ViewContainerRef (#62156)
Fixes that `getDeferBlocks` wasn't accounting for the case where a component might be injecting `ViewContainerRef`. When that happens, an additional wrapper is introduced that needs to be accounted for when traversing the tree.

Fixes #62047.

PR Close #62156
2025-06-23 14:24:47 +02:00
Andrew Scott dff1417b73 build: revert incompatible build changes in patch branch (#62168)
incompatible build changes from ebaebb849f

PR Close #62168
2025-06-20 12:03:48 -07:00
Andrew Scott ebaebb849f refactor(core): update FakeNavigation to the latest spec (#62017)
Spec updates are in https://github.com/whatwg/html/pull/10919

For the most part, the updates revolve around the deferred commit
handling (with precommitHandler). Updates to redirect allow more
options. A committed promise now exists on the transition since commits
can be delayed. Tests were made zoneless for easier debugging and
timeouts were reduced.

PR Close #62017
2025-06-19 15:10:42 +02:00
Joey Perrott 4e26ef996b build: migrate to using new jasmine_test (#62132)
Migrate additional targets to jasmine_test

PR Close #62132
2025-06-19 10:04:46 +02:00
Joey Perrott f201df9b83 build: migrate to using new jasmine_test (#62106)
Use the new jasmine_test based on rules_js instead of jasmine_node_test from rules_nodejs

PR Close #62106
2025-06-18 17:59:50 +02:00
Kristiyan Kostadinov 82bf9848a1 fix(migrations): more robust trailing comma removal in unused imports migration (#62118)
Fixes the following issues with the logic in the unused imports migration that deals with trailing commas:
1. It was generating overlapping text ranges which can break internally.
2. It wasn't handling some cases that produce trailing commas.

PR Close #62118
2025-06-18 15:57:13 +02:00
Andrew Scott ae212b51ee fix(core): Wrap ErrorEvent with no error property (#62081)
This commit updates the global error listener to wrap the global ErrorEvent in a new Error with cause
if the error property is undefined.

fixes #62078

PR Close #62081
2025-06-18 13:57:25 +02:00
Angular Robot 4aa262b425 build: update cross-repo angular dependencies (#62116)
See associated pull request for more information.

PR Close #62116
2025-06-18 13:28:13 +02:00
Joey Perrott 8403bc731b build: migrate to usages of @devinfra// instead of @npm//@angular/build-tooling (#62050)
Use workspace imported devinfra deps instead of npm dep

PR Close #62050
2025-06-16 10:23:30 +02:00
arturovt 67f657e4a3 fix(core): inject APP_ID before injector is destroyed (#61885)
In this commit, we request `APP_ID` outside the `onDestroy` callback because the injector might already be in a destroyed state when the callback runs.

PR Close #61885
2025-06-12 15:56:51 +02:00
Matthieu Riegler de7aa608c9 refactor(migrations): support local string tokens for inject migration (#62013)
The `localTypeChecker` allows us to at least support locally defined strings in addition to string literals.

PR Close #62013
2025-06-12 15:53:21 +02:00
Michael Berger 4bba6d95ef docs(core): correct standalone jsdocs (#62025)
PR Close #62025
2025-06-12 15:51:24 +02:00
Jessica Janiuk e343cdfb86 fix(core): Fixes template outlet hydration (#62012)
Projected nodes were missing ssrId information and were skipping annotating template information, which caused templates to be destroyed and recreated rather than hydrated.

fixes: #50543

PR Close #62012
2025-06-12 12:54:27 +02:00
Paul Gschwendtner 43ef2ea628 build: fix hermetic execution of packages/core/test/... (#62027)
Due to a bug that is currently in progress of being resolved in the
`rules_js` toolchain (see:
https://github.com/aspect-build/rules_js/issues/362), we were seeing
subtle differences between `main` and PRs/local builds as RBE is a
strict sandbox environment while the normal linux/darwin sandbox isn't
necessarily.

This commit fixes the issue by avoiding the interop targets that don't
bring in the actual transitive node modules.

PR Close #62027
2025-06-12 12:16:56 +02:00
Angular Robot 44468bfe48 build: update cross-repo angular dependencies (#62008)
See associated pull request for more information.

PR Close #62008
2025-06-12 10:03:41 +02:00
Paul Gschwendtner d16c1cf462 build: migrate packages/core/test to new jasmine_test rule (#61902)
Migrates `packages/core/test` to the new `jasmine_test` rule. As part of
this, we are also removing an unnecessary/unused test fixture.

PR Close #61902
2025-06-12 10:00:10 +02:00
Joey Perrott 135c594443 refactor: use zone.js from npm instead of packages/zone.js throughout repo (#61978)
Use zone.js from npm isntead of from the repo going forward

PR Close #61978
2025-06-10 12:02:36 -07:00
Carolina 78910a32ef docs: rework programmatically rendering components section to mention @defer (#61763)
PR Close #61763
2025-06-10 12:01:30 -07:00
Taygan Caldwell 6ae07ad9a1 refactor(core): Delete createSignalTuple (#61907)
Delete createSignalTuple because it is no longer needed. creatSignal has the same behavior.

PR Close #61907
2025-06-06 13:46:16 +02:00
Joey Perrott 8ccd496014 build: remove unnecessary zone.js dep from various build targets (#61903)
Remove unnecessary zone.js dep from various build targets

PR Close #61903
2025-06-05 09:13:01 -07:00
kristilw 1e8158baee fix(core): components marked for traversal resets reactive context (#61663)
when marked for traversal the reactive context has to be set to null to avoid inheriting the reactive context of the parent component

PR Closes #61662

PR Close #61663
2025-06-05 14:49:02 +02:00
kristilw 1e4ce31da4 refactor(core): update tests to use standalone (#61663)
update tests to use standalone components for easier test setup

PR Close #61663
2025-06-05 14:49:02 +02:00
Taygan Caldwell f562fd4298 refactor(core): export signal setter and updater types for wiz (#61714)
Export signal setter and updater types for Wiz to use

PR Close #61714
2025-06-05 12:57:23 +02:00
arturovt 1cd23be57e fix(core): unregister onDestroy in outputToObservable (#61882)
We should remove the `onDestroy` listener once subscription is unsubscribed because components might not be destroyed yet, but they still would capture subscribers.

PR Close #61882
2025-06-05 11:16:57 +02:00
Angular Robot f6841ea089 build: update cross-repo angular dependencies (#61881)
See associated pull request for more information.

PR Close #61881
2025-06-05 10:17:01 +02:00
Paul Gschwendtner 8564cf48d8 build: replace all ng_package with new rule from rules_angular (#61862)
Replaces all `ng_package` rule with the new rule from `rules_angular`.

PR Close #61862
2025-06-05 07:34:50 +00:00
Paul Gschwendtner f98dfc2842 build: migrate integration and primitives/defer to ts_project (#61862)
Migrates remaining `ts_project` targets (excluding zone.js) to
`ts_project`.

PR Close #61862
2025-06-05 07:34:49 +00:00
arturovt ddd22bea48 fix(core): unregister onDestroy in ResourceImpl when destroy() is called (#61870)
This commit unregisters the `onDestroy` listener when `destroy()` is called on the `ResourceImpl`. This prevents memory leaks and ensures that the resource reference is not captured in the destroy callback after it has already been destroyed.

PR Close #61870
2025-06-04 14:23:13 -04:00
AleksanderBodurri b4ed62ddf6 fix(core): properly handle the case where getSignalGraph is called on a componentless NodeInjector (#60772)
Previously this would throw an error on the assertLView when we try to discover the templateLView.

Now this properly returns null for the template consumer and continues discovering other effects on the injector.

PR Close #60772
2025-06-04 12:16:47 -04:00
Andrew Scott 8c60cbfd1c fix(core): takeUntilDestroyed completes immediately if DestroyRef already destroyed (#61847)
Adds fix directly for `takeUntilDestroyed` to unsubscribe when already
destroyed instead of putting
synchronous behavior on `DestroyRef.onDestroyed` callback as in #58008

fixes #54527

PR Close #61847
2025-06-04 12:14:15 -04:00
cexbrayat 3c644688eb refactor(core): use RefactorStreamItem type in rxResource (#59887)
The `ResourceStreamItem` was introduced in #59851 and can be used to simplify the `rxResource` code.

PR Close #59887
2025-06-04 11:45:05 -04:00
Taygan Caldwell 9e850c80f1 refactor(core): Refactor createSignal to return a tuple contain getter, setter, and updater (#61705)
Refactor createSignal to return a tuple instead of a signal getter. createSignalTuple will be removed in a follow up pr once createSignalTuple usages in google3 are migrated to createSignal.

PR Close #61705
2025-06-04 10:46:12 -04:00
arturovt 5c31e7e28d fix(core): unregister onDestroy when observable errors in toSignal (#61596)
The observable terminates immediately when `error` is called, and no further emissions or completion notifications occur. Thus, we have to remove the listener in both the `error` and `complete` notifications.

PR Close #61596
2025-06-04 09:36:41 -04:00
Angular Robot 30ea478be4 build: update cross-repo angular dependencies (#61704)
See associated pull request for more information.

PR Close #61704
2025-06-03 07:33:33 -04:00
Matthieu Riegler 0ea831caea refactor(migrations): keep the control flow migration as ng generate. (#61773)
this way `ng generate @angular/core:control-flow` which has been fairly documented, remains valid.

PR Close #61773
2025-06-03 07:13:00 -04:00
Kristiyan Kostadinov 3817459f9e build: add missing symbol (#61783)
Fixes a broken symbol test.

PR Close #61783
2025-05-30 13:34:46 -04:00
Andrew Kushnir b1d960d082 fix(core): produce an error when incremental hydration is expected, but not configured (#61741)
This commit updates runtime logic to produce an error when there are some `@defer` blocks with `hydrate` triggers, but the incremental hydration is not enabled via `withIncrementalHydration()`. Previously the check was only detecting the case when `withIncrementalHydration()` is present on the server, but missing on the client. With the change in this commit, the check would be performed on the server as well.

PR Close #61741
2025-05-30 11:14:23 -04:00
Kristiyan Kostadinov e9820a6d48 fix(migrations): avoid trailing whitespaces in unused imports migration (#61698)
Follow-up to #61674 where we were leaving behind some whitespace, e.g. `[One, Two, Three]` would turn into `[One ]`. These changes only preserve the whitespace if the node is preceded by a newline.

This wasn't caught by tests, because they were stripping away whitespaces before asserting. I've also reworked the tests to be sensitive to formatting changes.

PR Close #61698
2025-05-30 11:07:21 -04:00