Commit graph

12745 commits

Author SHA1 Message Date
Pawel Kozlowski
c4ad8fb2e7 refactor(core): profiler takes null as a default instance (#59233)
Several profiler calls don't have any meaningful instance when
producing a profiling event. This commit changes the default
instance value to null to sreamline profiler invocations.

PR Close #59233
2025-01-13 10:52:19 -05:00
Paul Gschwendtner
8496fb16bc fix(migrations): incorrect stats when migrating queries with best effort mode (#59463)
We previously did count forcibly ignored queries as incompatible. This
resulted in incorrect migration stats that are printed upon migration
completion.

See: #58657

PR Close #59463
2025-01-10 11:52:13 -05:00
Paul Gschwendtner
86cbaaa2a2 test: add test to verify extending tsconfig works in signal input migration (#59463)
Related to https://github.com/angular/angular/issues/59348

PR Close #59463
2025-01-10 11:52:13 -05:00
Paul Gschwendtner
24f383ab4f test: improve typescript version coverage for signal input migration (#59463)
This ensures the migration works for these TypeScript versions. The
migration is very sensitive to the TS version and its internals; so it
makes sense to test all of these.

PR Close #59463
2025-01-10 11:52:12 -05:00
arturovt
17510becb0 refactor(platform-browser): drop BROWSER_MODULE_PROVIDERS_MARKER in production (#59412)
In this commit, we switch from decorators (which also produce redundant metadata, such as in the
`declareFactory` instruction) to the `inject` function to drop the `BROWSER_MODULE_PROVIDERS_MARKER`
token in production. This token is actually provided only in development mode but is still
referenced in the constructor due to the `@Inject(BROWSER_MODULE_PROVIDERS_MARKER)` decorator.

PR Close #59412
2025-01-10 11:47:32 -05:00
Kristiyan Kostadinov
966a370390 fix(migrations): resolve text replacement issue (#59452)
Based on https://github.com/angular/angular/pull/59353#issuecomment-2580320424, fixes a text replacement issue that seems to cause code to be duplicated in some setups.

PR Close #59452
2025-01-10 10:47:54 -05:00
Matthieu Riegler
676357dbe0 docs: update linkedSignal. (#59221)
The commit adds the mention that it is intentionnal that the computation is reactive even if there is an explicit `source`.

fixes #59094

PR Close #59221
2025-01-10 10:41:18 -05:00
Charles Lyding
a4164141a3 fix(compiler): use chunk origin in template HMR request URL (#59459)
The URL that is dynamically imported to fetch a potential component update
for HMR is now based on the value of `import.meta.url`. This ensures that
the request is sent to the same location that was used to retrieve the
application code. For some development server setups the HTML base HREF
may not be the location of the Angular development server. By using the
application code location which was generated by the development server,
HMR requests can continue to work as expected in these scenarios. In
most common cases, this change will not have any effect as the HTML base
HREF aligns with the location of the application code files.

PR Close #59459
2025-01-09 18:21:48 -05:00
arturovt
d51d67b725 refactor(common): prevent duplicating X-Request-URL (#59420)
The `X-Request-URL` string is duplicated in multiple places. It is worth moving it to a shared constant that would be minified to something like `const a = "X-Request-URL"` and referenced in all the used places.

PR Close #59420
2025-01-09 18:18:24 -05:00
Andrew Kushnir
ac2dbe3eb1 Revert "fix(core): Defer afterRender until after first CD (#58250)" (#59455)
This reverts commit 9870b643bf.

PR Close #59455
2025-01-09 14:30:01 -05:00
Andrew Kushnir
21f1ba22a6 Revert "fix(core): Don't run effects in check no changes pass (#58250)" (#59455)
This reverts commit a5fc962094.

PR Close #59455
2025-01-09 14:30:01 -05:00
arturovt
5884153e12 refactor(animations): drop warning functions in production (#59408)
Prior to this commit, functions that issued warnings were not wrapped with `ngDevMode` at the point
of invocation but had the `ngDevMode` check inside. This meant they acted as no-ops in production.
In this commit, we wrap them externally with `ngDevMode`, so they are entirely removed.

PR Close #59408
2025-01-09 13:15:06 -05:00
arturovt
17234213f6 refactor(platform-browser): remove Console from Hammer gestures (#59409)
Injecting the `Console` is redundant because it directly calls the global `console` object.
There is no reason to reference this class in Hammer gestures, as it is only used in development
mode. We can safely call the `console` object directly.

PR Close #59409
2025-01-09 13:09:51 -05:00
arturovt
e194573d0d refactor(common): tree-shake fetch backend (#59418)
This commit updates the code of the HTTP code to make the `FetchBackend` class tree-shakable. The class is only needed with `withFetch()` is called and it should not be included into bundles that do not use that feature.

PR Close #59418
2025-01-09 13:05:56 -05:00
arturovt
f2e293db4e refactor(platform-browser): drop Hammer token names in production (#59438)
In this commit, we drop `HAMMER_GESTURE_CONFIG` and `HAMMER_LOADER` injection token names in production.

PR Close #59438
2025-01-09 12:38:06 -05:00
arturovt
83bd63fa7c refactor(common): drop NullViewportScroller for client bundles (#59440)
In this commit, we replace the `isPlatformBrowser` runtime call with the `ngServerMode` in order to drop the `NullViewportScroller` for client bundles.

PR Close #59440
2025-01-09 12:33:04 -05:00
arturovt
205330d46a refactor(core): drop platform injection token names in production (#59400)
In this commit, we tree-shake the injection token names in production.

PR Close #59400
2025-01-09 12:28:17 -05:00
Kristiyan Kostadinov
3638f93acc fix(compiler-cli): handle more node types when extracting dependencies (#59445)
Fixes that the HMR dependency extraction logic wasn't handling some node types. Most of these are a bit edge-case-ey in component definitions, but variable initializers and arrow functions can realistically happen in factories.

PR Close #59445
2025-01-09 12:22:46 -05:00
arturovt
06214821ca refactor(core): change LContainerFlags to const enum (#59416)
Prior to this commit, the compiler produced:

```js
No = (function (e) {
  return (
    (e[(e.None = 0)] = "None"),
    (e[(e.HasTransplantedViews = 2)] = "HasTransplantedViews"),
    e
  );
})(No || {});
```

Changing to `const enum` allows it to be entirely dropped and inline values.

PR Close #59416
2025-01-09 10:38:28 -05:00
zhangenming
a201d455e6 docs(router): update link to development guide in README.md (#59388)
PR Close #59388
2025-01-09 10:29:38 -05:00
RafaelJCamara
5c9e84acd6 docs: update license URL from angular.io to angular.dev and year of license to 2025 (#59407)
PR Close #59407
2025-01-09 10:27:54 -05:00
Kristiyan Kostadinov
adc6c094f4 build: clean up pipeline-specific tests (#59450)
Now that we only have the template pipeline, we can remove the `.pipeline` extension from the files.

PR Close #59450
2025-01-09 09:56:06 -05:00
arturovt
854a5616bf refactor(forms): drop CALL_SET_DISABLED_STATE name in production (#59430)
In this commit, we drop the `CALL_SET_DISABLED_STATE` injection token name in production.

PR Close #59430
2025-01-09 09:21:00 -05:00
Matthieu Riegler
5c0d68804e fix(core): Ensure that a destroyed effect never run. (#59415)
Prior to this change, a scheduled root effect, even if destroyed instantly, would still run at least once.

This commit fixes this.

fixes #59410

PR Close #59415
2025-01-08 16:40:44 +00:00
arturovt
dd1d69b2e2 refactor(common): drop PRELOADED_IMAGES name in production (#59425)
In this commit, we drop the `PRELOADED_IMAGES` injection token name in production.

PR Close #59425
2025-01-08 16:12:02 +00:00
Dmytro Mezhenskyi
00cc923117 refactor(platform-browser): improve error message for UNEXPECTED_SYNTHETIC_PROPERTY (#58983)
Improve error message by adding instructions for enabling animations using standalone API.

PR Close #58983
2025-01-08 15:56:18 +00:00
Miles Malerba
a5fc962094 fix(core): Don't run effects in check no changes pass (#58250)
Fixes an issue where we accidentally ran effects in check no changes
passes.

PR Close #58250
2025-01-08 15:33:38 +00:00
Miles Malerba
9870b643bf fix(core): Defer afterRender until after first CD (#58250)
For `afterRender`/`afterNextRender` calls associated with a particular
view, ensure that they are not registered until after the first time the
view is rendered.

Co-authored-by: Alex Rickabaugh <alxhub@users.noreply.github.com>

PR Close #58250
2025-01-08 15:33:38 +00:00
Paul Gschwendtner
a25396d562 fix(bazel): support setting type: module in source package.json (#59406)
This is helpful as it allows us to set `type: module` in the checked-in
package files, useful for the hybrid mode of `rules_js` and
`rules_nodejs`, where the package.json files can control the execution
format.

PR Close #59406
2025-01-08 15:24:05 +00:00
arturovt
d9707e1127 refactor(core): drop DEFER_BLOCK_DEPENDENCY_INTERCEPTOR in production (#59381)
`new` expressions are not dropped by default because they are considered side-effectful,
even if they are not referenced anywhere in production mode.

PR Close #59381
2025-01-07 20:14:57 +00:00
arturovt
52a6710f54 fix(router): complete router events on dispose (#59327)
In this commit, we manually complete the `events` subject to remove all active observers and enable
granular garbage collection, as users may forget to unsubscribe manually when subscribing to `router.events`.

PR Close #59327
2025-01-07 17:06:26 +00:00
arturovt
5685b4c6aa refactor(core): prevent duplicating LView destroyed checks (#59387)
The `type_checks` module already exposes a utility function that checks whether `LView` is marked
as destroyed. There is no need to check flags in other places, as we can reuse the helper function.

PR Close #59387
2025-01-07 17:05:48 +00:00
Matthieu Riegler
aaf1fbb152 refactor(core): remove outdated comment. (#59401)
Should have been done by #58238, but was probably missed in a rebase.

fixes #59397

PR Close #59401
2025-01-07 17:05:12 +00:00
Johnson Chu
a6cdbec09f refactor: remove unnecessary TSLint rule flags (#59365)
There are many TSLint rule flags in the source code that have no effect, and they can be safely removed to keep the code clean.

PR Close #59365
2025-01-07 16:06:21 +00:00
Kristiyan Kostadinov
0e23f20c41 fix(platform-browser): styles not replaced during HMR when using animations renderer (#59393)
When we replace a component during HMR, we clear it from the cache of the renderer factory, however when using animations, there's an animation-specific renderer factory that wraps the base DOM one and was preventing the cache from being cleared.

These changes rework the logic that clear the cache to go through a method so we can forward the call to the delegated factory.

PR Close #59393
2025-01-07 15:55:38 +00:00
Angular Robot
8eb8af5217 build: lock file maintenance (#59291)
See associated pull request for more information.

PR Close #59291
2025-01-06 22:23:08 +00:00
Jessica Janiuk
2563f39f29 Revert "refactor(core): remove unused injection props (#59209)" (#59386)
This reverts commit 91b53881d1.

PR Close #59386
2025-01-06 21:35:58 +00:00
Matthieu Riegler
e0401ec1f0 refactor(compiler-cli): extract function overload separatly (#56489)
in order for the docs to process function entry, this commit refactor function extraction by keeping the implementation as a the default entry and adds all the overloads into a separate array of entries.

fixes #56144

PR Close #56489
2025-01-06 20:50:59 +00:00
Max Katz
6aeda99a3e docs: update copyright year (#59359)
PR Close #59359
2025-01-06 19:58:30 +00:00
Kristiyan Kostadinov
5ac6f065ab fix(router): avoid component ID collisions with user code (#59300)
Currently the `ɵEmptyOutletComponent` is very prone to generating ID collision warnings with user code, because it only has one child and no other metadata. This shows up some of our tests as well. While users can resolve it on their end, it can be confusing since they won't have any references to `ɵEmptyOutletComponent` in their own code.

These changes add an `exportAs` to it to make its component ID unique. This doesn't affect the public API of the component since users can't use it directly anyways.

PR Close #59300
2025-01-06 19:18:52 +00:00
arturovt
a088208690 refactor(router): replace mapTo since deprecated (#59333)
Replaces `mapTo` with `map` because, in RxJS, `mapTo` is deprecated and internally uses `map`.

PR Close #59333
2025-01-06 19:18:21 +00:00
Paul Gschwendtner
cc7634f498 fix(bazel): handle module names and ES output in hybrid ts_project mode (#59325)
`ts_project` interop does not emit `.mjs` files. We could achieve this
in the interop rule, but it's better to just fallback look for `.js`.

In addition, `ng_package` currently fails because there is no
`module_name` retrievable from the interop rule; hence causing in
incorrect packaging and safety errors being thrown.

PR Close #59325
2025-01-06 17:29:19 +00:00
Matthieu Riegler
91b53881d1 refactor(core): remove unused injection props (#59209)
Those were also properties that were kept to also support of old compiled targets.

PR Close #59209
2025-01-06 17:28:41 +00:00
arturovt
206229df10 refactor(core): tree-shake ApplicationRef.warnIfDestroyed (#59269)
In this commit, we replace `private warnIfDestroyed` with a `warnIfDestroyed` function that can
be completely removed in production. This change is necessary because, with `private warnIfDestroyed`,
the empty method is still retained in production, even though it has no body.

PR Close #59269
2025-01-06 17:28:10 +00:00
Kristiyan Kostadinov
ee99879fdc fix(compiler-cli): preserve defer block dependencies during HMR when class metadata is disabled (#59313)
Fixes that the compiler wasn't capturing defer block dependencies correctly when `supportTestBed` is disabled. We had tests for this, but we didn't notice the issue because the dependencies ended up being captured because of the `setClassMetadata` calls. Once they're disabled, the dependencies stopped being recorded.

Fixes #59310.

PR Close #59313
2025-01-06 17:26:30 +00:00
Kristiyan Kostadinov
ce3b6641fb fix(compiler-cli): account for more expression types when determining HMR dependencies (#59323)
During the HMR dependency analysis we need to check if an identifier is top-level or not. We do this by looking at each identifier and its parent, however we didn't account for some cases. These changes expand our logic to cover more of the common node types.

Related to https://github.com/angular/angular/issues/59310#issuecomment-2563963501.

PR Close #59323
2025-01-06 17:25:57 +00:00
Kristiyan Kostadinov
ceadd28ea1 fix(compiler): allow $any in two-way bindings (#59362)
Some time ago we narrowed down the expressions we support in two-way bindings, because in most cases any apart from property reads doesn't make sense. This ended up preventing users from using `$any` in the binding since it's considered a function call.

These changes update the validation logic to allow `$any`.

Fixes #51165.

PR Close #59362
2025-01-06 17:25:25 +00:00
Andrew Kushnir
dc8280d950 Revert "refactor(platform-server): reduce timeout used in tests (#59275)" (#59380)
This reverts commit 19ec8266d1.

PR Close #59380
2025-01-06 17:24:26 +00:00
Kristiyan Kostadinov
d298d25426 feat(migrations): add schematic to clean up unused imports (#59353)
In v19 we added a warning about unused standalone imports, however we didn't do anything about existing code which means that users have to clean it up manually. These changes add the `ng g @angular/core:cleanup-unused-imports` schematic which will remove the unused dependencies automatically.

There isn't any new detection code since all the manipulations are based on the produced diagnostics, but there's a bit of code to remove the import declarations from the file as well.

Fixes #58849.

PR Close #59353
2025-01-06 16:21:26 +00:00
Kristiyan Kostadinov
d6ca669bc9 refactor(migrations): allow compiler options to be customized in tsurge (#59353)
Allows for user-defined options to be passed in when creating a program in tsurge.

PR Close #59353
2025-01-06 16:21:26 +00:00