Commit graph

13159 commits

Author SHA1 Message Date
Joey Perrott
7f26df1608 build: migrate animations to use rules_js based toolchain (#61479)
Migrate animations to use `ts_project` and `ng_project`

PR Close #61479
2025-05-20 08:46:35 +00:00
Joey Perrott
40534d7de1 build: migrate benchpress to use rules_js (#61486)
Use ts_project to build targets in benchpress package

PR Close #61486
2025-05-20 08:44:55 +00:00
Paul Gschwendtner
bd2b454faf refactor(migrations): gracefully proceed if reference cannot be resolved (#61426)
A runtime error can surface when TypeScript internally fails to resolve
a reference that is named similar to an input, but no `.d.ts` is
available for it.

See example error:
https://github.com/microsoft/TypeScript/issues/61473#issuecomment-2746537781.

PR Close #61426
2025-05-19 11:04:54 +00:00
arturovt
9aedd30983 refactor(animations): mark non-default new expressions as pure (#61452)
Adds `__PURE__` annotations to non-default `new` expressions to enable tree-shaking, even if they are not referenced. These variables are not dropped when Angular is imported from a module that has `sideEffects` set to `true`.

PR Close #61452
2025-05-19 08:26:57 +00:00
Pawel Kozlowski
c856f43b5f refactor(core): move the data store operation out of instructions (#61425)
The view data store operation is not an instruction and shouldn't be
located in the instructions folder.

PR Close #61425
2025-05-19 08:24:47 +00:00
Pawel Kozlowski
1a3351c4f5 refactor(core): move i18n logic into its dedicated package (#61425)
Move the i18n-related logic out of the instructions folder into
the i18n-dedicated folder / package.

PR Close #61425
2025-05-19 08:24:47 +00:00
Paul Gschwendtner
185b7801ee build: migrate packages/core/schematics to ts_project (#61420)
Migrates `packages/core/schematics` to `ts_project`. As part of this,
this commit cleans up some of the mixed module types and tsconfigs in
the folder. A single tsconfig (and it's test variant) are now used.

For the shipped schematics, we explicitly use the `.cjs` extension, so
that the bundles are properly recognized as CommonJS; even if they are
part of the `type: module` `@angular/core` package.

The `package.json` with `type: commonjs` is removed from
`packages/core/schematics` as it's no longer needed given the explicit
extension & caused issues as schematics are compiled with ESM but are
only later bundled for shipping & some tests as ESM.

PR Close #61420
2025-05-16 15:53:27 +00:00
Paul Gschwendtner
e056fa13df build: migrate more targets of @angular/core to ts_project (#61420)
Migrates more targets of `@angular/core` to `ts_project`. Remaining are:

 - tests
 - schematics

PR Close #61420
2025-05-16 15:53:27 +00:00
Kristiyan Kostadinov
fd29dab218 build: fix golden approval script (#61407)
Fixes the `update_all_goldens` script which was throwing, because the query command was also capturing the call into yarn and Bazel which in turn caused it to throw an error. I've also added some validation for the number of targets.

PR Close #61407
2025-05-16 13:59:11 +00:00
Kristiyan Kostadinov
8edafd0559 perf(platform-server): speed up resolution of base (#61392)
The `getBaseHref` method is called several times per request and currently queries through the entire document. We can speed it up by taking advantage of the fact that the `<base>` can only be a direct child of the `<head>` and is usually defined towards the beginning. Below are some benchmarks for a "Hello world" app before and after this change.

### Before:
```
Running 60s test @ http://localhost:4202
100 connections with 10 pipelining factor

┌─────────┬────────┬────────┬────────┬────────┬───────────┬──────────┬─────────┐
│ Stat    │ 2.5%   │ 50%    │ 97.5%  │ 99%    │ Avg       │ Stdev    │ Max     │
├─────────┼────────┼────────┼────────┼────────┼───────────┼──────────┼─────────┤
│ Latency │ 568 ms │ 853 ms │ 901 ms │ 904 ms │ 866.58 ms │ 437.6 ms │ 9915 ms │
└─────────┴────────┴────────┴────────┴────────┴───────────┴──────────┴─────────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5%   │ Avg     │ Stdev   │ Min     │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Req/Sec   │ 490     │ 826     │ 1,006   │ 1,643   │ 1,129.3 │ 234.69  │ 490     │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Bytes/Sec │ 10.4 MB │ 17.4 MB │ 21.3 MB │ 34.7 MB │ 23.9 MB │ 4.96 MB │ 10.3 MB │
└───────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘

Req/Bytes counts sampled once per second.
# of samples: 60

69k requests in 60.04s, 1.43 GB read
90 errors (90 timeouts)
```

### After

```
Running 60s test @ http://localhost:4202
100 connections with 10 pipelining factor

┌─────────┬────────┬────────┬────────┬─────────┬───────────┬───────────┬─────────┐
│ Stat    │ 2.5%   │ 50%    │ 97.5%  │ 99%     │ Avg       │ Stdev     │ Max     │
├─────────┼────────┼────────┼────────┼─────────┼───────────┼───────────┼─────────┤
│ Latency │ 471 ms │ 831 ms │ 889 ms │ 1668 ms │ 835.91 ms │ 467.89 ms │ 9720 ms │
└─────────┴────────┴────────┴────────┴─────────┴───────────┴───────────┴─────────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬──────────┬────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5%   │ Avg      │ Stdev  │ Min     │
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼────────┼─────────┤
│ Req/Sec   │ 390     │ 860     │ 1,145   │ 1,572   │ 1,156.77 │ 222.65 │ 390     │
├───────────┼─────────┼─────────┼─────────┼─────────┼──────────┼────────┼─────────┤
│ Bytes/Sec │ 8.24 MB │ 18.2 MB │ 24.2 MB │ 33.2 MB │ 24.4 MB  │ 4.7 MB │ 8.24 MB │
└───────────┴─────────┴─────────┴─────────┴─────────┴──────────┴────────┴─────────┘

Req/Bytes counts sampled once per second.
# of samples: 60

71k requests in 60.03s, 1.47 GB read
140 errors (140 timeouts)
```

PR Close #61392
2025-05-16 09:03:39 +00:00
Andrew Scott
94f5a4b4d6 fix(core): Testing should not throw when Zone does not patch test FW APIs (#61376)
This prevents `core/testing` from throwing an error if ZoneJS is present
but does not patch the test FW APIs such that `fakeAsync` works
automatically. For example, there is currently no patching of the vitest
APIs, so if you try to use Vitest with Zone on the page, it will throw.

PR Close #61376
2025-05-16 07:53:41 +00:00
arturovt
eb53bda470 fix(core): enable stashing only when withEventReplay() is invoked (#61352)
Patch version of https://github.com/angular/angular/pull/61077.

PR Close #61352
2025-05-15 10:10:04 -07:00
Charles Lyding
1191e62d70 fix(compiler-cli): avoid ECMAScript private field metadata emit (#61227)
The Angular class metadata emit structure does not support the use of
private fields. If the class metadata emit is enabled and an ECMAScript
private (i.e., `#` prefixed) member contains a decorator, the member will
now be excluded from the emitting `setClassMetadata` call. This prevents
runtime errors due to invalid syntax.

PR Close #61227
2025-05-15 09:45:06 -07:00
Paul Gschwendtner
f2d6e59857 refactor: explicitly ensure ngDevMode types are available (#61365)
This commit adds an import to the `ng_dev_mode.ts` file that augments
`global` to have types for `ngDevMode`.

Notably this change is currently not needed because the file is loaded
by `ts_library` through `tsconfig#files`— but in a separate PR we are
switching the target to `ts_project` which no longer loads all Bazel
dependency files via `tsconfig#files`; resulting in the ambient types no
longer magically being available.

PR Close #61365
2025-05-15 12:45:13 +00:00
Joey Perrott
dfd068da9f build: use common macro to define tsconfig for service worker (#61341)
Define the tsconfig for service worker instead of manually including the tsconfig on each target

PR Close #61341
2025-05-14 10:43:26 -07:00
Joey Perrott
a4e3c12965 build: migrate upgrade to use ng_project instead of ng_module (#61320)
Use ng_project instead of ng_module in @angular/upgrade

PR Close #61320
2025-05-14 09:34:29 -07:00
Joey Perrott
064acf6314 build: migrate service-worker to ng_project (#61318)
Migrate service worker to use ng_project instead of ng_module

PR Close #61318
2025-05-14 08:54:40 -07:00
Paul Gschwendtner
f3f0769ce7 refactor: update packages/core:{core,src} to ts_project (#61336)
Updates `packages/core:core` and `packages/core/src/...` to `ts_project`
of `rules_js`.

PR Close #61336
2025-05-14 08:31:33 -07:00
Paul Gschwendtner
0d025c5013 build: support new ng_project rule (#61336)
Supports the `ng_project` rule with the local compiler-cli version
from HEAD.

PR Close #61336
2025-05-14 08:31:33 -07:00
Miles Malerba
42f203e029 docs: rename @nodoc to @docs-private (#61196)
This aligns with how angular/components marks their hidden APIs.
`@nodoc` has been broken since the switch to adev, this change should
properly hide the APIs again.

PR Close #61196
2025-05-13 17:15:37 -07:00
Miles Malerba
07e8c3ef5e docs: generate api pages for cdk (#60853)
Generates html for the cdk api pages based on the json files imported
from angular/cdk-builds

PR Close #60853
2025-05-13 16:32:37 -07:00
Paul Gschwendtner
899cb4ab49 refactor: add explicit types for exports relying on inferred call return type (#61316)
As part of the Bazel toolchain migration we noticed that implicit types
generated by the TypeScript compiler sometimes end up referencing types
from other packages (i.e. cross-package imports).

These imports currently work just because the Bazel `ts_library` and
`ng_module` rules automatically inserted a `<amd-module
name="@angular/x" />` into `.d.ts` of packages. This helped TS figure
out how to import a given file. Notably this is custom logic that is not
occuring in vanilla TS or Angular compilations—so we will drop this
magic as part of the toolchain cleanup!

To improve code quality and keep the existing behavior working, we are
doing the following:

- adding a lint rule that reduces the risk of such imports breaking. The
  failure scenario without the rule is that API goldens show unexpected
  diffs, and types might be duplicated in a different package!

- keeping the `<amd-module` headers, but we manually insert them into
  the package entry-points. This should ensure we don't regress
  anywhere; while we also improved general safety around this above.

Long-term, isolated declarations or a lint rule from eslint-typescript
can make this even more robust.

PR Close #61316
2025-05-13 22:46:00 +00:00
Kristiyan Kostadinov
7be6e5dc50 refactor(migrations): remove unused code (#61260)
The `waitForAsync` rule has been disabled internally which allows us to delete its code, as well as some unused adjacent code.

PR Close #61260
2025-05-12 15:34:08 -07:00
Joey Perrott
7dcae7b5e2 build: migrate service-worker package to use ts_project (#61226)
Migrate the package to using rules_js

PR Close #61226
2025-05-12 15:29:29 -07:00
Joey Perrott
f0dd8f8769 build: migrate upgrade package to use ts_project (#61245)
Migrate the package to using rules_js

PR Close #61245
2025-05-09 16:43:05 +00:00
Paul Gschwendtner
6cd2df00ca build: remove unused debugging leftover from RBE investigation (#61237)
This log output doesn't provide any benefit anymore, so we can remove it.

PR Close #61237
2025-05-09 16:01:49 +00:00
Paul Gschwendtner
0e3d4546b9 build: migrate compiler-cli/src/ngtsc to ts_project (#61237)
Migrates all of `compiler-cli/src/ngtsc` to `ts_project`. This change
was generated using Gemini.

PR Close #61237
2025-05-09 16:01:49 +00:00
Paul Gschwendtner
27e4e5847f build: migrate compiler-cli/src/ngtsc/docs to ts_project (#61237)
Migrates `compiler-cli/src/ngtsc/docs` to `ts_project`.

PR Close #61237
2025-05-09 16:01:49 +00:00
Paul Gschwendtner
1bfd7bbd1c build: prepare for compiler-cli to be using ts_project (#61237)
Prepare the compiler-cli package for being ready for migration
to `ts_project`.

PR Close #61237
2025-05-09 16:01:49 +00:00
Paul Gschwendtner
d37f5085e4 build: migrate symbol-extractor to ts_project (#61209)
Migrates the symbol-extractor code to `ts_project`.

PR Close #61209
2025-05-08 09:23:48 -07:00
Paul Gschwendtner
1312eb1600 build: remove irrelevant madge circular deps tests (#61209)
We don't need this tooling anymore because we are already validating
that there are no circular dependencies via the `ng-dev` tooling that
checks `.ts` files directly.

Also these tests never actually failed to my knowledge.

PR Close #61209
2025-05-08 09:23:47 -07:00
Vlad Boisa
c081e040f6 docs: fix non-working link (#61131)
Swap non-working @link to just usual `` link to work


Same like #61011
PR Close #61131
2025-05-06 14:11:26 -07:00
Kristiyan Kostadinov
4623b61448 fix(core): missing useExisting providers throwing for optional calls (#61152)
Fixes that the runtime was throwing a DI error when attempting to inject a missing `useExisting` provider, despite the call being optional.

The problem was that when the provider has `useExisting`, we do a second `inject` call under the hood which didn't include the inject flags from the original call.

Fixes #61121.

PR Close #61152
2025-05-06 14:06:24 -07:00
Jan Martin
a6f0d5bc20 fix(platform-server): less aggressive ngServerMode cleanup (#61106)
Other code may depend on `ngServerMode` and it might have been set
globally / via a bundler. Forcing it to `undefined` in those situations
can lead to hard debug issues where the only symptom is that "suddenly"
browser-specific code paths run on the server and (obviously) break.

PR Close #61106
2025-05-06 09:08:48 -07:00
Joey Perrott
437023b022 build: set up ts_project interop for rules_js migration (#61088)
The `ts_project` interop rule that we've built was also used in the
Angular CLI migration, and it allows us to mix `ts_project` and
`ts_library` targets; enabling an incremental migration. Additionally
set up the `ng_project` to replace `ng_module`.

PR Close #61088
2025-05-02 09:14:17 -07:00
Joey Perrott
e117d0f4eb build: setup rules_ts for compiling TypeScript sources (#61088)
This commit sets up `rules_ts`, providing the `ts_library` equivalent
for the `rules_js` migration.

PR Close #61088
2025-05-02 09:14:17 -07:00
Foysol Ahmed
968546976d docs: ViewContainerRef.createComponent jsdoc update (#61097)
Co-authored-by: Jessica Janiuk <1596273+thePunderWoman@users.noreply.github.com>
PR Close #61097
2025-05-02 07:57:11 -07:00
KryptonBD
8c6e101a61 docs: ViewContainerRef.createComponent jsdoc update to reflect actual behavior (#61097)
Fixes #59918

PR Close #61097
2025-05-02 07:57:11 -07:00
arturovt
89056a0356 fix(common): cleanup updateLatestValue if view is destroyed before promise resolves (#61064)
Patch version of https://github.com/angular/angular/pull/58041.

PR Close #61064
2025-05-01 14:57:04 -07:00
arturovt
5b77f93267 refactor(common): drop platform checks in HttpXsrfCookieExtractor (#59810)
Replaces `PLATFORM_ID` checks with `ngServerMode` within the `HttpXsrfCookieExtractor`. It is not part of the public API, and thus this change should not affect consumers who may have called the constructor directly.

PR Close #59810
2025-05-01 08:41:11 -07:00
arturovt
c6148bd4f0 refactor(service-worker): drop error messages in production (#59702)
This commit provides tree-shakable error messages for the `service-worker` package.

PR Close #59702
2025-04-30 12:41:37 -07:00
arturovt
964b261a86 refactor(compiler): improve stringify (#60013)
This is the same change that was made in this commit (cf3a5073ec). See its description for clarification.

PR Close #60013
2025-04-30 12:40:03 -07:00
arturovt
075145ef93 refactor(core): tree-shake PROPAGATION_STOPPED_SYMBOL (#61004)
Adds `__PURE__` annotations to `PROPAGATION_STOPPED_SYMBOL` to enable tree-shaking, even if is is not referenced. This variable is not dropped when Angular is imported from a module that has `sideEffects` set to `true`.

PR Close #61004
2025-04-30 12:38:45 -07:00
Alan Agius
400dbc5b89 fix(core): properly handle app stabilization with defer blocks (#61056)
Previously, the app was marked as stable prematurely. For more details, see https://github.com/angular/angular/issues/61038#issuecomment-2837917180

Closes: #61038
(cherry picked from commit de649c9cfd)

PR Close #61056
2025-04-30 12:02:03 -07:00
arturovt
2e140a136a fix(core): prevent stash listener conflicts [patch] (#61063)
Patch version of https://github.com/angular/angular/pull/59635.

PR Close #61063
2025-04-30 09:23:19 -07:00
arturovt
dbb87026ca fix(core): call DestroyRef on destroy callback if view is destroyed [patch] (#61061)
Patch version of 5f7f04634f

PR Close #61061
2025-04-30 08:52:25 -07:00
cexbrayat
59050900a0 refactor(core): remove unused APP_EFFECT_SCHEDULER in effect code (#59679)
The `APP_EFFECT_SCHEDULER` Injection token is never used and not a public API.

PR Close #59679
2025-04-30 08:49:56 -07:00
Matthieu Riegler
a554208651 build: Run browsers tests without platform-browser-dynamic (#60937) (#61060)
Use the regular `platform-browser` providers instead.

PR Close #61060
2025-04-30 08:21:03 -07:00
vladboisa
0ee1a6e593 docs: add link label & paragraph for correct display (#60708)
PR Close #60708
2025-04-30 08:18:08 -07:00
vladboisa
770587a755 docs: add Security-DomSanitizer link in ElemnetRef&Renderer2 (#60708)
Renderer2 and ElementRef didn't mention the Security-DomSanitizer method, this will add clarity for potential user what to expect. Also swap deprecated "callout" class to docs-alert

Fixes #51208 , #46904

PR Close #60708
2025-04-30 08:18:08 -07:00