Compare commits

...

1503 Commits

Author SHA1 Message Date
Andrew Scott 58ee039d5e release: cut the v18.1.2 release 2024-07-24 10:53:25 -07:00
Matthieu Riegler 3d0ee73892 docs(docs-infra): Use shiki for code highlighting (#57059)
PR Close #57059
2024-07-24 10:24:52 -07:00
Matthieu Riegler 8bb5937e71 docs(docs-infra): disable experimental decorators (#56257)
Also enable useDefineForClassFields and disable downlevelIteration

PR Close #56257
2024-07-24 10:18:22 -07:00
Andrew Scott c969422da0 Revert "fix(router): Scroller should scroll as soon as change detection completes (#55105)" (#57115)
This reverts commit 66ffeca2de.

It looks like nuxt encountered the same issue with scrolling when
waiting for Vue's `nextTick`, which is a microtask. This would have
similar timing to ZoneJS's rendering in the microtask queue. This
reverts to a `setTimeout` alone, though recreates the problem in #53985.
This was also mentioned in one of the comments in the Nuxt issue and the
solution would be `rAF`.

In order to address #53985, we'd likely want to use the `race(rAF, setTimeout)`
that we use in the zoneless and coalescing schedulers. This would have effectively the same timing as
the `afterNextRender` implementation here with zoneless, but quite
different timing to `afterNextRender` with ZoneJS.

fixes #57109

PR Close #57115
2024-07-24 10:04:38 -07:00
Tom Wilkinson 1a606b0bfc refactor(core): Switch to using concat rather than spread operator for events. (#57103)
Internally, the JSCompiler does not dead code eliminate this code when its using spread.

PR Close #57103
2024-07-23 15:54:23 -07:00
Andrew Scott 288a4fac01 test(docs-infra): fix test with slight adjustment to error handling (#57104)
The test was broken because multiple errors happen and the last error would be the displayed message.
However, in this case, those errors happen because the initial one already terminated the container
so the follow-up errors are a result of the service being in an unexpected state

PR Close #57104
2024-07-23 15:45:55 -07:00
Andrew Scott 889a02b1c3 test(docs-infra): update adev tests to be zoneless (#57100)
Updates adev tests to use zoneless and remove
fakeAsync/waitForAsync/tick

PR Close #57100
2024-07-23 14:50:32 -07:00
Angular Robot 23fa43d044 build: update all non-major dependencies (#57092)
See associated pull request for more information.

PR Close #57092
2024-07-23 12:18:34 -07:00
Angular Robot c979dfd462 build: update github/codeql-action action to v3.25.13 (#57091)
See associated pull request for more information.

PR Close #57091
2024-07-23 10:29:17 -07:00
Andrew Scott 915b0e0b16 Revert "fix(compiler-cli): add warning for unused let declarations (#57033)" (#57088)
This reverts commit c76b440ac0.

PR Close #57088
2024-07-22 15:28:04 -07:00
JoostK 463945003d fix(compiler): limit the number of chained instructions (#57069)
Some Angular template instructions that follow each other may be chained
together in a single expressions statement, containing a deeply nested
AST of call expressions. The number of chained instructions wasn't previously
limited, so this could result in very deep ASTs that cause stack overflow
errors during TypeScript emit.

This commit introduces a limit to the number of chained instructions to
avoid these problems.

Closes #57066

PR Close #57069
2024-07-22 11:50:12 -07:00
Rushikesh Kavar 06ae22680e docs: Update packages/router/src/router.ts (#57053)
Co-authored-by: Andrew Scott <atscott01@gmail.com>
PR Close #57053
2024-07-22 10:52:36 -07:00
Rushikesh Kavar f917b6e4d0 docs: Update packages/router/src/router.ts (#57053)
Co-authored-by: Andrew Scott <atscott01@gmail.com>
PR Close #57053
2024-07-22 10:52:36 -07:00
Rushikesh Kavar 87d042ba8a docs: adding reference to RouterModule.forroot method in Router service for better understanding for beginner (#57053)
PR Close #57053
2024-07-22 10:52:36 -07:00
Rushikesh Kavar 4b561f8f35 docs: Adding Router service hierarchical injection level (#57053)
PR Close #57053
2024-07-22 10:52:36 -07:00
Kristiyan Kostadinov b9fb98c67c fix(core): tree shake dev mode error message (#57035)
Adds an `ngDevMode` check before a runtime error message.

Fixes #57034.

PR Close #57035
2024-07-22 10:49:18 -07:00
xpl0siv 8a005eada5 docs: fix push-notifications.md (#57065)
Added missing comma at actions notifications example.
SyntaxError:
Expected ',' or ']' after array element in JSON at position 255

PR Close #57065
2024-07-22 10:46:56 -07:00
Salanoid ae15dd94ef docs: fixing dead link (#57077)
Fixing guide dead link for issue #57067.

PR Close #57077
2024-07-22 09:58:42 -07:00
Angular Robot 7792aad8da build: update babel dependencies (#57045)
See associated pull request for more information.

Closes #56996 as a pr takeover

PR Close #57045
2024-07-19 13:46:00 -07:00
Thomas Nguyen 142c2dffb0 refactor(core): Allow manual renderer listens to contribute to event delegation as well. (#56799)
There are existing usages that inject the renderer to manualy listen (often for event
delegation purposes). These should contribute as well.

PR Close #56799
2024-07-19 13:42:26 -07:00
Ashish Deshpande 56f0fc1f9f docs: update broken link to version updates in versionEvent (#56870) (#56870)
PR Close #56870
2024-07-19 13:41:54 -07:00
Matthieu Riegler 9e52c1c840 fix(core): afterNextRender hooks return that callback value. (#57031)
`afterRender` was working fine but `afterNextRender` wasn't

PR Close #57031
2024-07-19 13:41:00 -07:00
Kristiyan Kostadinov e904f34020 fix(compiler-cli): add warning for unused let declarations (#57033)
Adds a new extended diagnostic that will flag `@let` declarations that aren't used within the template. The diagnostic can be turned off through the `extendedDiagnostics` compiler option.

PR Close #57033
2024-07-19 11:50:32 -07:00
Matthieu Riegler be16d7fcc3 docs: fix filtering on API reference (#57057)
With the input binding, the `type` can become `undefined`

PR Close #57057
2024-07-19 11:49:05 -07:00
Matthieu Riegler 04c504ab40 docs: fix pipes link (#52979)
fixes #52968

PR Close #52979
2024-07-18 18:05:07 -07:00
Matthieu Riegler 91483ab5b3 docs(docs-infra): filter types (#52979)
PR Close #52979
2024-07-18 18:05:07 -07:00
Matthieu Riegler e088c80854 docs(docs-infra): update tutorial deps to 18.1 (#57024)
lockfile were still loading 18.0 but TS was already at 5.5 which 18.0 doesn't support

PR Close #57024
2024-07-18 15:27:24 -07:00
Sheik Althaf 14d442a6c3 refactor(devtools): use signal api in property view (#56995)
Refactor the property view components to use signal apis, in future we
can make the components onPush and zoneless

PR Close #56995
2024-07-18 15:23:32 -07:00
Matthieu Riegler 1999e31851 docs: Add @let block entry to the API (#57027)
PR Close #57027
2024-07-18 15:22:42 -07:00
qshurick f1349e1d0f docs: Update service code snippet (#57036)
Snippet was missing import for the function and failed when copied to the test
project

PR Close #57036
2024-07-18 15:21:32 -07:00
Tom Wilkinson f3014c5392 refactor(core): Move logic into early event contract files. (#56994)
Also remove some dead a11y code, now that a11y is in `ActionResolver`.

PR Close #56994
2024-07-18 12:05:18 -07:00
Fred Sauer bbabf5451a docs: fix headings and code font in @for docs (#57007)
- Fix "Syntax" and "Description" h2 headings
- Fix code font in h3 headings

PR Close #57007
2024-07-18 11:07:43 -07:00
Tomek Sułkowski edbb403171 docs(docs-infra): add open in StackBlitz button to code editor (#57018)
PR Close #57018
2024-07-18 08:41:35 -07:00
Matthieu Riegler d3e14b35d3 docs(docs-infra): no prefix for the current major (#56882)
To allow navigation back from next.angular.dev, the current major uses no prefix.

fixes #56868

PR Close #56882
2024-07-18 08:40:09 -07:00
Andrew Scott 4bfe707ac2 release: cut the v18.1.1 release 2024-07-17 13:05:52 -07:00
Alan Agius 4f11d6eee2 fix(zone.js): support Timeout.refresh in Node.js (#56852)
The `Timeout` object in Node.js has a `refresh` method, used to restart `setTimeout`/`setInterval` timers. Before this commit, `Timeout.refresh` was not handled, leading to memory leaks when using `fetch` in Node.js. This issue arose because `undici` (the Node.js fetch implementation) uses a refreshed `setTimeout` for cleanup operations.

For reference, see: https://github.com/nodejs/undici/blob/1dff4fd9b1b2cee97c5f8cf44041521a62d3f133/lib/util/timers.js#L45

Fixes: #56586

PR Close #56852
2024-07-16 12:46:52 -07:00
Matthieu Riegler a1cb9dfc0d fix(common): Don't run preconnect assertion on the server. (#56213)
The `window` global is patched by domino on the server but the value of `window.location.href` isn't a valid base.

Before this change `getUrl()` would throw when running in devmode on the server.

Fixes #56207

PR Close #56213
2024-07-16 09:53:33 -07:00
Matthieu Riegler f02f351cda docs: Expose $localize in the @angular/localize/init entry. (#55345)
fixes #54388

PR Close #55345
2024-07-16 08:43:53 -07:00
homerlsy e9837c94d0 docs: update structural-directives.md select to [select] (#56955)
this custom directive's selector should be [select]
PR Close #56955
2024-07-16 08:42:59 -07:00
Kristiyan Kostadinov 5682527d94 fix(core): not all callbacks running when registered at the same time (#56981)
Fixes that only the first callback was firing when multiple are registered in the same call to `afterNextRender`, e.g. `afterNextRender({earlyRead: fn, read: fn});`

Fixes #56979.

PR Close #56981
2024-07-16 08:42:26 -07:00
Angular Robot 4c1f3cf843 build: update github/codeql-action action to v3.25.12 (#56997)
See associated pull request for more information.

PR Close #56997
2024-07-16 08:41:58 -07:00
Kristiyan Kostadinov daf0317bdc fix(compiler): JIT mode incorrectly interpreting host directive configuration in partial compilation (#57002)
Fixes that the runtime implementation of `ɵɵngDeclareDirective` was interpreting the `hostDirectives` mapping incorrectly. Instead of treating the inputs/outputs as `['binding', 'alias']` arrays, it was parsing them as `['binding: alias']`. This was leading to runtime errors if a user is consuming a partially-compiled library in JIT mode.

Fixes #54096.

PR Close #57002
2024-07-16 08:37:26 -07:00
sihyunjojo 6cfc4d8c85 docs: change code formatting for better readability (#56974)
This change improves the consistency and visibility of the documentation by using backticks for code formatting in the instructions.

PR Close #56974
2024-07-15 12:05:44 -07:00
Angular Robot da9149ea10 build: update dependency inquirer to v10 (#56883)
See associated pull request for more information.

PR Close #56883
2024-07-15 11:49:27 -07:00
Matthieu Riegler bbe655ff14 refactor(compiler): include public constructor paramters to class properties. (#56315)
Public properties declared in the constructor are part of the public API and we should extract them.

Fixes #56310

PR Close #56315
2024-07-15 11:39:22 -07:00
Ben Hong 7c0a7a02c0 docs: add quick installation page (#56816)
PR Close #56816
2024-07-15 11:37:57 -07:00
Angular Robot 35b2728994 build: update actions/upload-artifact action to v4.3.4 (#56905)
See associated pull request for more information.

PR Close #56905
2024-07-15 11:35:00 -07:00
Angular Robot 653e898f78 build: update io_bazel_rules_sass digest to 83022b9 (#56954)
See associated pull request for more information.

PR Close #56954
2024-07-15 11:34:26 -07:00
Matthieu Riegler c0855f0e25 build: update material / cdk (#56960)
Material 18.1 includes a fix we were waiting for adev.

Fixes #56786

PR Close #56960
2024-07-15 11:23:40 -07:00
Kristiyan Kostadinov c94a897248 fix(compiler-cli): avoid emitting references to typecheck files in TS 5.4 (#56961)
In #56358 we removed most of the places that untag the references to typecheck files, because it was causing the compiler to throw error when it produces diagnostics. This appears to have caused a regression in TS 5.4 which now emits the synthetic references.

These changes add tagging right before the program emits.

Fixes #56945.

PR Close #56961
2024-07-15 11:22:00 -07:00
Jessica Janiuk b666d2c20f fix(migrations): fix common module removal (#56968)
This fixes the case that common module is removed on a second run of the migration. We were not looking at block parameters for common module usage.

PR Close #56968
2024-07-15 11:17:46 -07:00
Matthieu Riegler 634d55a4f6 refactor(compiler-cli): Extract call signatures from interfaces. (#56973)
This commit adds support for extracting call signals from interfaces.

fixes #56969

PR Close #56973
2024-07-15 11:08:00 -07:00
Matthieu Riegler 5c08ae68ad ci: add an entry for aio in the pullapprove config (#56952)
This would allow me & ben to review some of the changes on the 17.3 branch, for example the redirections.

PR Close #56952
2024-07-11 17:03:26 -07:00
Matthieu Riegler 60df722d29 docs(docs-infra): focus api search filter on non-touch devices (#56294)
PR Close #56294
2024-07-11 12:05:34 -07:00
Paul Gschwendtner a531106578 build: fix rate limits when deploying angular.dev site (#56929)
This commit fixes that the angular.dev deployment is subject
to GitHub API rate limiting due to lack of an access token.

This commit fixes this, similar to how we fixed it in
`angular/components`. The token is pure read-only.

PR Close #56929
2024-07-11 08:54:51 -07:00
Tomer953 d7dca6dbb6 fix(compiler): use strict equality for 'code' comparison (#56944)
Replace loose equality (==) with strict equality (===) for the 'code' variable.
This change ensures type safety and prevents unintended type coercion.
PR Close #56944
2024-07-11 08:52:58 -07:00
Matthieu Riegler f6eec4813f build: update deps (#56946)
Updating `build-tooling` and `docs`.

PR Close #56946
2024-07-11 08:52:28 -07:00
Andrew Kushnir 94c6ec0221 docs: fixing links to guides on the Performance Overview page (#56942)
PR Close #56942
2024-07-10 17:06:08 -07:00
Tom Wilkinson a7b774c4a2 refactor(core): Refactor EarlyEventContract to prepare for using it as a container. (#56900)
This is the first step towards combining `EarlyEventContract` and `EventContract`. It contains a few refactors, such as making names more consistent.

The goal of this refactor is to remove the `EarlyEventContract` class altogether, as well as `EventContract`.

To install the early event contract with the default events in early script tag, users will call:

`bootstrapGlobalEarlyEventContract()`

And for boostraping:

`registerGlobalDispatcher(dispatcher)`

PR Close #56900
2024-07-10 13:53:04 -07:00
Michael van der Luit 5673f6b04d docs: move public folder to workspace configuration section (#56931)
move the public folder entry from the application project files section to the workspace configuration files section

PR Close #56931
2024-07-10 13:52:06 -07:00
Ben Hong aedf8322b0 docs: add overview page for performance section (#56828)
PR Close #56828
2024-07-10 18:17:05 +02:00
Angular Robot e076eb2ae6 build: update actions/upload-artifact action to v4.3.4 (#56906)
See associated pull request for more information.

PR Close #56906
2024-07-10 17:28:33 +02:00
Angular Robot aa08ecc538 build: update io_bazel_rules_sass digest to ea6b195 (#56917)
See associated pull request for more information.

PR Close #56917
2024-07-10 17:24:58 +02:00
Tom Wilkinson 4b82b9815d refactor(core): Remove unused A11Y_CLICK_SUPPORT define. (#56901)
This behavior was moved to be configured by a runtime boolean, rather
than a define.

PR Close #56901
2024-07-10 15:50:39 +02:00
Matthieu Riegler bbbaf7a1b8 docs(docs-infra): fix z-index issue on mobile (#56874)
fixes #56871

PR Close #56874
2024-07-10 15:48:42 +02:00
Matthieu Riegler 729bf5b828 docs: fix testing angular url (#56847)
PR Close #56847
2024-07-10 15:18:12 +02:00
Pawel Kozlowski 07a0b87a4c release: cut the v18.1.0 release 2024-07-10 15:00:47 +02:00
Harish Krishnan 551ffbf9f2 docs: Update components-scenarios.md (#56921)
Fix grammatical issues

PR Close #56921
2024-07-10 11:29:17 +02:00
cexbrayat 4d87b9e899 fix(core): rename the equality function option in toSignal (#56769) (#56922)
The option introduced in 5df3e78c99 has been named `equals` whereas the existing option in `signal` is named `equal`.
This commit renames the new option to `equal` as well to keep the naming coherent across these APIs.

PR Close #56769

PR Close #56922
2024-07-10 11:09:07 +02:00
Matthieu Riegler 0da9eae24c docs: update version table for 18.1 (#56920)
PR Close #56920
2024-07-10 09:34:48 +02:00
Andrew Scott 15d2e8d54c docs: Update component testing scenarios (#56388)
This update goes through half of the component-scenarios guide and makes
relevant updates to examples.

Updates include:

* Use signals in examples
* Advise and use `await fixture.whenStable` more frequently than
  `detectChanges`
* Use and advise mocks and spies more sparingly
* Remove `waitForAsync` and jasmine `done` guidance - The ecosystem has evolved
  and these aren't needed
* Remove marble testing for rxjs - this belongs in rxjs documentation,
  not in Angular
* Remove class-only component testing. This approach is not advisable
  for components.

related to #48510

PR Close #56388
2024-07-10 09:11:21 +02:00
Marcos Paulo dos Santos 3a453d6040 docs: update compat table with 13.4.x (#56915)
PR Close #56915
2024-07-10 09:10:29 +02:00
Andrew Scott 8bd4c074af fix(core): toSignal equal option should be passed to inner computed (#56903)
The user-defined equality function needs to be passed to the inner
computed it will still use `Object.is` and prevent notifications.

PR Close #56903
2024-07-09 19:52:18 +02:00
Jessica Janiuk 5f97d6aec2 fix(migrations): Fix cf migration let condition semicolon order (#56913)
In rare cases people may put let statements before else statements and omit semicolons, causing migration issues.

PR Close #56913
2024-07-09 18:17:52 +02:00
Matthieu Riegler 2f8bf933f4 refactor(compiler-cli): escape missing decorators. (#56794)
Escaping decorators is required as else they are considered as new JSDocs tags.

fixes #56569

PR Close #56794
2024-07-09 13:13:53 +02:00
Ofer Segev ae9505b702 docs: update dependency-injection-context.md (#56736)
HeroService is not part of this example, and is only introduced in the next example. Use type Service1 for this.service1, as its type
PR Close #56736
2024-07-09 13:05:57 +02:00
Matthieu Riegler 0f4219cf0c refactor(platform-server): Add private profiler. (#56274)
The commit adds a private profiler to investigate SSR performance.

PR Close #56274
2024-07-09 12:47:46 +02:00
Kristiyan Kostadinov f689214178 docs: fix wrong link in template overview (#56911)
One of the links added in #56886 was incomplete.

PR Close #56911
2024-07-09 12:13:12 +02:00
Daniel Puckowski aef166f763 fix(compiler): fix CSS animation rule scope (#56800)
It is valid CSS to list keyframe names in an animation declaration only
separating the names with a comma and no whitespace. This is typical of
production builds. Updated a couple of regexes and added a couple of
tests to account for this scenario.

Fixes #53038

PR Close #56800
2024-07-09 09:44:56 +02:00
Kristiyan Kostadinov 02f5e73a8d docs: add documentation page for let declarations (#56886)
Adds a docs page for the new `@let` syntax in Angular 18.1.

PR Close #56886
2024-07-09 09:38:23 +02:00
Matthieu Riegler 20f5e1291e docs: add a FAQ on how to find the LCP image (#56779)
PR Close #56779
2024-07-09 09:37:20 +02:00
Andrew Kushnir 8adc6b9425 test(core): simplify @defer-based test to make CI more stable (#56904)
This commit updates one of the `@defer`-based test to use the `on immediate` trigger to make a test mor
e stable without the need to add mocks for the `on idle` (default) condition.

PR Close #56904
2024-07-09 09:36:12 +02:00
vladboisa 35fa9b0f77 docs(docs-infra): add missing context with link (#56896)
Added missing link documenting ng global features.

Fixes #56488

PR Close #56896
2024-07-08 18:04:00 +02:00
Paul Gschwendtner 56ec97d2e1 refactor(compiler-cli): do not truncate/reduce types in API docs (#56572)
Fixes that e.g. signal input APIs docs were removing `undefined` from
the shorthand `input<T>()` documentation.

PR Close #56572
2024-07-08 16:26:40 +02:00
Matthieu Riegler ba325c59c0 docs: remove private symbol from docs (#56851)
fixes #56850

PR Close #56851
2024-07-08 09:54:14 +02:00
Charles Lyding 447a36ef95 refactor(localize): reduce deep imports in ng add schematic (#56839)
The `@angular/schematic` package has a `utility` export path which can be
used to access common utility rules and helpers. The previous deep imports
into the `@angular/schematic` package have been switched to the actual
export path where possible. This lowers the potential for breakage from
internal package changes.

PR Close #56839
2024-07-08 09:51:53 +02:00
Sasidharan SD 8326e62313 docs: fix previous configuration link (#56880)
PR Close #56880
2024-07-08 09:48:02 +02:00
cexbrayat 9b35726e42 fix(common): typo in warning for NgOptimizedDirective (#56817)
The warning message for the `PLACEHOLDER_DIMENSION_LIMIT_EXCEEDED` check has a repetition of `of`.

PR Close #56817
2024-07-05 13:03:56 +02:00
Kristiyan Kostadinov cdebf751e4 fix(compiler-cli): used before declared diagnostic not firing for control flow blocks (#56843)
When we process `@if` and `@for` blocks, we create a scope around their expressions in order to encapsulate the aliases to them. The problem is that this doesn't represent the actual structure since the expression is part of the outer scope. This surfaces by not raising the "used before declared" diagnostic for `@let` declarations.

These changes resolve the issue by processing the expression as a part of the parent scope.

Fixes #56842.

PR Close #56843
2024-07-05 13:02:58 +02:00
Kristiyan Kostadinov 66e582551e fix(compiler-cli): avoid duplicate diagnostics for let declarations read before definition (#56843)
Fixes that in some cases `@let` declarations that are read before they're defined were producing multiple diagnostics.

PR Close #56843
2024-07-05 13:02:58 +02:00
Dan Nisenson 1efe907881 docs: fix broken link (#56848)
fix link @ /guide/forms/reactive-forms#reactive-forms-api-summary
prev: /api/forms
current: /api#forms

PR Close #56848
2024-07-05 12:27:35 +02:00
Corbin Crutchley 1074134d4b docs: add window title to reference pages (#56840)
PR Close #56840
2024-07-04 14:29:29 +02:00
Alan Agius ecc56447b9 perf(http): execute fetch outside of Angular zone (#56820)
In this update, the fetch backend now executes fetch operations outside of the Angular zone. This adjustment primarily aims to decrease Continuous Delivery (CD) cycles on Node.js. The decision was influenced by Undici, the Node.js fetch implementation, which relies on `setTimeouts` to manage response timeouts.

PR Close #56820
2024-07-04 12:10:35 +02:00
Michael van der Luit 85da4b3b2a docs: update app-shell docs to reflect v17 (#56836)
Fixes the build commands as previously mentioned here: https://github.com/angular/angular/pull/52294

PR Close #56836
2024-07-04 11:32:14 +02:00
Harish Krishnan 3fa21cbbc5 docs: Update image-optimization.md (#56819)
Fix the mistyped attribute rel
PR Close #56819
2024-07-04 09:56:18 +02:00
Matthieu Riegler 1ee64a5c45 refactor(common): Fire priority check on stable. (#56776)
To support routing on app init, the directive will now fire the priority check when the apps become stable.

fixes #56757

PR Close #56776
2024-07-03 14:40:48 +00:00
Andrew Kushnir 3235d6d6dd fix(core): establish proper defer injector hierarchy for components attached to ApplicationRef (#56763)
This commit updates the logic that create an injector for defer blocks (when it's needed) to account for a situation when a component is instantiated without a connection to the current component tree. This can happen if a component is created using its factory function or via `createComponent()` call.

Resolves #56372.

PR Close #56763
2024-07-03 14:08:44 +00:00
Krishna Sahu 6ad2fe6ab0 docs: add toSignal import inside the demo example (#56804)
PR Close #56804
2024-07-03 14:07:51 +00:00
komura-c 0e0fb7bb61 docs: fix missing image and baseUrl in tutorials/first-app (#56766)
PR Close #56766
2024-07-02 20:21:41 +00:00
Andrew Kushnir 8a0a00e212 docs: add Event Replay section to the Hydration guide (#56770)
PR Close #56770
2024-07-02 20:19:53 +00:00
Matthieu Riegler 092bfe95cc fix(core): support injection of object with null constructor. (#56553)
This is debug only code, it shouldn't have any consequences on prod build.

fixes #56552

PR Close #56553
2024-07-02 17:33:32 +00:00
Andrew Scott c4384bf269 fix(router): routes should not get stale providers (#56798)
This fixes a bug with RouterOutlet and its context where it would reuse
providers from a previously activated route.

fixes #56774

PR Close #56798
2024-07-02 17:10:52 +00:00
Angular Robot 52852abb56 build: update github/codeql-action action to v3.25.11 (#56803)
See associated pull request for more information.

PR Close #56803
2024-07-02 13:04:27 -04:00
Ben Hong 0f612dcaf8 docs: update playground app to use hello world for easier onboarding (#56813)
PR Close #56813
2024-07-02 12:57:31 -04:00
Ben Elliott 9acccb11ff docs: Update interceptors.md to replace public class with export class in DI section (#56807)
PR Close #56807
2024-07-02 16:44:12 +00:00
Ben Hong e914767efb docs: add documentation aroun build error for docs (#56814)
PR Close #56814
2024-07-02 16:43:07 +00:00
Angular Robot 58be8e6bf8 build: update all non-major dependencies (#56801)
See associated pull request for more information.

PR Close #56801
2024-07-02 15:26:28 +00:00
Pawel Kozlowski 9cc4dbeadd refactor(common): remove remaining code for NgSwitch equality patch (#56806)
This change is the final cleanup after removing NgSwitch's equality patch
that was used in G3 to allow == matching for a certain period of time. This
code is no longer needed as both the external ecosystem and G3 are using
=== equality for matching NgSwitch cases.

PR Close #56806
2024-07-02 14:16:24 +00:00
Jessica Janiuk 7f5d70a74a release: cut the v18.1.0-rc.0 release 2024-07-01 14:01:57 -07:00
Thomas Nguyen 3d1bc5a51e refactor(core): Add an ngOnDestroy to GlobalEventDelegation. (#56762)
It seems that this makes test libs that contain > 1 test file pass.

PR Close #56762
2024-07-01 20:33:17 +00:00
Enea Jahollari fd6cd0422d feat(compiler): Add extended diagnostic to warn when there are uncalled functions in event bindings (#56295)
The diagnostic will catch issues like:

```html
<button (click)="increment"></button>
<button (click)="increment; decrement"></button>
<button (click)="true ? increment : decrement"></button>
<button (click)="nested.nested1.nested2.increment"></button>
```

PR Close #56295
2024-07-01 20:31:19 +00:00
Andrew Kushnir a0fbd0e5e1 docs: update 18.1.0 release date (#56789)
PR Close #56789
2024-07-01 19:37:33 +00:00
Joey Perrott b4cc8d4a8e ci: upload build artifacts on each pr run (#56787)
Upload the snapshot build artifacts to each pr run to use for testing.

PR Close #56787
2024-07-01 18:48:57 +00:00
Matthieu Riegler f407e3ce6f refactor(common): allow string urls in NgOptimizedImage input (#54901)
With this commit it is now possible to pass an url as placeholder for the image directive.

PR Close #54901
2024-07-01 18:13:24 +00:00
Kristiyan Kostadinov 341a116d61 fix(compiler): allow more characters in let declaration name (#56764)
Fixes that `@let` didn't allow $ in its name, even though JS identifiers allow it.

PR Close #56764
2024-07-01 18:12:53 +00:00
Thomas Nguyen 551027e04e refactor(core): Set the jsaction cache directly instead of using jsaction attribute. (#56747)
This should make things somewhat faster, since setAttribute can be slower than addEventListener. Jsaction attribute is still needed for SSR though.

PR Close #56747
2024-07-01 17:31:24 +00:00
Alex Rickabaugh 46b0292261 refactor(core): export additional methods from primitives/signals (#56759)
Export `producerIncrementEpoch` which was missing before, as well as a new
`runPostSignalSetFn` helper. These changes make it easier to write `signal`-
like utilities which don't use the `createSignal` abstraction.

PR Close #56759
2024-07-01 14:39:44 +00:00
Kristiyan Kostadinov 2a1291e942 fix(compiler): give precedence to local let declarations over parent ones (#56752)
Currently the logic that maps a name to a variable looks at the variables in their definition order. This means that `@let` declarations from parent views will always come before local ones, because the local ones are declared inline whereas the parent ones are hoisted to the top of the function.

These changes resolve the issue by giving precedence to the local variables.

Fixes #56737.

PR Close #56752
2024-07-01 14:03:57 +00:00
Kristiyan Kostadinov 4d18c5bfd5 fix(compiler-cli): flag all conflicts between let declarations and local symbols (#56752)
Expands the check around conflicting `@let` declarations to also cover template variables and local references.

PR Close #56752
2024-07-01 14:03:57 +00:00
Kristiyan Kostadinov 5996502921 fix(compiler-cli): type check let declarations nested inside nodes (#56752)
Fixes that we were only capturing `@let` declarations at the top level of the scope, not any of the nested children.

PR Close #56752
2024-07-01 14:03:57 +00:00
Harish Krishnan aad3c2da6e docs: Update structural-directives.md (#56753)
PR Close #56753
2024-07-01 14:03:24 +00:00
Harish Krishnan 4017f72e8c docs: Update rxjs-interop.md (#56771)
Fix grammatical error
PR Close #56771
2024-07-01 14:02:46 +00:00
Kristiyan Kostadinov 5dc6deca85 build: update docs infra package (#56758)
Updates to the latest docs infra code to fix an issue with generating the `hiddenFiles` field.

PR Close #56758
2024-07-01 13:43:10 +00:00
Jessica Janiuk ecd5e6b754 ci: update pullapprove primitives list (#56761)
This removes one user from the shared primitives group to fix pullapprove requests.

PR Close #56761
2024-06-28 21:07:59 +00:00
cexbrayat f25653e231 fix(common): typo in NgOptimizedImage warning (#56756)
A space is missing in the warning message for `TOO_MANY_PRIORITY_ATTRIBUTES`.

PR Close #56756
2024-06-28 18:38:25 +00:00
Kristiyan Kostadinov ceaaa9815b build: update to latest docs tooling to resolve missing answers (#56746)
Updates to the latest version of `@angular/docs` which should include a fix for the missing answers in the tutorials.

PR Close #56746
2024-06-27 21:17:38 +00:00
Andrew Scott ed2665a74d docs: fix indentation on control flow documentation page (#56748)
This fixes the indentation on the examples in the control flow docs

fixes #56745

PR Close #56748
2024-06-27 19:55:48 +00:00
Tom Wilkinson 040d86137e refactor(core): Remove dom.ts and use native Element.prototype.contains. (#56591)
Delete the entire dom.ts file, it is no longer needed.

PR Close #56591
2024-06-27 18:28:19 +00:00
Tom Wilkinson 3773f406ac refactor(core): Remove ActionResolver code from EventContract (#56723)
Now that all `Dispatcher` implementations use `ActionResolver`, `EventContract` no longer needs to. Additionally, all a11y click support has been removed. `EventContract` will not specifically listen for `keydown` automatically, as all `EventContract` instances already have `keydown` listeners. This removes the need for the `A11Y_CLICK_SUPPORT` define, which will be removed in a future PR.

PR Close #56723
2024-06-27 18:27:44 +00:00
Tom Wilkinson 60a72af163 refactor(core): Remove attribute, char, and property values for ActionFlow. (#56590)
These values are inlined in ActionFlow internally in google3, and are no longer used.

Do some additional cleanup to only define the properties once.

PR Close #56590
2024-06-27 18:27:15 +00:00
Sasidharan SD 0cfd13c671 docs: fix cold observable and frames link (#56742)
PR Close #56742
2024-06-27 18:26:25 +00:00
Andrew Kushnir 917cd14bb4 ci: add more team members into the public-api group (#56743)
This commit adds more team members into the `public-api` group, so that they can approve public API changes, but they would not be requested for reviews by PullApprove (to avoid requests for unrelated changes).

PR Close #56743
2024-06-27 18:24:43 +00:00
Andrew Kushnir 344775344b Revert "fix(common): Don't run preconnect assertion on the server. (#56213)" (#56740)
This reverts commit 39e48ce675.

PR Close #56740
2024-06-27 17:44:42 +00:00
Paul Gschwendtner 2d8a96b684 refactor(compiler-cli): support running JIT transforms as part of tsickle emit (#56520)
When running the JIT transforms in 1P w/ tsickle, tsickle will
transform source files before our custom transforms can run. This is
also impacting the Ivy transform and hence we use `ts.getOriginalNode`
in various places to inspect the source AST for detecting Angular.

For the JIT transform we need to do a similar change so that the
transform could run in 1P.

PR Close #56520
2024-06-27 15:55:18 +00:00
Matthieu Riegler e618521a57 docs: replace @link with absolute link. (#56557)
Currently `@link` doesn't work for cross-package references.

Fixes #56556

PR Close #56557
2024-06-27 15:54:47 +00:00
Matthieu Riegler 39e48ce675 fix(common): Don't run preconnect assertion on the server. (#56213)
The `window` global is patched by domino on the server but the value of `window.location.href` isn't a valid base.

Before this change `getUrl()` would throw when running in devmode on the server.

Fixes #56207

PR Close #56213
2024-06-27 15:54:12 +00:00
Matthieu Riegler d23aa878a0 test(core): Add testing for defer error block (#56561)
In #56558 it was raised that we used an devMode function in a prod scope.
This commit adds a test when an defer error block is missing in devMode and prodMode

PR Close #56561
2024-06-27 15:53:19 +00:00
Angular Robot 34b5efcf0d build: update dependency selenium-webdriver4 to v4.22.0 (#56580)
See associated pull request for more information.

PR Close #56580
2024-06-27 15:52:47 +00:00
Pawel Kozlowski 08f56d980b refactor(common): remove ng_switch ability to use == equality check (#56426)
In Angular v17 we've alligned NgSwitch equality check with the build in control
flow to be ===. At the same time we've left the ability to use ==. This ability was
controlled by the NG_SWITCH_USE_STRICT_EQUALS const targetted by the G3 patch.

This commits removes the infrastructure to swap equality operator in preparation
for the G3 patch removal.

PR Close #56426
2024-06-27 15:07:57 +00:00
Thomas Nguyen 40fb81fd0e refactor(core): Add global event delegation provider (#56247)
This replaces all addEventListener calls with a stashing function,
and installs an event listener on the document body to retrieve
the stashed function;

PR Close #56247
2024-06-27 14:24:47 +00:00
Dylan Hunn 3bfba7ec15 docs: release notes for the v18.0.5 release 2024-06-26 17:15:22 -07:00
Dylan Hunn 5dc0de1494 release: cut the v18.1.0-next.4 release 2024-06-26 17:06:09 -07:00
Matthieu Riegler 033dfc39bc docs: Add mention of picture support in FAQ (#56692)
PR Close #56692
2024-06-26 16:58:27 -07:00
Matthieu Riegler cc4cb9608a refactor(common): Log a warning when the priority attribute of NgOptimizedImage is used too often. (#56669)
When the DOM content is loaded, Angular will log a warning message if the `priority` attribute is applied to often on `NgOptimizedImage` directive instances.

PR Close #56669
2024-06-26 12:43:00 -07:00
Matthieu Riegler ec654f72ae docs(docs-infra): fix asset path for learn angular #11 (#56587)
fixes #56568

PR Close #56587
2024-06-26 12:39:00 -07:00
Ofer Segev d3a488ad00 docs: Update signals overview.md (#56671)
change "computed" to a term using a backtick
PR Close #56671
2024-06-26 12:38:25 -07:00
Kristiyan Kostadinov 0a48d584f2 feat(core): add support for let syntax (#56715)
Enables the new `@let` syntax by default.

`@let` declarations are defined as:
1. The `@let` keyword.
2. Followed by one or more whitespaces.
3. Followed by a valid JavaScript name and zero or more whitespaces.
4. Followed by the `=` symbol and zero or more whitespaces.
5. Followed by an Angular expression which can be multi-line.
6. Terminated by the `;` symbol.

Example usage:
```
@let user = user$ | async;
@let greeting = user ? 'Hello, ' + user.name : 'Loading';
<h1>{{greeting}}</h1>
```

Fixes #15280.

PR Close #56715
2024-06-26 12:37:02 -07:00
Matthieu Riegler c19a4e7a96 docs: Move the background image migration to its own section. (#56588)
PR Close #56588
2024-06-26 08:52:17 -07:00
Tom Wilkinson 1d28fbb84c refactor(core): Use ActionResolver in Dispatcher. (#56369) (#56369)
`EventContract` usages in Angular now use `false` for
`useActionResolver`. Tests have been updated, with functionality that
depends on `ActionResolver` moving to dispatcher_test.ts.

PR Close #56369

PR Close #56369
2024-06-26 08:49:30 -07:00
Kristiyan Kostadinov 7dfe302f47 refactor(core): support let declarations during hydration (#56527)
Updates the hydration logic to account for the fact that let declarations don't create a DOM node.

PR Close #56527
2024-06-26 08:48:31 -07:00
Kristiyan Kostadinov bbe39c1738 refactor(core): integrate let instructions into the runtime (#56527)
Adds the implementation of the following new instructions:
* `declareLet` - creation-time instruction that initializes the slot for a let declaration.
* `storeLet` - update-time instruction that stores the current value of a let declaration.
* `readContextLet` - instruction that reads the stored value of a let declaration from a different view.

On top of the instructions, it also introduces a new `LetDeclaration` TNode type.
The new TNode is nececessary for DI to work correctly in pipes inside the let expression,
as well as for proper hydration support.

PR Close #56527
2024-06-26 08:48:31 -07:00
Andrew Scott 2431f206d7 refactor(forms): Update status, touched, and pristine to use private setter (#56573)
This refactor updates the touched, status, and pristine properties to
have a private setter.

PR Close #56573
2024-06-26 08:47:39 -07:00
Kristiyan Kostadinov ccc8c80cd0 build: update to TypeScript 5.5 stable (#56358)
Updates the repo to the stable release of TypeScript 5.5.

PR Close #56358
2024-06-25 09:29:16 -07:00
Shannon V.C 362e3c74a0 docs: add neovim setup section to adev (#56057)
PR Close #56057
2024-06-25 09:28:47 -07:00
Matthieu Riegler cc21989132 fix(http): Make Content-Type header case insensitive (#56541)
Prior to this change, is the `Content-Type` passed to the `FetchBackend` was lowercase it was overwritten with the default one.

fixes #56539

PR Close #56541
2024-06-25 09:28:18 -07:00
MikaelSvanasbakken f7d56790f5 docs: fix broken redirection to contributing.md (#56581)
PR Close #56581
2024-06-25 09:27:56 -07:00
Matthieu Riegler 5be16d06bd fix(core): prevent calling devMode only function on @defer error. (#56559)
`getTemplateLocationDetails()` is a devMode only function and should guarded by `ngDevMode` or calling it will throw an error.

fixes #56558

PR Close #56559
2024-06-25 09:17:33 -07:00
Sasidharan SD 85dc9123a1 docs: fix broken component fixture link (#56563)
PR Close #56563
2024-06-25 09:15:02 -07:00
Matthieu Riegler e81abdbd49 docs(docs-infra): add canonical link to each adev page (#56540)
PR Close #56540
2024-06-24 09:44:29 -07:00
Sasidharan SD 49b2e65bfb docs: fix file structure link (#56542)
PR Close #56542
2024-06-21 10:04:45 -07:00
Matthieu Riegler a9bbfdd103 build: add ignores for aio (#56538)
The files are needed/generated to run aio on the 17.3.

PR Close #56538
2024-06-21 10:03:34 -07:00
Gerald Monaco 29ca6d10cc fix(core): improve support for i18n hydration of projected content (#56192)
When collecting nodes from the DOM for hydration, we need to treat nodes with paths (e.g. content projection) as the new root for all subsequent elements, not just the next one.

Additionally, when using content projection it's possible for translated content to become disconnected, e.g. when it doesn't match a selector and there isn't a default. We need to handle such cases by manipulating the disconnected node data associated with hydration as usual.

PR Close #56192
2024-06-20 14:59:57 -07:00
Luis Fernando Scapin 3ea7794474 docs: ordered words (#56534)
Ordered correctly some words

PR Close #56534
2024-06-20 14:58:12 -07:00
Andrew Kushnir 29ecb39895 release: cut the v18.1.0-next.3 release 2024-06-20 12:07:20 -07:00
Andrew Kushnir 34c3bd3c83 docs: release notes for the v18.0.4 release 2024-06-20 12:02:32 -07:00
Andrew Scott 0d52c6b182 fix(router): Delay the view transition to ensure renders in microtasks complete (#56494)
This commit delays makes two changes:

* Use the `read` phase for `afterNextRender` hook. We really want to
   wait for any write hooks to complete before starting the animation
* In addition, wait a macrotask before resolve (really, this makes the
   above change unnecessary but it's still conceptually the right
   thing). This ensures any follow-up rendering in the microtask queue
   is flushed before the animation starts.

Important note: This only affects the timing of the animation start,
delaying it longer to allow additional rendering/change detections to
flush. This promise already resolves in an `afterNextRender` hook and is
only used directly by the browser's view transition machinery.

PR Close #56494
2024-06-20 08:56:49 -07:00
Sasidharan SD 955ade66e1 docs: fix page not found (#56512)
PR Close #56512
2024-06-20 08:56:09 -07:00
Matthieu Riegler 55835e9bc9 docs: fix code example for http headers (#56508)
PR Close #56508
2024-06-20 08:55:31 -07:00
Matthieu Riegler dd506c1802 docs: add mention of preconnect links (#56503)
Text is copied from AIO.

fixes #56502

PR Close #56503
2024-06-20 08:54:50 -07:00
Charles Lyding c12f318f72 build: remove unused root dependencies (#56499)
With the removal of AIO, several dependencies are now unused and can be removed.

PR Close #56499
2024-06-20 08:54:11 -07:00
Andrew Kushnir e20c6df65e refactor(core): use performance API for Event Replay (#56509)
This commit adds a standard performance marker that can be viewed in Chrome dev tools and other tooling.
See more info at https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark

PR Close #56509
2024-06-20 08:53:18 -07:00
Andrew Kushnir bf6df6f186 fix(core): do not activate event replay when no events are registered (#56509)
This commit adds extra checks to handle a situation when an application has no events configured, but the Event Replay feature was enabled. This situation can happen when some routes in an application are mostly static, when other routes are more interactive.

Resolves #56423.

PR Close #56509
2024-06-20 08:53:18 -07:00
cexbrayat 86bcfd3e49 fix(core): improve docs on afterRender hooks (#56522)
This commit fixes a typo in the `AfterRenderPhase` deprecation warning and improves the documentation of the options parameter of the afterRender hooks (which are now all named `options` instead of being called `opts` in some functions and `options` in others).

PR Close #56522
2024-06-20 08:51:35 -07:00
cexbrayat 03a2acd2a3 fix(core): properly remove imports in the afterRender phase migration (#56524)
Before this commit, the migration was removing the `AfterRenderPhase` enum from the imports but not the comma, resulting in invalid code:

ts
```
import { , Directive, afterRender } from '@angular/core';
```

This commit fixes this by using `updateNamedImports` and `replaceNode` instead of `removeNode`.

After:

ts
```
import { Directive, afterRender } from '@angular/core';
```

PR Close #56524
2024-06-20 08:50:28 -07:00
arturovt 39df5fa9d2 refactor(core): missing space in zoneless warning (#56491)
There's currently a missing space in the zoneless warning, showing words together.

PR Close #56491
2024-06-20 08:49:39 -07:00
Kristiyan Kostadinov 64990a50ed refactor(compiler): integrate let declarations into the template pipeline (#56299)
These changes integrate let declarations into the template pipeline. This involves a few operations:
* Producing a `declareLet` instruction call at creation time to initialize the declaration.
* Producing a `storeLet` instruction call in the place of the let declaration, including the necessary `advance` calls beforehand.
* For let declarations used within their declaration view, moving the `const` to be placed right after the `storeLet` call to ensure the their value has been computed.
* For let declarations that are _only_ used in their declaration view, removing the `storeLet` call and inlining the expression into the constant statement.

PR Close #56299
2024-06-20 08:48:52 -07:00
Joey Perrott 0bd55a684f refactor(docs-infra): complete removal of aio directory (#56496)
Finish removal of aio directory as it is no longer used or relied upon.

PR Close #56496
2024-06-18 12:26:00 -07:00
Joey Perrott bb72c26b52 refactor(docs-infra): remove reliance on aio example macro (#56496)
Remove usage of aio example macro in adev

PR Close #56496
2024-06-18 12:25:59 -07:00
Joey Perrott 7208d05a38 refactor(docs-infra): move windows-chromium-path to adev (#56496)
Move windows-chromium-path help from aio to adev

PR Close #56496
2024-06-18 12:25:59 -07:00
Andrew Scott 00bde8b1c2 fix(forms): Make NgControlStatus host bindings OnPush compatible (#55720)
This commit makes the host bindings of `NgControlStatus[Group]`
compatible with `OnPush` components. Note that this intentionally _does not_
expose any new APIs in the forms module. The goal is only to remove
unpreventable `ExpressionChangedAfterItHasBeenCheckedError` in the forms
code that developers do not have control over.

PR Close #55720
2024-06-18 11:35:34 -07:00
Matthieu Riegler 775f451682 docs: add ng generate directive page (#56417)
fixes #56296

PR Close #56417
2024-06-18 09:31:26 -07:00
Angular Robot b592fb59c1 build: update scorecard action dependencies (#56485)
See associated pull request for more information.

PR Close #56485
2024-06-18 09:30:45 -07:00
Angular Robot 4b8d90806a build: update actions/checkout action to v4.1.7 (#56484)
See associated pull request for more information.

PR Close #56484
2024-06-18 09:28:57 -07:00
Angular Robot 18d64c5b64 build: update io_bazel_rules_sass digest to b222c61 (#56483)
See associated pull request for more information.

PR Close #56483
2024-06-18 09:28:19 -07:00
Andrew Scott f8654bd3f6 fix(docs-infra): reference page restores scroll position or goes top when no anchor (#56478)
This contains follow-up fixes to 2a2439712a.
This commit updates scrolling on references page to scroll to the top
when there is no anchor in the URL. The behavior after the above commit would
be that the position doesn't change from whatever the previous page was
(potentially scrolled to the bottom). In addition, this restores the
previous scroll position when traversing through browser history rather
than always scrolling to the fragment.

PR Close #56478
2024-06-18 09:26:56 -07:00
ivanwonder 67b2c336bc fix(language-service): import the default exported component correctly (#56432)
When importing a component exported by default, the `default` can't be
used as the component name.

For example:

This is the export declarations:

```ts
export default class TestComponent {}
```

Previously, the output generated by LS looked like this:

```ts
import { default } from "./test.component";
```

Now the output looks like this:

```ts
import TestComponent from "./test.component";
```

Fixes #48689

PR Close #56432
2024-06-17 12:48:48 -07:00
Viktor T d203c499a3 docs(docs-infra): Remove redundant API link (#56480)
As there is no longer a page for the localize API the URL pointing to this page is removed

PR Close #56480
2024-06-17 12:48:12 -07:00
Andrew Kushnir 89ec195fd2 refactor(core): handle incomplete DOCUMENT instances during cleanup in tests (#56422)
`DOCUMENT` instances retrieved from DI may not contain a necessary function to complete the cleanup. In tests that don't interact with DOM, the `DOCUMENT` might be mocked and some functions might be missing. For such tests, DOM cleanup is not required and we can skip DOM cleanup logic if there are missing functions. For tests that use DOM, TestBed would behave the same as before and rely on more complete `DOCUMENT` instances.

PR Close #56422
2024-06-17 09:05:52 -07:00
Andrew Kushnir 088e6c73bf refactor(core): avoid exposing OutletInjector in injector resolution path (#56394)
Router's `OutletInjector` required a special handling in cases when `@defer` is used, see https://github.com/angular/angular/pull/55374 for additional info. As a result, the `ChainedInjector` that represents an `OutletInjector` instance is currently exposed via `getInjectorResolutionPath` function. This creates a problem, because other debug APIs used by DevTools can not interact with `ChainedInjector`s. This commit updates the logic around `getInjectorResolutionPath` utility to avoid exposing `OutletInjector`in the resolution path.

Resolves #56331.

PR Close #56394
2024-06-17 09:05:11 -07:00
Andrew Scott f346448871 docs(router): Remove deprecation on Router guard interfaces (#56408)
Many developers find these interfaces useful for various reasons. Beyond
that, the deprecation of the interfaces has incorrectly implied that
existing class-based guard implementations need to be migrated to
functions. Class injectables are _not_ deprecated and choosing to
implement a guard's state and logic as a class that is injectable in the
functions run inside the injection context is valid.

resolves #50234

PR Close #56408
2024-06-17 09:03:01 -07:00
Paul Gschwendtner 4bc99f0bdf refactor(core): ModelSignal should extend InputSignal (#56452)
This allows for helpers like the following to work intuitively for all
types of "input fields". It also establishes the intended mental
philosophy that a model is both an input and an output.

```ts
/** Unwraps all signal input properties. */
export type UnwrapSignalInputs<T> = {
  [K in keyof T]: T[K] extends InputSignalWithTransform<any, infer WriteT>
    ? WriteT
    : T[K];
};
```

PR Close #56452
2024-06-17 08:59:58 -07:00
Alex Rickabaugh 5df3e78c99 feat(core): add equality function to rxjs-interop toSignal (#56447)
`toSignal` predates the decision to allow a more flexible equality check in
signals, and thus doesn't support a custom equality function. This commit
adds the ability to pass a custom value equality function. As a side effect,
it now adds the default equality check where it wasn't used before.

Fixes #55573

PR Close #56447
2024-06-17 08:59:21 -07:00
Daniel Kimmich 08038e8573 docs: update security guide link to adev (#56469)
PR Close #56469
2024-06-17 08:54:08 -07:00
Arek 278c4a1fcb docs: fix outdated links from docs to contributing-docs folder in markdown documents (#56462)
PR Close #56462
2024-06-17 08:53:17 -07:00
Sasidharan SD 5a45d2b6b1 docs: fix location strategy link (#56475)
PR Close #56475
2024-06-17 08:48:23 -07:00
Andrew Scott 2a2439712a fix(docs-infra): Various scroll fixes for a.dev (#56464)
* Create custom scroller to manage scroll behavior more directly. There
  are two many special and weird behaviors in the site to use the
  built-in scrolling.
* Update scrolling to wait for application stability. This waits a bit
  longer than the current `Scroll` event, which happens in
  `afterNextRender` after the `NavigationEnd`. fixes #56446
* Disable scrolling on the API references page. It just never worked
  well with all the custom scroll locations
* Update card clicks on API references page to change the fragment of
  the URL (this allows docs viewers to link directly to an item). Also update
  API reference page to listen to fragment changes and use that as the
  scroll trigger rather than the click. This takes care of the initial
  scroll when the page loads as well.

fixes #56446

PR Close #56464
2024-06-17 08:46:49 -07:00
Angular Robot 4cd5fb592b build: update actions/checkout digest to 692973e (#56438)
See associated pull request for more information.

PR Close #56438
2024-06-17 08:46:06 -07:00
Joey Perrott ee8ecfaef0 ci: begin checking licenses of upstream dependencies to ensure they are approved (#56460)
Begin checking upstream dependency licenses.

PR Close #56460
2024-06-14 13:49:23 -07:00
Charles Lyding e0ee049bc3 ci: use bazel downloaded saucelabs connect binary (#56456)
The saucelabs connect tunnel utility is now downloaded via bazel as needed.
For the directly invoked case the utility is downloaded via the local shell script.
Previously it was part of the root `package.json` and downloaded whenever
a package install was executed. The utility archive was also not an actual
package which incidentally worked with npm but does not work with newer versions
of yarn.

PR Close #56456
2024-06-14 13:48:37 -07:00
Aristeidis Bampakos d64ee6cc9d docs: fix broken link in ng-container API reference (#56445)
Closes #56444
PR Close #56445
2024-06-14 10:05:42 -07:00
Matthieu Riegler ce8853e5af docs(core): remove the doc link for NG0952 (#56441)
We don't have any docs yet for that error, so I'm removing the minus sign which indicate that there is a dedicated error doc.

Fixes #56424

PR Close #56441
2024-06-14 10:05:00 -07:00
Andrew Scott 1d3a7529b4 feat(router): Set a different browser URL from the one for route matching (#53318)
This feature adds a property to the `NavigationBehaviorOptions` that
allows developers to define a different path for the browser's address
bar than the one used to match routes. This is useful for redirects
where you want to keep the browser bar the same as the original
attempted navigation but redirect to a different page, such as a 404 or
error page.

fixes #17004

PR Close #53318
2024-06-13 13:59:45 -07:00
Andrew Kushnir fca5764564 Revert "refactor(core): Use ActionResolver in Dispatcher. (#56369)" (#56440)
This reverts commit 4ebd2853fa.

PR Close #56440
2024-06-13 12:17:35 -07:00
JoostK 0b867e83b6 fix(compiler-cli): insert constant statements after the first group of imports (#56431)
The linker inserts the constant statements that are needed to support compiled templates
after the import statements of an ESM file, but it failed to account for import statements
that are not at the top of the file. This is typically seen in FESM files where multiple
individual ESMs have been concatenated into a single ESM file, with imports in various places.
The linker would then find the very last import statement to insert the constant statements
after, but this may result in TDZ errors for component templates that have been emitted
earlier in the file.

This commit updates the Babel linker plugin to insert constant statements after the last
import of the first import group, therefore avoiding the TDZ error.

Fixes #56403

PR Close #56431
2024-06-13 10:15:00 -07:00
Paul Gschwendtner 126d33a34d refactor(compiler-cli): allow generating same import specifier in different files (#56406)
The import manager ensures generation of unique identifiers when
inserting imports. This is done by inspecting existing identifiers
within the original source file, while also checking if a similar
identifier was generated at an earlier time. This is correct behavior.

We can improve the detection so that the same identifier can be
generated in different files. This is beneficial for schematic/migration
use-cases where we wouldn't want to generate import aliases in multiple
files just because we generated an import to e.g. `input` previously.

E.g. it's fine to generate

```ts
// a.ts
import {input} from '@angular/core';

// b.ts
import {input} from `@angular/core';

// instead of `input as input_1`.

```

PR Close #56406
2024-06-13 10:14:09 -07:00
Paul Gschwendtner 5162a32de8 refactor(compiler): expose shorthand object metadata in expression AST (#56405)
Whenever we parse object property assignment shorthands in expression
ASTs, the AST will have no information about whether the property read
for the `LiteralMap` is built based on the shorthand or not.

Exposing this information in the AST is useful for migrations as those
might need to decompose the shorthand into its longer form to e.g.
invoke a signal read.

PR Close #56405
2024-06-13 10:12:52 -07:00
Paul Gschwendtner 352e0782ec feat(core): expose signal input metadata in ComponentMirror (#56402)
This commit starts exposing `isSignal` for inputs in the
`ComponentMirror`. We initially had this as a draft when rolling out
signal inputs, but there were no good use-cases, so we skipped it.

Now, inside G3, for the testing infrastructure and rolling out
advancements for signal inputs, having this information is necessary and
allows identifying signal inputs without "accessing fields" on the class
that may cause side-effects (like triggering setters).

PR Close #56402
2024-06-13 10:12:06 -07:00
Viktor T c698668a52 docs: language-service - Fix quick info URLs (#56416)
- Made the links more specific
- Removed the AIO notation

PR Close #56416
2024-06-13 09:23:44 -07:00
Jens Kuehlers d5ecd2c4cc docs: add v18.x and v19. release dates (#56429)
Add planned approximate v18 minor and v19 major
release dates.

PR Close #56429
2024-06-13 09:22:15 -07:00
Pawel Kozlowski ef2ad1b2ef refactor: add select scenario to the js-web-frameworks benchmark (#56362)
Add the row selection scenario to the existing benchmark so we can
automate perf measurements during experiments.

PR Close #56362
2024-06-13 08:59:18 -07:00
Pawel Kozlowski 485c3d929d refactor: run js-web-frameworks with noop zone (#56362)
Align setup of this benchmark with
https://github.com/krausest/js-framework-benchmark/tree/master/frameworks/keyed/angular-cf-nozone
by running without zone.js using noop zone.

PR Close #56362
2024-06-13 08:59:17 -07:00
Jessica Janiuk b2c44c76dc ci: bump github action commit message labels hash (#56435)
This updates to the latest git hash for the github action for commit messages.

PR Close #56435
2024-06-13 08:55:28 -07:00
Tom Wilkinson 4ebd2853fa refactor(core): Use ActionResolver in Dispatcher. (#56369)
`EventContract` usages in Angular now use `false` for
`useActionResolver`. Tests have been updated, with functionality that
depends on `ActionResolver` moving to dispatcher_test.ts.

PR Close #56369
2024-06-13 08:50:45 -07:00
Alex Rickabaugh a114ebad7e release: cut the v18.1.0-next.2 release 2024-06-12 16:26:51 -07:00
Alex Rickabaugh 38b84007b6 docs: release notes for the v18.0.3 release 2024-06-12 16:20:47 -07:00
Sasidharan SD f4b86bd9d5 docs: fix configure routes link (#56415)
PR Close #56415
2024-06-12 13:36:27 -07:00
Angular Robot 9e670ceea3 build: update io_bazel_rules_sass digest to 221f949 (#56393)
See associated pull request for more information.

PR Close #56393
2024-06-12 13:35:32 -07:00
Angular Robot 5cc9e8075a build: update babel dependencies to v7.24.7 (#56373)
See associated pull request for more information.

PR Close #56373
2024-06-12 13:11:12 -07:00
Andrew Kushnir 71c9609298 refactor(core): inject PendingTasks as optional in EventEmitter class (#56411)
This commit makes `PendingTasks` dependency in the `EventEmitter` class optional to make sure this code works with various test setups.

PR Close #56411
2024-06-12 13:10:40 -07:00
arturovt b8d5882127 fix(zone.js): allow enabling default beforeunload handling (#55875)
Prior to this commit, when zone.js was included, it wasn't possible to handle `beforeunload`
events correctly if event handlers returned strings to prompt the user.

With this change, we introduce a global configuration flag,
`__zone_symbol__enable_beforeunload`, to allow consumers to enable the default
`beforeunload` handling behavior.

This flag is necessary to prevent any breaking changes resulting from this modification.
The previous attempt to fix it caused a large number of failures in G3. Hence, we're
hiding that fix behind the configuration flag.

Closes #47579

PR Close #55875
2024-06-12 13:06:21 -07:00
ivanwonder b400e2e4d4 feat(language-service): autocompletion for the component not imported (#55595)
This PR allows the language service to suggest imports for all directives returned from the
compiler, and generate the TypeScript module import and the decorator import when the component
is selected by the user.

PR Close #55595
2024-06-12 13:04:32 -07:00
Alex Rickabaugh 70157aa3d0 docs(service-worker): fix formatting of directory structure example (#56412)
This example was using the `<code-example>` tag from AIO instead of the
`<docs-code>` tag from ADEV.

Fixes #56398

PR Close #56412
2024-06-12 12:01:22 -07:00
Joey Perrott 96d3ed8493 ci: use depth 100 to allow for some history in artifact repos (#56414)
Use depth 100 to allow for some history in the artifact repos, without the entire history being necessary
which caused us to run out of space on the CI runner.

PR Close #56414
2024-06-12 11:45:26 -07:00
Matthieu Riegler 160171e26a docs(docs-infra): generate valid HTML for the update guide. (#56390)
Nested block elements in a `p` element are not valid.
The p block automatically closes if another block-level element is parsed before the closing.

PR Close #56390
2024-06-11 17:17:03 -07:00
Joey Perrott 03957b1c06 fix(docs-infra): use anchors instead of button for version picker links (#56368)
Use anchors as links instead of buttons

PR Close #56368
2024-06-11 17:16:20 -07:00
Andrew Kushnir b3780b8e5f ci: update payload size for a couple integration apps (#56391)
This commit updates the payload size for a couple integration apps. Those apps were likely close to a threshold already and the most recent commit added a few extra bytes to go over the limit.

PR Close #56391
2024-06-11 16:50:19 -07:00
Andrew Scott d5c6ee432f fix(core): async EventEmitter should contribute to app stability (#56308)
async `EventEmitter` should contribute to app stability.

fixes #56290

PR Close #56308
2024-06-11 15:10:21 -07:00
Angular Robot 79299575af build: update github/codeql-action action to v3.25.8 (#56374)
See associated pull request for more information.

PR Close #56374
2024-06-11 12:39:32 -07:00
Paul Gschwendtner f0d63f17e2 build: update cross-repo angular dependencies (#56364)
This commit also performs lock file maintenance on all integration
tests, fixing some ambigous ESM/CJS dependency graph issues.

e.g.

```
Unknown error: Error [ERR_REQUIRE_ESM]: require() of ES Module /tmp/ng-integration-test-aTpQOT/test-sandbox/node_modules/string-width/index.js from /tmp/ng-integration-test-aTpQOT/test-sandbox/node_modules/cliui/build/index.cjs not supported.
Instead change the require of index.js in /tmp/ng-integration-test-aTpQOT/test-sandbox/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
------------------------------------------
```

Closes #56261.

PR Close #56364
2024-06-11 12:35:47 -07:00
Andrew Scott 4c7d5d8acd fix(core): signals should be tracked when embeddedViewRef.detectChanges is called (#55719)
This commit fixes an issue where signals in embedded views are not
tracked if they are refreshed with `EmbeddedViewRef.detectChanges`
directly. We had previously assumed that embedded views were always
refreshed along with their hosts.

PR Close #55719
2024-06-11 12:35:02 -07:00
Joey Perrott 60ed6257e0 ci: remove tmp directory after publishing artifacts (#56385)
Remove teh tmp directory after publishing artifacts to prevent runner from running out of space.

PR Close #56385
2024-06-11 17:48:26 +00:00
Matthieu Riegler 25a5373af2 docs(docs-infra): guard access to navigator for prerendering (#56333)
PR Close #56333
2024-06-11 17:08:35 +00:00
Joey Perrott 0287ae5b68 ci: use full depth repositories for artifact publishing (#56383)
Use full depth repositories for artifact publishing to prevent the commits from not being able to find the path between commits during push.

PR Close #56383
2024-06-11 16:42:14 +00:00
Andrew Scott 4efe5000c0 refactor(router): Add back changes param to RouterLink ngOnChanges (#56371)
This parameter was removed in a recent change but is being added back to
avoid breaking code in a minor version.
While the changes parameter is not used, some code relies on it, mostly
through API misuse (extending `RouterLink`, manually calling `ngOnChanges`, etc.).

PR Close #56371
2024-06-11 08:30:57 -07:00
Matthieu Riegler 3cbddd2e42 refactor(compiler): Extract return type description (#56287)
Thie commit extracts return type description from the jsDoc.

Compiler part of #56277, will also need as dev-infra update.

PR Close #56287
2024-06-11 08:29:22 -07:00
Aristeidis Bampakos 54170cd60d docs: use language-agnostic links for external docs (#56377)
PR Close #56377
2024-06-11 08:26:30 -07:00
Pawel Kozlowski 31d9fa40bd fix(benchpress): adjust supported browser names for headless chrome (#56360)
The chrome version controlled by selenium reports chrome-headless-shell in the
current setup. This fix accounts for the updated browser name.

PR Close #56360
2024-06-11 08:25:10 -07:00
Angular Robot 5109a43410 docs: update Angular CLI help [main] (#56328)
Updated Angular CLI help contents.

PR Close #56328
2024-06-11 08:23:19 -07:00
Angular Robot feb9858a53 build: update all non-major dependencies (#56118)
See associated pull request for more information.

PR Close #56118
2024-06-11 08:21:47 -07:00
Jeremy Elbourn f0fbced1c5 docs: update and reorganize contributor docs (#56141)
* Move from `docs/` to `contributing-docs/`
* Updated file names to better communicate their content
* Consolidated content into fewer docs
* Updated and/or deleted obsolete info

PR Close #56141
2024-06-11 08:20:59 -07:00
Matthieu Riegler 567c2f6d90 docs: add NG0913 error doc (#56352)
File copied from AIO.

fixes #56351

PR Close #56352
2024-06-10 15:11:45 -07:00
vladboisa 33d1aa69e8 docs(docs-infra): add missing context (#56367)
Added some missing context for statement regarding base href

Fixes#56336

PR Close #56367
2024-06-10 15:08:37 -07:00
WilliamDecker 7535aeb906 ci: correct invalid attributes in prettierrc configuration (#56279)
Corrected options for "tabs" to "useTabs" (https://prettier.io/docs/en/options#tabs) and "semicolon" to "semi" (https://prettier.io/docs/en/options#semicolons) as outlined in the Prettier documentation.

PR Close #56279
2024-06-10 14:05:17 -07:00
Risqi Romadhoni e3f7d687aa docs: update link for Vite and esbuild in Angular CLI introduction (#56346)
PR Close #56346
2024-06-10 14:04:29 -07:00
Sasidharan SD 0918643cd7 docs: fix input validation link in reactive forms (#56334)
PR Close #56334
2024-06-10 14:02:56 -07:00
Preston West 38eaf46213 docs: fix 3 typos and a format issue (#56329)
PR Close #56329
2024-06-10 14:00:03 -07:00
arturovt 4616d2904d docs: update event-binding (#56322)
This commit updates the event binding part, where all `scroll` listeners are marked
as passive using the special zone.js configuration flag. The configuration has been
moved from the `polyfills` file to `index.html`. Since new apps no longer include a
`polyfills.ts` file but instead have a `polyfills` property in the builder, setting
the flag in `index.html` ensures compatibility with both configurations.

PR Close #56322
2024-06-10 13:57:24 -07:00
Denis Bendrikov 080e971db3 refactor(devtools): use dark scrollbars in dark mode (#56225)
Opt the devtools into the user's color scheme preferences

PR Close #56225
2024-06-10 13:55:43 -07:00
Angular Robot 6ca056532a build: lock file maintenance (#56361)
See associated pull request for more information.

PR Close #56361
2024-06-10 13:54:11 -07:00
Miles Malerba ea3c802056 feat(core): Add a schematic to migrate afterRender phase flag (#55648)
Adds an `ng update` migration to move users from using the phase flag
with `afterRender` / `afterNextRender` to passing a spec object instead.

PR Close #55648
2024-06-10 13:53:39 -07:00
Miles Malerba 38effcc63e fix(core): Add back phase flag option as a deprecated API (#55648)
Adds back the ability to set the phase of an `afterRender` /
`afterNextRender` callback using the `phase` option. However, this API
is now deprecated, and the phase should instead be specified by passing
a spec object rather than a callback function.

PR Close #55648
2024-06-10 13:53:39 -07:00
Miles Malerba a655e46447 feat(core): Redesign the afterRender & afterNextRender phases API (#55648)
Previously `afterRender` and `afterNextRender` allowed the user to pass
a phase to run the callback in as part of the `AfterRenderOptions`. This
worked, but made it cumbersome to coordinate work between phases.

```ts
let size: DOMRect|null = null;

afterRender(() => {
  size = nativeEl.getBoundingClientRect();
}, {phase: AfterRenderPhase.EarlyRead});

afterRender(() => {
  otherNativeEl.style.width = size!.width + 'px';
}, {phase: AfterRenderPhase.Write});
```

This PR replaces the old phases API with a new one that allows passing a
callback per phase in a single `afterRender` / `afterNextRender` call.
The return value of each phase's callback is passed to the subsequent
callbacks that were part of that `afterRender` call.

```ts
afterRender({
  earlyRead: () => nativeEl.getBoundingClientRect(),
  write: (rect) => {
    otherNativeEl.style.width = rect.width + 'px';
  }
});
```

This API also retains the ability to pass a single callback, which will
be run in the `mixedReadWrite` phase.

```ts
afterRender(() => {
  // read some stuff ...
  // write some stuff ...
});
```

PR Close #55648
2024-06-10 13:53:39 -07:00
Angular Robot 6db94d51db docs: update Angular CLI help [main] (#56280)
Updated Angular CLI help contents.

PR Close #56280
2024-06-07 09:45:58 -07:00
Preston West 257d94211c docs: fix typo in testing/services.md (#56316)
PR Close #56316
2024-06-07 09:34:15 -07:00
Kristiyan Kostadinov 96aa5c8a2c fix(migrations): resolve error in standalone migration (#56302)
This is related to an issue that was reported internally. We were assuming that `hasNgModuleMetadataElements` will return true only for property assignments initialized to arrays, but that's not the case.

These changes update the type and our assertions to more accurately reflect the AST and to avoid the error.

PR Close #56302
2024-06-07 09:33:41 -07:00
Andrew Scott a13f5da773 feat(router): Allow UrlTree as an input to routerLink (#56265)
This commit adds `UrlTree` as a valid input to `routerLink`. It
disallows using this together with any inputs that come from
`UrlCreationOptions`, such as `queryParams` or `fragment`.

We could, in the future, decide on a different approach for these, like merging or
replacing those in `urlTree` input. We cannot, however, go the other way
(decide to prevent those inputs if we've already decided to allow it and
using a merging/replacing strategy). For this reason, an error seems the
most reasonable approach to start and we can re-evaluate if there's a
compelling reason to.

fixes #34468

PR Close #56265
2024-06-07 09:33:14 -07:00
Aristeidis Bampakos a7e4a578d8 docs: use new link for update guide (#56054)
PR Close #56054
2024-06-07 09:32:46 -07:00
arturovt 2781b20567 docs: update NG0506 (#55973)
Provide a thorough explanation of why an application may remain unstable and
why developers should consider not running asynchronous code on the server outside
of the Angular zone, as this may lead to memory leaks.

PR Close #55973
2024-06-07 09:32:18 -07:00
Matthieu Riegler 7b0777b304 docs(docs-infra): Go zoneless and enable the zoneless scheduler (#55161)
PR Close #55161
2024-06-07 09:31:15 -07:00
Alan Agius 81486c2f47 fix(localize): add @angular/localize/init as polyfill in angular.json (#56300)
This commit addresses an issue where the `@angular/localize/init` polyfill is not included when there are no polyfills specified in the `angular.json` file.

PR Close #56300
2024-06-06 13:41:11 -07:00
Jessica Janiuk 181ed2a84a release: cut the zone.js-0.14.7 release (#56306)
PR Close #56306
2024-06-06 13:40:34 -07:00
Jessica Janiuk 101edda018 release: cut the v18.1.0-next.1 release 2024-06-05 13:18:05 -07:00
Jessica Janiuk cc97f11891 docs: release notes for the v18.0.2 release 2024-06-05 12:58:08 -07:00
Dylan Hunn 117a26bac3 docs(zone.js): update release guide for zone.js (#55846)
Update the releasing guide for zone.js, because one of the release commands was outdated.
PR Close #55846
2024-06-05 19:33:27 +00:00
Kristiyan Kostadinov dd869e4d68 refactor(language-service): integrate let declarations (#56270)
Integrates let declarations in the various places within the language service (quick info, completions etc).

PR Close #56270
2024-06-05 18:45:23 +00:00
Angular Robot 1653b40d14 build: update dependency @rollup/plugin-commonjs to v26 (#56281)
See associated pull request for more information.

PR Close #56281
2024-06-05 18:36:50 +00:00
Thomas Nguyen 6e89ef1ebf refactor(core): Refactor parts of event_replay into a shared library that will be used with global event delegation. (#56172)
This also moves the code that stashes the jsaction more closely to the code that actually sets the event listener.

PR Close #56172
2024-06-05 16:35:23 +00:00
marktechson 4766233f16 docs: remove v18 developer event banner (#56278)
PR Close #56278
2024-06-05 15:56:29 +00:00
Tom Wilkinson a65c1cf109 refactor(core): Add and move tests for Dispatcher. (#56193)
Move tests from `eventcontract_test.ts` to `dispatcher_test.ts` for
functionality that lives in `Dispatcher`.

Add an extra test for `preventDefault` behavior for `CLICKMOD` that
covers a previous bug case.

PR Close #56193
2024-06-04 18:05:39 +00:00
arturovt 4a3800a6a0 fix(zone.js): store remove abort listener on the scheduled task (#56160)
Prior to this commit, a memory leak occurred when the `abort` listener was
not removed from the `AbortSignal`. We introduced a fix to remove the event
listener, but it was erroneously stored on the `taskData`, which is a shared
global object. Consequently, when something attempted to remove an event listener,
it immediately removed the last stored abort listener. As a result, events would
never be canceled.

We have now rectified this by storing the remove abort listener function directly on
the task itself. This adjustment ensures that the abort listener is tied only to the
specific task. When the `abort` function is called, it cancels the task. Therefore, it
is safe to associate the cleanup function directly with the task.

Closes: #56148

PR Close #56160
2024-06-04 17:29:05 +00:00
Kristiyan Kostadinov 9aea8a0576 refactor(compiler-cli): add diagnostic for duplicate let declarations (#56199)
Adds a template diagnostic that will flag cases where multiple `@let` declarations use the same name.

PR Close #56199
2024-06-04 17:28:03 +00:00
Kristiyan Kostadinov cb165923e0 refactor(compiler-cli): account for let declarations in two-way binding check (#56199)
Updates the check that prevent writes to template variables in two-way bindings to account for let declarations.

Also fixes some old tests that weren't properly setting up two-way bindings.

PR Close #56199
2024-06-04 17:28:03 +00:00
Kristiyan Kostadinov ea4feb2721 refactor(compiler-cli): support completions for let declarations (#56199)
Adds support for let declarations inside the `CompletionEngine`.

PR Close #56199
2024-06-04 17:28:03 +00:00
Kristiyan Kostadinov 18ea7417a0 refactor(compiler-cli): support resolving the symbol of let declaration (#56199)
Updates the symbol builder to handle resolving the symbol of a let declaration.

PR Close #56199
2024-06-04 17:28:03 +00:00
Kristiyan Kostadinov 152430fa0f refactor(compiler-cli): integrate let declaration into the indexer (#56199)
Adds support for let declarations in the template indexer.

PR Close #56199
2024-06-04 17:28:03 +00:00
Kristiyan Kostadinov 695126453e refactor(compiler-cli): integrate let declarations into the template type checker (#56199)
Integrates let declarations into the template type checker by producing corresponding constants in the TCB.

This also includes a couple of custom diagnostics to flag usages of let before they're declared and illegal writes to let declarations. We can't rely on TS for these checks, because it includes the variable name in the diagnostic.

PR Close #56199
2024-06-04 17:28:03 +00:00
Kristiyan Kostadinov b7fc7fdba9 refactor(compiler): integrate let declarations into the template binder (#56199)
Integrates the let declarations into the template binder which will be used to power the scoping behavior of the new syntax.

PR Close #56199
2024-06-04 17:28:03 +00:00
Kristiyan Kostadinov 6cef0ed3ed refactor(compiler-cli): add compiler flag for testing let declarations (#56199)
Adds a private `_enableLetSyntax` flag that allows for let declarations to be enabled in tests.

PR Close #56199
2024-06-04 17:28:02 +00:00
Paweł Kubiak c8951ab57f fix(docs-infra): remove config release from test scripts (#56062)
fix(docs-infra): remove config release from test scripts

As we discussed in one of the previous PRs we should remove `--config=release` from test scripts on CI
fix(docs-infra): use DI to inject current VERSION.major

PR Close #56062
2024-06-04 17:27:27 +00:00
Angular Robot 0e2d80d5d4 build: update io_bazel_rules_sass digest to 61dde52 (#56168)
See associated pull request for more information.

PR Close #56168
2024-06-04 16:34:20 +00:00
Angular Robot d40cc85344 build: update cross-repo angular dependencies (#56259)
See associated pull request for more information.

Closes #56184 as a pr takeover

PR Close #56259
2024-06-04 16:27:46 +00:00
Alvaro Junqueira 8a24b83155 docs: fixing typo :ng-deep to ::ng-deep (#56251)
PR Close #56251
2024-06-04 16:14:50 +00:00
Pawel Kozlowski 73d0f77c34 refactor(docs-infra): mark adev-root component as OnPush (#56254)
After inspecting and testing the adev-root component is seems like
it could be marked as OnPush.
This change gets us closer to enabling zoneless for adev.

PR Close #56254
2024-06-04 13:52:37 +00:00
Pawel Kozlowski 45c56ad3df refactor(docs-infra): mark code editors components as OnPush (#56254)
After inspecting and testing the embedded-editor and adev-code-editor
components it
seems like those could be marked as OnPush.
This change gets us closer to enabling zoneless for adev.

PR Close #56254
2024-06-04 13:52:37 +00:00
Pawel Kozlowski f0ea936630 refactor(docs-infra): mark the update component as OnPush (#56254)
After inspecting and testing the adev-update-guide component it
seems like it could be marked as OnPush. This change gets us closer
to enabling zoneless for adev.

PR Close #56254
2024-06-04 13:52:37 +00:00
Sasidharan SD b0546dad83 docs: fix docs links (#56234)
PR Close #56234
2024-06-04 13:52:04 +00:00
Matthieu Riegler 73e84e2d22 refactor(core): Use Nullish coalescing assignment for view getters. (#56242)
Micro optim, this wasn't minified by the optimizer.

PR Close #56242
2024-06-03 20:10:35 +00:00
Ben Hong 3d2f963a90 docs: fix vertical playground spacing issue (#55689)
PR Close #55689
2024-06-03 19:26:09 +00:00
Ben Hong e5928e671c docs: resolve extra padding on tutorial editor (#54828)
As of this commit, there is a visual discrepancy between the height of the content on the left compared to the separator and editors on the right. It appears that the cause of this is an additional computation of layout padding which is unnecessary for these particular elements.

PR Close #54828
2024-06-03 19:24:39 +00:00
Alan Agius 01172b84d9 build: update Node.js to match Angular CLI engines (#56187)
The current supported Node.js engines by the Angular CLI are `^18.19.1 || ^20.11.1 || >=22.0.0`

PR Close #56187
2024-06-03 18:00:46 +00:00
Tomasz Ducin 8a993de4cb refactor(devtools): update links to the new docs (angular.dev) (#56138)
This PR replaces all links available within the devtools to point
to the new docs.
The links to Input/Output (decorators) have been replaced with
their function (signal) counterparts: input, output.

PR Close #56138
2024-06-03 17:38:11 +00:00
Dylan Hunn c673a0288d ci: add dylhunn@ to language-service pullapprove (#55999)
Add dylhunn@ as an approver for language service code.

PR Close #55999
2024-06-03 16:19:49 +00:00
Payam Valadkhan 9e21582456 fix(compiler-cli): Show template syntax errors in local compilation modified (#55855)
Currently the template syntax errors are extracted in the template type check phase. But in local compilation mode we skip the type check phase. As a result template syntax errors are not displayed. With this change we show the template syntax diagnostics in local mode.

PR Close #55855
2024-05-31 13:59:02 +00:00
Paweł 9d034f629f refactor(core): remove doubled line (#56091)
remove doubled line of titlecase pipe in commonModulePipes array

PR Close #56091
2024-05-31 13:24:55 +00:00
Sasidharan SD c0ad070e49 docs: fix alternate configuration link (#56201)
PR Close #56201
2024-05-31 13:24:15 +00:00
Angular Robot c1e3165ade build: update scorecard action dependencies (#56119)
See associated pull request for more information.

PR Close #56119
2024-05-31 13:15:41 +00:00
Alan Agius d530b09e40 docs: update file-structure doc (#56202)
Replace `/assets` with `public/`, this was replaced in version 18 of the Angular CLI.

PR Close #56202
2024-05-31 13:13:55 +00:00
Matthieu Riegler 398092b207 docs: update version support (#56034)
fixes #56033

PR Close #56034
2024-05-31 13:13:01 +00:00
Tyler Tierney fa7bef5b9b docs: edit sentence grammar in style-guide (#56173)
PR Close #56173
2024-05-31 13:12:29 +00:00
Andrew Scott 80f472f9f4 refactor(core): provide zone token in prod as well (#56197)
This allows us to make decisions based on whether zone is provided for
when zoneless is the default.

PR Close #56197
2024-05-30 19:24:23 -07:00
Andrew Kushnir 31f3975e4b fix(core): handle missing withI18nSupport() call for components that use i18n blocks (#56175)
This commit updates hydration serialization logic to handle a case when the `withI18nSupport()` call is not present for an application that has a component that uses i18n blocks. Note: the issue is only reproducible for components that also inject `ViewContainerRef`, since it triggers a special serialization code path.

Resolves #56074.

PR Close #56175
2024-05-30 18:36:58 +00:00
Jessica Janiuk 67128c321b ci: update explicit required reviews for primitives (#56191)
This removes the explicit 1 review required for the primitives and primitives-shared groups so that PR creators can serve as their own approval for that group.

PR Close #56191
2024-05-30 18:34:58 +00:00
Tom Wilkinson b6fb53cdc7 fix(core): Fix shouldPreventDefaultBeforeDispatching bug (#56188)
When I copied this over in https://github.com/angular/angular/commit/caedd10597a6becfc1f1f0d98b06dc76d6b25a86
the parentheses moved around the A tag check and the CLICK type check,
instead of around the CLICK and CLICKMOD check.

PR Close #56188
2024-05-30 17:54:55 +00:00
Alex Rickabaugh 1081c8d623 fix(core): don't coerce all producers to consumers on liveness change (#56140)
When a consumer switches its liveness state, it gets added to / removed from
the consumer list of all of its producers. This operation is transitive, so
if its producer is *also* a consumer and *its* liveness state is switched,
then the change is applied recursively.

Note that this only matters *if* the producer is also a consumer. However,
the logic in `producerAddLiveConsumer` / `producerRemoveLiveConsumerAtIndex`
coerced the producer node into a producer & consumer node, which allocated
extra arrays into the node structure that are never used. This didn't affect
correctness, but increased the memory usage of plain signal nodes (which are
just producers, never consumers).

This fix changes the logic in those operations to simply check if a producer
is also a consumer instead of coercing it into one.

PR Close #56140
2024-05-30 17:44:55 +00:00
Thomas Nguyen e286d3cd3b refactor(core): Remove lambda from error message. (#56161)
This should've been in the previous PR, but a bad rebase removed it.

PR Close #56161
2024-05-30 17:30:53 +00:00
Jessica Janiuk b9b78d12bc ci: update primitives-shared membership (#56189)
This updates the shared primitives ownership list to be correct.

PR Close #56189
2024-05-30 17:28:25 +00:00
Matthieu Riegler 345832f76a ci: Update Saucelabs config to use Andoid 13 and 14 (#55710)
This will allow us to run the test against versions closer to supported targets.

PR Close #55710
2024-05-30 16:43:25 +00:00
Thomas Nguyen caeb7042b0 refactor(core): Switch a .includes to a .indexOf(), as this is currently (#56046)
breaking internal tests that assert no usage of Array ES6 methods.

PR Close #56046
2024-05-30 15:30:52 +00:00
Andrew Kushnir 0529aac5e5 refactor(core): replace AIO link with ADEV one in hydration message (#56178)
This commit updates the content of hydration-related message and replaces AIO with ADEV domain.

PR Close #56178
2024-05-30 14:57:10 +00:00
Kristiyan Kostadinov 9eef041211 refactor(compiler): implement let declarations in render3 ast (#55848)
Introduces a new `LetDeclaration` into the Render3 AST, simiarly to the HTML AST, and adds an initial integration into the various visitors.

PR Close #55848
2024-05-30 14:55:36 +00:00
Kristiyan Kostadinov 1ae06e4fc6 refactor(compiler): implement let declarations in html ast (#55848)
Adds a new `LetDeclaration` node to the AST that captures the `LetStart`, `LetValue` and `LetEnd` tokens into a single node.

PR Close #55848
2024-05-30 14:55:36 +00:00
Kristiyan Kostadinov 62c5b66b41 refactor(compiler): add support for tokenizing let declarations (#55848)
Updates the lexer to produce tokens for `let` declarations. Currently it' behind a flag while the feature is being worked on.

PR Close #55848
2024-05-30 14:55:36 +00:00
Matthieu Riegler 8d75627ddd fix(core): Do not migrate HttpClientModule imports on components. (#56067)
`provideHttpClient()` returns a `EnvironmentProvider` which is not compatible with component providers.

PR Close #56067
2024-05-30 14:55:06 +00:00
Kristiyan Kostadinov 75e811c18b fix(migrations): do not generate aliased variables with the same name (#56154)
Adds some logic to avoid generating expressions like `let $index = $index` in the control flow migration.

Fixes #56152.

PR Close #56154
2024-05-30 14:54:36 +00:00
Angular Robot 3d55073531 build: update cross-repo angular dependencies (#56041)
See associated pull request for more information.

Closes #55806 as a pr takeover

PR Close #56041
2024-05-30 14:53:32 +00:00
Matthieu Riegler 7928e11a0e docs(docs-infra): move back all xterm code to the fw repo (#55642)
Previously, the `@angular/docs` package had `xterm` as dependency but wasn't referencing it. It only had dedicated styles. This commit moves back the styles to the FW repo as it is only used here.

PR Close #55642
2024-05-30 14:52:55 +00:00
Andrew Scott d73127f48d refactor(core): privately export token that indicates if zone CD is provided (#56137)
This will allow us to internally decide how to configure things when the default is zoneless.

PR Close #56137
2024-05-30 13:48:08 +00:00
vidhi hattar e1e7266ced docs: add discord link icon to nav menu (#56149)
PR Close #56149
2024-05-29 21:44:06 +00:00
Pawel Kozlowski 8a3d010d4d release: cut the v18.1.0-next.0 release 2024-05-29 18:38:06 +02:00
Pawel Kozlowski f6d5cb0426 docs: release notes for the v18.0.1 release 2024-05-29 18:13:57 +02:00
naaajii 3b2f88cd90 fix(migrations): handle empty ngSwitchCase (#56105)
empty ngSwitchCase generate `case ()` which isn't valid syntax therefore adding quotes will help prevent us migrate empty case if no condition was provided

fix angular#56030

PR Close #56105
2024-05-29 15:38:38 +02:00
Kristiyan Kostadinov e5a6f91722 feat(core): support TypeScript 5.5 (#56096)
Updates the repo to add support for TypeScript 5.5. Includes resolving some compilation errors and broken tests.

PR Close #56096
2024-05-29 15:33:33 +02:00
Thomas Nguyen 1223122080 refactor(core): Use event_dispatcher in event_replay code. (#56036)
This makes events bubble! This change also contains changes to
dispatcher and event_dispatcher to make replay synchronous,
so that we avoid odd timing issues. This can be split out though.

Lastly, we have one cleanup change to move the mapping from
event type to functions on the element itself.

PR Close #56036
2024-05-29 12:59:23 +02:00
Neil Runcie 09a7e9d41e docs: update links in guide for migrating v14 apps to v15 at angular.dev (#56116)
Fixes an issue in the update guide found at https://angular.dev/update-guide?v=14.0-15.0&l=3 which has links that redirect to v17 documentation. This is because the links were missing the v15 reference within the a tag links.

Fixes #56101

PR Close #56116
2024-05-29 12:52:22 +02:00
TJ Kohli b5e5c90f59 docs: compress favicons (#56133)
Run favicons through a few lossless image optimization algorithms to decrease size and improve loading speed

PR Close #56133
2024-05-29 12:51:08 +02:00
Char2s 400b47ebb1 docs: correct browserslist compatibility docs (#56027)
PR Close #56027
2024-05-29 12:46:12 +02:00
Angular Robot ae11a65818 docs: update Angular CLI help [main] (#56092)
Updated Angular CLI help contents.

PR Close #56092
2024-05-29 12:44:12 +02:00
Sasidharan SD 5442a8d60f docs: fix links in aot compiler page (#56132)
PR Close #56132
2024-05-29 12:40:16 +02:00
Alan Agius 3b077e65c1 test: add back control_flow_migration tests (#56130)
These were incorrectly removed via https://github.com/angular/angular/pull/55391#issuecomment-2135352758

PR Close #56130
2024-05-28 16:48:08 +02:00
Kristiyan Kostadinov fb351300c3 build: update to latest dev infra code (#56128)
Updates the repo to the latest dev infra code which involves updating a patch and renaming all the golden files to end with `.api.md`.

PR Close #56128
2024-05-28 14:42:31 +02:00
Matthieu Riegler b2445a0953 fix(core): link errors to ADEV (#55554) (#56038)
Console error links will now point to adev.

PR Close #55554

PR Close #56038
2024-05-28 12:50:53 +02:00
Harshal e39c01a53f docs: change link from #components-overide to #override-component-providers (#56111)
PR Close #56111
2024-05-28 09:32:38 +02:00
Matthieu Riegler 53ae096c3c docs: fix some errors docs (#55706)
PR Close #55706
2024-05-27 14:52:19 +02:00
Andrew Kushnir ae83646704 fix(core): handle elements with local refs in event replay serialization logic (#56076)
Previously, the event replay serialization logic was located before we verify that a `TNode` exists. `TNode`s may not exist in `tView.data` array in several cases, including cases when there is a local ref used on an element: in this case an extra slot in `LView` contains a reference to the same element and `TNode` is not needed. This commit moves the event replay serialization logic a bit lower, after we check for TNode presence.

Resolves #56073.

PR Close #56076
2024-05-27 13:50:09 +02:00
Aristeidis Bampakos 031e40e6dd docs: update CLI reference (#56060)
PR Close #56060
2024-05-27 11:42:32 +02:00
Sasidharan SD 609179807d docs: fix schematics cli broken link (#56070)
PR Close #56070
2024-05-27 11:40:41 +02:00
Charles Lyding 9d52b8fab0 docs: update tutorials to use v18 (#56043)
All documentation tutorials will now use the recently released version 18
of Angular. Additionaly, the tutorials have been migrated to use the new
`@angular/build` package which does not contain the Webpack related dependencies.
The `first-app` tutorial was not moved to `@angular/build` due to it having
karma related dependencies present which currently requires the Webpack-based
build system during test execution.

PR Close #56043
2024-05-27 11:39:26 +02:00
Ben Halbach df267c59f9 docs: change count to this.count in example (#56080)
PR Close #56080
2024-05-27 11:37:46 +02:00
Matthieu Riegler 857f867d14 docs: add update material to v18 step (#56044)
PR Close #56044
2024-05-27 11:30:46 +02:00
Matthieu Riegler 0aa311e24c docs: add search favicon for seo (#56016)
PR Close #56016
2024-05-27 11:29:17 +02:00
Aristeidis Bampakos c1fdfb4fcc docs: use customized YouTube channel link (#56051)
PR Close #56051
2024-05-27 11:28:26 +02:00
Ben Halbach eb1426c682 docs: remove extra template string termination (#56081)
PR Close #56081
2024-05-27 11:06:24 +02:00
vladboisa 825023801b docs(core): change API link (#55688)
Fix url link for Button Change detection usage

Fixes #556687

PR Close #55688
2024-05-23 18:30:25 +02:00
Andrew Scott 3b4b05d2f7 refactor(core): Remove hybrid mode flag and move scheduler provider location (#55722)
The flag is not used anymore and, as a result, is easier to move the
scheduler provider.

PR Close #55722
2024-05-23 18:15:53 +02:00
Angular Robot 4b26342ec4 build: update io_bazel_rules_sass digest to 2907a45 (#55841)
See associated pull request for more information.

PR Close #55841
2024-05-23 18:12:25 +02:00
Thomas Nguyen 690b0fb9af refactor(core): Create event types that are able to be serialized, captured, or are mouse events. (#55799)
Use these constants across jsaction and Angular.

PR Close #55799
2024-05-23 16:10:47 +02:00
Thomas Nguyen ae9af9104f refactor(core): Make sure not to do anymore jsaction work once everything is replayed. (#55799)
Without this, I think subsequent renders will populate data structures.

PR Close #55799
2024-05-23 16:10:47 +02:00
cexbrayat 4ffa73651c fix(compiler-cli): interpolatedSignalNotInvoked diagnostic for class, style, attribute and animation bindings (#55969)
This extends the diagnostic to catch issues like:

```html
<div [class.green]="mySignal"></div>
<div [style.width]="mySignal"></div>
<div [attr.role]="mySignal"></div>
<div [@triggerName]="mySignal"></div>
```

PR Close #55969
2024-05-23 15:05:02 +02:00
Pawel Kozlowski b94adb9fc7 refactor: use built-in control flow in js-web-frameworks benchmark (#55988)
Migrate the js-web-frameworks benchmark to use the built-in control flow
instead of the ngFor loop.

PR Close #55988
2024-05-23 14:09:38 +02:00
Kristiyan Kostadinov 6aeea69d5b fix(compiler): optimize track function that only passes $index (#55872)
Currently we optimize methods that pass both `$index` and the item into a method. We can take this a step further by also optimizing calls that only pass `$index` into the first parameter.

PR Close #55872
2024-05-23 14:02:30 +02:00
Pawel Kozlowski 760207b254 Revert "fix(core): link errors to ADEV (#55554)" (#56031)
This reverts commit dd0700ff1d.
We will need G3 patch cleanup before this one can land.

PR Close #56031
2024-05-23 13:57:53 +02:00
Joey Perrott 55e33ba75a build: bump in-memory-web-api to v18 (#56018)
This commit updates the in-memory-web-api package versions from v17 -> v18.

PR Close #56018
2024-05-23 12:00:29 +02:00
Matthieu Riegler dd0700ff1d fix(core): link errors to ADEV (#55554)
Console error links will now point to adev.

PR Close #55554
2024-05-23 11:58:54 +02:00
Aristeidis Bampakos 50808733bf docs: update blog link in new Angular Docs (#56022)
PR Close #56022
2024-05-23 11:41:08 +02:00
Jens Kuehlers a67c059ead docs: change robots.txt to allow crawling (#56023)
PR Close #56023
2024-05-23 11:34:25 +02:00
Jens Kuehlers b34a302361 docs: update robots.txt to allow crawlers (#56023)
PR Close #56023
2024-05-23 11:34:25 +02:00
Daniel Schmitz 98cd91a273 docs: using @if instead ngIf (#54623)
PR Close #54623
2024-05-23 11:33:21 +02:00
mgechev 19ea26c2db docs: update the roadmap to reflect latest work (#55979)
PR Close #55979
2024-05-23 11:24:33 +02:00
arturovt 85c171920a fix(zone.js): do not mutate event listener options (may be readonly) (#55796)
Prior to this commit, event listener options were mutated directly, for example,
`options.signal = undefined` or `options.once = false`.

This issue arises in apps using third-party libraries where the responsibility lies
with the library provider. Some libraries, like WalletConnect, pass an abort controller
as `addEventListener` options. Because the abort controller has the `signal` property,
this is a valid case. Thus, mutating options would throw an error since `signal`
is a readonly property.

Even though zone.js is being deprecated as Angular moves towards zoneless change detection,
this fix is necessary for apps that still use zone.js and cannot migrate to zoneless change
detection because they rely on third-party libraries and are not responsible for the code
used in them.

Closes #54142

PR Close #55796
2024-05-22 16:20:34 -07:00
Matthieu Riegler a0690fe19f refactor(core): remove unused preventDefault on listener (#55879)
`wrapListener` was only invoked with `wrapWithPreventDefault` set to `false`.

PR Close #55879
2024-05-22 16:08:39 -07:00
Emma Twersky 76633847a2 docs: add the v18 blog post link to the changelog (#56015)
PR Close #56015
2024-05-22 16:06:51 -07:00
Tom Wilkinson fdd59c49fe refactor(core): Add a new EventDispatcher class. (#55837)
`EventDispatcher` emulates the browser's event dispatch (mostly).
It supports:
 - Bubbling and `stopPropagation`/`stopImmediatePropagation`.
 - `currentTarget` during dispatch.
 - Throwing errors for `preventDefault` if the event is being dispatched
   in replay.
 - Throwing errors for `composedPath()` if event is being dispatched in
   replay.

PR Close #55837
2024-05-22 15:24:01 -07:00
cexbrayat 6024d07559 fix(core): typo in zoneless warning (#55974)
The warning introduced in ae0baa25 mispelled `applications`.

PR Close #55974
2024-05-22 15:22:19 -07:00
Joey Perrott 1e8284c574 ci: don't add redirect from next.angular.dev to vX sites (#56012)
Don't redirect from vX.angular.dev version to the next.angular.dev instance

PR Close #56012
2024-05-22 15:11:22 -07:00
Emma Twersky 9fb6043379 docs: update robots.txt (#56010)
PR Close #56010
2024-05-22 15:09:38 -07:00
twerske 1d774d6175 docs: add angular.dev release banners (#56014)
PR Close #56014
2024-05-22 15:09:10 -07:00
Dylan Hunn 5be6df65eb docs: release notes for the v17.3.10 release 2024-05-22 11:19:33 -07:00
Dylan Hunn 90ecee892d docs: release notes for the v18.0.0 release 2024-05-22 11:01:51 -07:00
Paweł Kubiak 756b891f95 fix(docs-infra): calculate list of Angular Docs versions based on VERSION (#55977)
fix(docs-infra): calculate the list of Angular Docs versions based on VERSION, append --config=release to docs build and serve the script. Support displaying the right color of navigation for the deprecated state.
fix(docs-infra): add scrollbar to version picker
fix(docs-infra): set initial adev docs version to 18
fix(docs-infra): remove --config=release from scripts for local development, write unit tests
fix(docs-infra): update CI tests step
fix(docs-infra): remove rc from the list
fix(docs-infra): update unit test to check count of versions

PR Close #55977
2024-05-22 17:25:52 +00:00
Andrew Scott acdcec9d47 docs: Add experimental and zoneless to nav (#55834)
PR Close #55834
2024-05-22 10:18:54 -07:00
Kristiyan Kostadinov d17e6a5b17 fix(language-service): use type-only import in plugin factory (#55996)
Fixes that the plugin factory was causing TypeScript to be bundled into the language service.

PR Close #55996
2024-05-22 09:52:32 -07:00
Matthieu Riegler 632f9e7d51 docs: Add v18 to update guide (#55993)
PR Close #55993
2024-05-22 16:03:01 +00:00
Joey Perrott b7a2ad2744 fix(docs-infra): use separate templates for the from and to selectors in update guide (#55992)
Use separate template names for the from and to selector dropdowns, otherwise we are only able to change the from value.

PR Close #55992
2024-05-22 15:59:33 +00:00
Dylan Hunn 048847f374 docs: release notes for the v18.0.0-rc.3 release 2024-05-21 14:41:55 -07:00
arturovt afe45616ad fix(service-worker): remove controllerchange listener when app is destroyed (#55365)
This commit updates the `ngswAppInitializer` implementation and removes the `controllerchange`
listener upon the destruction of the `ApplicationRef`. This adjustment aims to prevent memory
leaks. In a zone.js environment, neglecting to do so could lead to the perpetual creation of
a zone task, which captures the zone and obstructs proper garbage collection.

PR Close #55365
2024-05-21 14:04:22 -07:00
twerske a5512d3c4b docs: update robot.txt to index angular.dev (#55617)
PR Close #55617
2024-05-21 13:41:06 -07:00
Tom Wilkinson bb13174bd1 refactor(core): Add a bit to EventInfo to mark resolution. (#55864)
This will prevent running `ActionResolver` logic multiple times while
migrating to use `Dispatcher` to resolve actions rather than
`EventContract`.

PR Close #55864
2024-05-21 12:20:48 -07:00
Angular Robot 0b460a7f75 build: update actions/checkout digest to a5ac7e5 (#55889)
See associated pull request for more information.

PR Close #55889
2024-05-21 12:19:19 -07:00
Sasidharan SD fd2b8892ab docs: fix broken publish library link (#55895)
PR Close #55895
2024-05-21 12:15:12 -07:00
Ben Hong 0c000ac848 docs: add missing border on embedded editor (#55926)
PR Close #55926
2024-05-21 12:14:08 -07:00
Matthieu Riegler 19d782b469 docs(docs-infra): Add update guide to adev (#55638)
PR Close #55638
2024-05-21 12:01:59 -07:00
Joey Perrott e3eb5fea47 ci: properly redirect during rc phase (#55972)
Properly redirect to next.angular.dev during rc phase

PR Close #55972
2024-05-21 11:59:45 -07:00
Kristiyan Kostadinov 08523ec650 fix(compiler): allow comments between connected blocks (#55966)
Fixes that the logic which looks for connected blocks didn't allow for comments between them.

Fixes #55954.

PR Close #55966
2024-05-21 10:37:58 -07:00
garrettld 87c5f3c521 docs(common): fix FormatWidth.Short description (#55821)
PR Close #55821
2024-05-20 23:39:06 -07:00
Andrew Kushnir 14668e47eb docs: declare provideAnimationsAsync() function stable (#55871)
This commit removes the `@developerPreview` label from the `provideAnimationsAsync()` function, effectively declaring it stable.

PR Close #55871
2024-05-20 23:38:18 -07:00
cexbrayat 237eacae61 fix(compiler-cli): dom property binding check in signal extended diagnostic (#54324)
The compiler now checks if a signal is properly called on dom property bindings.
The ideal solution would be for the compiler to check if dom property bindings in general are properly typed,
but this is currently not the case, and it is a bigger task to land this change.
In the meantime, the signal diagnostic is augmented to catch cases like the following:

```
<div [id]="mySignal"></div>
```

PR Close #54324
2024-05-20 23:37:57 -07:00
Thomas Nguyen d75adc5a25 refactor(core): Add additional cleanups to PR- Simplify event handler extraction logic. (#55752)
This should have been part of an earlier commit, but was not merged.

PR Close #55752
2024-05-20 23:37:34 -07:00
Kristiyan Kostadinov ae0baa2522 fix(core): add warning when using zoneless but zone.js is still loaded (#55769)
Users may be using zoneless, but are still loading Zone.js in which case they won't get the full benefits like reduced bundle size. These changes detect such a case and log a warning.

PR Close #55769
2024-05-20 23:37:12 -07:00
Tom Wilkinson 834e627d9e refactor(core): Remove legacy_dispatcher.ts which is no longer needed. (#55784)
Also use `dispatchDelegate` by default for `eventReplayer`.

PR Close #55784
2024-05-20 23:36:51 -07:00
Pawel Kozlowski 831a20b472 refactor(docs-infra): notify on data change inside OnPush component (#55830)
The SecondaryNavigation component was updating state outside of an event handler
without notifying about this change. Modeling state as signal should take
care of proper UI updates (note that I did just a mechanical change here, maybe
there are better ways of dealing with this animations case).

PR Close #55830
2024-05-20 23:33:33 -07:00
arturovt 39fecebd6d docs: update zone-pollution.md (#55876)
Provide a thorough explanation of why third-party libraries should be created outside
of the Angular zone. Using a statement like "authored with Zone.js in mind" may seem
unusual because third-party libraries typically do not have knowledge of Zone.js, nor
should they be developed with it in mind. Therefore, we revise this explanation accordingly.
Additionally, include a section on handling events originating from third-party APIs.

PR Close #55876
2024-05-20 23:30:19 -07:00
Charles Lyding 0ee0002d24 docs: update build system migration URL for CLI (#55891)
The URL for the Angular CLI has been updated to `build-system-migration`
to better reflect the content of the documentation.

PR Close #55891
2024-05-20 23:29:22 -07:00
Joey Perrott 009812bdd9 ci: split ci into privileged and unprivileged workflows (#55907)
Split the workflows to prevent unexpected overlap between environments.

PR Close #55907
2024-05-20 20:33:22 +00:00
Joey Perrott d62dc97c67 Revert "Supply chain attack demo for Google VRP" (#55896)
This reverts commit 6d95131d84.

This change was created by a security researcher and is being reverted as it is a noop.
We intend to follow up with more information in a future blog. Please refer to the pull
request description for the link to this blog.

PR Close #55896
2024-05-20 19:59:08 +00:00
ghost 6d95131d84 Supply chain attack demo for Google VRP 2024-05-20 13:56:56 +03:00
Rahat Ahmed f7894885b8 refactor(core): Cleanup dead jsnamespace code (#55795)
Support for the jsnamespace attribute was removed in #55619.

PR Close #55795
2024-05-17 12:59:41 -07:00
Hyun Don Moon b89c88c73b docs: fix broken link in signals/model (#55811)
PR Close #55811
2024-05-17 12:25:46 -07:00
Jens Kuehlers 7aadf42466 docs: Include info about experimental on adev (#55857)
Copy information about meaning of "experimental"
from angular.io to angular.dev.

PR Close #55857
2024-05-17 12:25:19 -07:00
Andrew Scott cae0d3167d fix(core): exhaustive checkNoChanges should only do a single pass (#55839)
Because exhaustive checks traverse the whole tree regardless of the
dirty state, it breaks some expectations around how change detection
should be running. When a view has transplanted views, it
unconditionally marks all ancestors for traversal, assuming this is fine
because the loop will just traverse them and find nothing dirty.
However, exhaustive checkNoChanages actually refreshes everything during
traversal.

This update ensures the exhaustive check only does a single pass and
also prevents some unnecessary marking of transplanted views for
refresh since we know they're going to be reached.

PR Close #55839
2024-05-17 12:24:36 -07:00
Alex Rickabaugh 9884875c96 fix(compiler-cli): fix type narrowing of @if with aliases (#55835)
When an `@if` expression has an alias, only the type of the alias is
currently narrowed. So for example, suppose `value` is `string|undefined`:

```
@if (value; as alias) {
  {{ value.length }} <!-- error, value may be undefined -->
  {{ alias.length }} <!-- no error, alias is narrowed -->
}
```

This is especially noticeable when the expression contains guards which are
preconditions for the aliased expression:

```
@if (a && b; as alias) {...}
```

In this case, `a` would not be narrowed within the body, even though the
`@if` condition forces it to be truthy. This is a bug.

The reason is that aliased expressions were previously type-checked as:

```
var alias = a && b;
if (alias) {
  // nothing other than alias is narrowed
  ...
}
```

One option considered was to emit `const alias` instead of `var alias`.
TypeScript _does_ trace `const` expressions and narrow their individual
components when the overall expression is guarded:

```
const alias = a && b;
if (alias) {
  // a, b are also narrowed
}
```

However, this narrowing has different semantics than if `a && b` appeared
directly in the guard expression. For example, object properties aren't
narrowed with this approach, so component properties (which are referenced
as e.g. `this.a`) would not be narrowed.

Instead, we amend the guard expression to include both the expression _and_ the
alias variable, enforcing that both are narrowed.

```
var alias = a && b;
if ((a && b) && alias) {
  // a, b, and alias all narrowed correctly.
}
```

This form ensures all conditions within the guard expression get narrowed
while also narrowing the alias variable type.

Fixes #52855

PR Close #55835
2024-05-17 10:14:57 -07:00
Matthieu Riegler eddb4051b8 refactor(forms): remove deprecated symbols (#55723)
Follow-up of #55698 to help remove the symbols from G3.

PR Close #55723
2024-05-17 10:12:01 -07:00
Thomas Nguyen 0e23ed716e docs: Add documentation for event replay (#55802)
PR Close #55802
2024-05-17 10:10:06 -07:00
Dylan Hunn 13601105ec release: cut the zone.js-0.14.6 release (#55845)
PR Close #55845
2024-05-16 17:32:14 -07:00
Paul Gschwendtner 400911e3b8 fix(compiler-cli): do not throw when retrieving TCB symbol for signal input with restricted access (#55774)
Currently when attempting to retrieve a TCB symbol for an input binding
that refers to a signal input with e.g. `protected`, while the
`honorAccessModifiersForInputBindings` flag is `false`, Angular will
throw a runtime exception because the symbol retrieval code always
expects a proper field access in the TCB.

This is not the case with `honorAccessModifiersForInputBindings =
false`, as TCB will allocate a temporary variable when ignoring the
field access. This will then trigger the runtime exception (which we
added to flag such "unexpected" cases). This commit handles it
gracefully, as it's valid TCB, but we simply cannot generate a proper
TCB symbol (yet). This is similar to `@Input` decorator inputs.

In the future we may implement logic to build up TCB symbols for
non-property access bindings, for both signal inputs or `@Input`
inputs. This commit just avoids a build exception.

Related to: #54324.

PR Close #55774
2024-05-16 09:33:02 -07:00
Charles Lyding abdf453b85 docs: Update build system migration title to reflect user action (#55782)
The Angular CLI documentation topic for migrating to the new build system
now has a navigation label of "Migrating to new build system" instead of
"esbuild". This new label better reflects the action a user may want to
take rather than one of the tools used by the new build system.

PR Close #55782
2024-05-16 09:32:29 -07:00
Bouguima, Walid 2bb12ac02f fix(compiler): prevent usage of reserved control flow symbol in custom interpolation context. (#55809)
* Fixes the issue where using a reserved control flow @ symbol in a custom interpolation context yields improper parser feedback.

PR Close #55809
2024-05-16 09:28:13 -07:00
Alan Agius 20a530acb6 fix(zone.js): correctly bundle zone-patch-rxjs (#55826)
https://github.com/angular/angular/pull/53443 caused the a local `rxjs` file to be imported from an entry-point which caused this to be excluded from being bundled due to the name matching `rxjs`.

Closes #55825

PR Close #55826
2024-05-16 09:21:17 -07:00
Alan Agius f3b0e2fbc1 refactor(zone.js): remove tslib from dependencies (#55827)
Iif needed `tslib` code is included directly in the bundled FESM2015 hence making the dependency redundant.

PR Close #55827
2024-05-16 09:15:19 -07:00
cexbrayat 3d5c3d9fff fix(core): error about provideExperimentalCheckNoChangesForDebug uses wrong name (#55824)
The error about `provideExperimentalCheckNoChangesForDebug` mentions `provideCheckNoChangesForDebug` instead.

PR Close #55824
2024-05-16 09:02:28 -07:00
Andrew Scott 23eafb4aa2 docs: release notes for the v18.0.0-rc.2 release 2024-05-15 16:04:23 -07:00
Andrew Scott 7a172f7e03 docs: release notes for the v17.3.9 release 2024-05-15 13:55:39 -07:00
Andrew Scott 84b2351d50 refactor(core): Update error for both zone and zoneless to be only for apps (#55813)
Developers may want to enable zoneless for all tests by default by
adding the zoneless provider to `initTestEnvironment` and then
temporarily disabling it for individual tests with the zone provider
until they can be made zoneless compatible.

PR Close #55813
2024-05-15 13:27:26 -07:00
Thomas Nguyen 99bd9f13f8 refactor(core): Add a test case for content projection. (#55801)
This test actually used to fail until our recent improvements :))

PR Close #55801
2024-05-15 08:57:48 -07:00
Matthieu Riegler 53b0d6adb8 fix(forms): Allow canceled async validators to emit. (#55134)
With this change, If an async validator that should have emitted was cancelled by a non-emitting validator, the status change will be reported on the `AbstractControl.events` observable.

This issue can happen when a `FormControl` is added to a `FormGroup` and a FormGroupDirective/FormControlDirective trigger a non-emitting validation (which cancels the initial validator execution).

Note: The behavior remains the same of the existing `statusChanges` observable as the change was too breaking to land in G3.

fixes: angular#41519

PR Close #55134
2024-05-15 08:56:25 -07:00
Angular Robot cd13d1b290 build: update dependency conventional-changelog to v6 (#55668)
See associated pull request for more information.

PR Close #55668
2024-05-15 08:54:19 -07:00
Angular Robot 4141d70124 build: update dependency gulp-conventional-changelog to v5 (#55669)
See associated pull request for more information.

PR Close #55669
2024-05-15 08:52:30 -07:00
Pawel Kozlowski 35238a2f21 refactor(docs-infra): mark more components as OnPush (#55775)
Use the OnPush change detection strategy in more components to
improve performance and enable zoneless in the future.

PR Close #55775
2024-05-15 08:50:12 -07:00
Angular Robot 36e4ac6ecb build: update scorecard action dependencies (#55786)
See associated pull request for more information.

PR Close #55786
2024-05-15 08:48:20 -07:00
Andrew Scott 4bc05410dd refactor(core): calling autoDetectChanges without params works for zoneless (#55800)
This was mistakenly implemented automatically by the override without
filling in the default value of `true` like it is for the zone-based
fixture.

PR Close #55800
2024-05-15 08:46:30 -07:00
cexbrayat 65b7cb2826 fix(migrations): migrate HttpClientTestingModule in test modules (#55803)
The migration was breaking tests with test modules that imported `HttpClientTestingModule`,
as it removed the JS imports without migrating the module imports.

The migration now handles the case where `HttpClientTestingModule` is used in test modules,
by replacing the module import with the `provideHttpClient` and `provideHttpClientTesting` providers.

Before:
```ts
import { HttpClientTestingModule } from '@angular/common/http/testing';

@NgModule({
  declarations: [AppComponent],
  imports: [HttpClientTestingModule],
})
export class TestModule {}
```

After:
```ts
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';

@NgModule({
  declarations: [AppComponent],
  imports: [],
  providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
})
export class TestModule {}
```

PR Close #55803
2024-05-15 08:45:31 -07:00
Tom Wilkinson f1e3ec2601 refactor(core): Add an ActionResolver option to Dispatcher. (#55757)
This will enable internal usages to migrate from ActionResolver in
EventContrat to ActionResolver in Dispatcher.

PR Close #55757
2024-05-14 15:16:26 -07:00
Tom Wilkinson caedd10597 refactor(core): Move preventDefault to Dispatcher (#55756)
This is a simple move.

PR Close #55756
2024-05-14 14:34:59 -07:00
Joey Perrott 3fae2f1e42 ci: properly rely on adev for the adev-deploy job (#55797)
Properly rely on the adev job so that the job actually triggers

PR Close #55797
2024-05-14 12:52:26 -07:00
Sasidharan SD 56fb556f65 docs: fix production mode broken link (#55794)
PR Close #55794
2024-05-14 12:21:30 -07:00
Alex Rickabaugh f736bea8ee refactor(core): deprecate @Component.interpolation (#55778)
Angular has long had the ability to use different interpolation delimiters
(by default `{{` and `}}`). This concept was copied over from AngularJS,
where AngularJS syntax is included in HTML sent over the network to the
browser. Occasionally developers would use SSR frameworks which _also_ have
interpolation syntaxes of their own, so there was a need to change the
delimiters used by AngularJS to avoid conflicts.

Since Angular templates are always processed by our compiler and the
interpolation characters are never processed by other systems first, this
option is vestigial in Angular and only increases the complexity of our
parser.

DEPRECATED: `@Component.interpolation` is deprecated. Use Angular's
delimiters instead.

PR Close #55778
2024-05-14 11:48:12 -07:00
Angular Robot b6ca7fca96 build: update all non-major dependencies (#55785)
See associated pull request for more information.

PR Close #55785
2024-05-14 11:33:18 -07:00
Joey Perrott 1b8000dd63 ci: release angular.dev on each commit (#55792)
Release angular.dev on each commit to the appropriate version of the documentation site based on the current state of the repository.

PR Close #55792
2024-05-14 11:12:45 -07:00
cexbrayat ccde17db0c fix(migrations): preserve existing properties in HttpClientModule migration (#55777)
The `HttpClientModule` migration was dropping the existing properties other than imports and providers when updating an `@NgModule`, `@Component` or `configureTestingModule`.

PR Close #55777
2024-05-14 11:10:57 -07:00
Angular Robot af065cc005 build: update cross-repo angular dependencies (#55781)
See associated pull request for more information.

PR Close #55781
2024-05-14 10:54:17 -07:00
Andrew Kushnir 0eade1c4db docs: add a note about development status of zone.js (#55746)
PR Close #55746
2024-05-14 10:53:43 -07:00
Thomas Nguyen 3ad120dfe8 refactor(core): Simplify event handler extraction logic. (#55747)
This reuses information already recorded during hydration to
remove jsaction attributes to also stash event handlers. This avoids
a tree walk and looku.

PR Close #55747
2024-05-14 09:38:43 -07:00
Thomas Nguyen 629b255ddb refactor(core): Add four tests and fix code to make tests pass. (#55747)
The first test asserts that bubbling does not work right now.

The second asserts that stopPropagation works, which should pass when test #1 passes too.

The third test asserts properties about the events passed to the event handler.

THe fourth test asserts that mouse events do not translate to jsaction nor help emit the jsaction binary. This required a change in code to make this pass.

PR Close #55747
2024-05-14 09:38:43 -07:00
Alan Agius ef029b8d00 build: switch from rollup and terser to esbuild for creating contract bundle (#55705)
This commit implements the replacement of rollup and terser with esbuild for generating the contract_bundle binary. The transition is facilitated by optimizations aimed at reducing the bundle size.

PR Close #55705
2024-05-13 12:49:30 -07:00
Tom Wilkinson 0cb50317e1 refactor(core): Rename BaseDispatcher to Dispatcher. (#55721)
Rename `BaseDispatcher` to `Dispatcher` and `Dispatcher` to
`LegacyDispatcher`. The `GlobalHandler` type and `stopPropagation`
function needs to be left for now in dispatcher.ts as it was not
exported previously from legacy_dispatcher.ts.

PR Close #55721
2024-05-13 12:30:08 -07:00
Angular Robot 7187394ffe build: update io_bazel_rules_sass digest to fcce061 (#55755)
See associated pull request for more information.

PR Close #55755
2024-05-13 11:20:22 -07:00
Sasidharan SD 8dd5c735c6 docs: add inspecting injector section in devtools (#55764)
PR Close #55764
2024-05-13 11:17:50 -07:00
Matthieu Riegler c8472e5e9e refactor(forms): deprecate unwanted control events aliases (#55698)
This commit deprecates the aliases for the control events to ease the changes in G3
A follow-up commit will remove those deprecated entries.

PR Close #55698
2024-05-13 11:16:15 -07:00
Sasidharan SD b90c6aa2ea docs: add service worker images (#55780)
PR Close #55780
2024-05-13 11:14:50 -07:00
Angular Robot 7c9f4cbf47 build: update cross-repo angular dependencies (#55718)
See associated pull request for more information.

PR Close #55718
2024-05-13 11:12:54 -07:00
Kristiyan Kostadinov aa8df1d029 refactor(core): clean up clang comments and workarounds (#55750)
Since we aren't using clang anymore, we can remove the comments and the workarounds that were in place to prevent it from doing the wrong thing.

PR Close #55750
2024-05-13 11:10:36 -07:00
Kristiyan Kostadinov 533ec52aca refactor(compiler): move variable optimization earlier in pipeline (#55771)
Currently the variable optimization phase happens somewhat late in the process which is okay since the variables are generally static (e.g. `reference()` instruction calls). In some upcoming work we'll have variables that consume slots and require `advance` instructions. To allow for them to be optimized correctly, we need to move the variable optimization phase earlier, at least before we allocate the slots.

PR Close #55771
2024-05-13 11:09:26 -07:00
Sasidharan SD 801e5e1577 docs: fix devtools links (#55766)
PR Close #55766
2024-05-13 11:08:32 -07:00
Charles Lyding 2c0e60eceb docs: initial update of application builder migration instructions for v18 (#55699)
The application migration instructions and information page now contains
updated information related to the v18 release. This includes a reordering
of the migration section to mention the automatic migration first as well
as mention that `ng update` will now ask to perform the migration for v18.

PR Close #55699
2024-05-13 11:06:53 -07:00
Tom Wilkinson 76d0aea89b refactor(core): Remove custom event and replay behavior. (#55695)
These behaviors have been moved back to g3.

PR Close #55695
2024-05-13 09:36:03 -07:00
iteriani 3068de4369 refactor(core): Remove enums from event-dispatch. (#55421)
These cause optimization issues in external.

PR Close #55421
2024-05-13 09:12:44 -07:00
Andrew Kushnir 85ac2de744 ci: update payload size for the event-dispatch-contract script (#55748)
The payload size of the `event-dispatch-contract.min.js` script was reduced by more than 5%, which triggered CI checks. This commit updates a golden file to match the actual size.

PR Close #55748
2024-05-09 19:13:36 -07:00
iteriani 28fb385eec refactor(core): Use early event contract instead of the event contract in bootstrap. (#55587)
This also fixes an existing bug where we erase the jsaction attribute too early.

Now the event contract binary is 608 bytes :D.

PR Close #55587
2024-05-09 14:34:10 -07:00
Thomas Nguyen f5b6b7fa40 refactor(core): Export some more symbols and check for truthiness on event types before adding them. (#55587)
In some cases, we will be passing in undefined for capture events, so handle this.

PR Close #55587
2024-05-09 14:34:10 -07:00
Matthieu Riegler fedeaac8ba fix(forms): Add event for forms submitted & reset (#55667)
This commit adds 2 new events to the unified control event observable.

PR Close #55667
2024-05-09 09:21:14 -07:00
Ben Hong c1915f19c6 docs: fix visible code snippets in first-app tutorial (#55742)
PR Close #55742
2024-05-08 15:46:52 -07:00
Alan Agius c0012865eb refactor(core): a couple of minor changes to the early-event-contract (#55704)
This changes include
- Using multi line comments to write JSDoc comments which improves DX
- Use `this.container` instead of `window.document.documentElement`

PR Close #55704
2024-05-08 14:00:29 -07:00
Doug Parker fb54863773 release: bump Angular DevTools to version 1.0.16 (#55715)
PR Close #55715
2024-05-08 11:11:28 -07:00
Doug Parker eb1af1ed5c refactor(devtools): remove --config snapshot-build and leave a note for Firefox (#55717)
We removed display of the Git SHA in Angular DevTools in https://github.com/angular/angular/pull/55694, so there is no longer a need to stamp release builds in Chrome or Firefox.

I opted to leave a `--config snapshot-build-firefox` option as a no-op which a reader could follow to a comment explaining exactly _why_ we can't stamp Firefox releases. This should hopefully make it less likely that we forget and attempt to re-add this feature in the future only to encounter the same release problems.

PR Close #55717
2024-05-08 11:08:49 -07:00
Andrew Kushnir b9c88dc366 docs: release notes for the v18.0.0-rc.1 release 2024-05-08 09:06:38 -07:00
Andrew Kushnir 0b790891f4 docs: release notes for the v17.3.8 release 2024-05-08 08:49:45 -07:00
Matthieu Riegler 7287fefe7a docs: uwu (#55666)
PR Close #55666
2024-05-07 14:57:26 -07:00
Alan Agius 8305e50f8e build: trigger error when size-tracking is enabled but not in limit file (#55708)
Trigger an error when attempting to enable size-tracking for a project not listed in the integration-payload.json file.

Before this update, size-checks would succeed even if the project wasn't included in the file size limit.

PR Close #55708
2024-05-07 13:39:56 -07:00
Alan Agius 8630dc8149 test: add Integration tests for hydration and event reply (#55708)
This commit introduces integration tests for hydration and event reply functionalities. Additionally, it implements a payload size check for the `event-dispatch-contract.min.js`.

PR Close #55708
2024-05-07 13:39:55 -07:00
Andrew Scott ca6cdcd269 refactor(core): feature for potential zoneless-compatibility debug check (#55663)
This commit adds a feature that is useful for determining if an
application is zoneless-ready. The way this works is generally only
useful right now when zoneless is enabled. Some version of this may be useful in
the future as a general configuration option to change detection to make
`checkNoChanges` pass always exhaustive as an opt-in to address #45612.

Because this is an experimental, debug-only feature, it is okay to merge
during the RC period.

PR Close #55663
2024-05-07 13:39:13 -07:00
Andrew Scott abbaf8f639 refactor(core): Throw a runtime error if both zone and zoneless are provided (#55410)
This commit adds a dev-mode error if both the zone and zoneless
providers are used together.

PR Close #55410
2024-05-07 13:37:42 -07:00
Angular Robot 8cb838f9f6 build: update io_bazel_rules_sass digest to 9a4a4be (#55700)
See associated pull request for more information.

PR Close #55700
2024-05-07 13:36:31 -07:00
Tom Wilkinson 0fb455f72e refactor(core): Move global dispatch behavior into Dispatcher. (#55692)
This behavior is now implemented by calling `dispatch` whether or not
the `action` is populated. The `Dispatcher` then does global dispatch
and early returns if there's no action.

PR Close #55692
2024-05-07 12:00:40 -07:00
Thomas Nguyen 67bb310376 refactor(core): Fix timing of removal of jsaction attribute to be after event replay. (#55696)
This otherwise leads to bugs where, by the time replay needs the attribute, hydration
happens and it's gone.

PR Close #55696
2024-05-07 08:16:16 -07:00
arturovt a9460d08a0 fix(zone.js): remove abort listener on a signal when actual event is removed (#55339)
This commit updates the implementation of the `addEventListener` patcher.

We're currently creating an abort event listener on the signal (when it's provided)
and never remove it. The abort event listener creates a closure which captures `task`
(tasks capture zones and other stuff too) and prevent `task`, zones and signals from
being garbage collected.

We now store the function which removes the abort event listener when the actual event
listener is being removed. The function is stored on task data since task data is already
being used to store different types of information that's necessary to be shared between
`addEventListener` and `removeEventListener`.

Closes #54739

PR Close #55339
2024-05-07 08:07:33 -07:00
Paul Gschwendtner afc057ee92 docs: properly link to developer preview section (#55711)
Fixes an invalid link to the developer preview section.
PR Close #55711
2024-05-07 08:06:42 -07:00
Angular Robot 0fffe5389f build: update all non-major dependencies (#55531)
See associated pull request for more information.

PR Close #55531
2024-05-07 08:05:57 -07:00
AleksanderBodurri 77ae5a391b refactor(devtools): remove git sha stamping from devtools build (#55694)
This stamping is interfering with publishing to the Firefox addons store by brining in the entirety of the `.git` directory as part of the source code necessary for a reproducible build, which Firefox requires as part of it's approval process.

In it's place, we are now using the extension version pulled from the manifest.

PR Close #55694
2024-05-06 16:02:36 -07:00
Andrew Scott 76f2c4fe1a refactor(core): private export token that indicates if zone scheduling is provided (#55690)
This is needed internally to determine whether to provide zone or
zoneless by default.

PR Close #55690
2024-05-06 16:01:48 -07:00
Andrew Scott 9366e170e9 refactor(router): resolve view transition promise in a timeout when unsupported (#55327)
Related to #51131, this change ensures that the router navigation exits
the current event loop before rendering the route when the view transition
feature is enabled, when the browser does not support view transitions.

PR Close #55327
2024-05-06 16:00:53 -07:00
Rahat Ahmed 879537466e refactor(core): Remove unused JSNAMESPACE_SUPPORT from event-dispatch (#55619)
The usage of this option has been removed from google3 code, so we don't
need to keep it around anymore.

PR Close #55619
2024-05-06 14:58:25 -07:00
Andrew Scott 7330b6944d fix(core): TestBed should not override NgZone from initTestEnvironment (#55226)
Prior to this change, `NgZone` was provided by default in TestBed in a
location that would override anything configured in
`TestBed.initTestEnvironment`. This change moves the default `NgZone`
provider to the `RootScopeModule` and these providers can be overridden
by the ones in `additionalModuleTypes`, which are assigned from the
first argument of `initTestEnvironment`. This makes it possible to
configure Zone globally for all tests as opposed to needing to repeat it
in `configureTestingModule` of each suite.

PR Close #55226
2024-05-06 13:33:16 -07:00
Alan Agius 3e1d6e9d6e fix(compiler): maintain multiline CSS selectors during CSS scoping (#55509)
Previously, multiline selectors were being converted into single lines, resulting in sourcemap disruptions due to shifts in line numbers.

Closes #55508

PR Close #55509
2024-05-06 12:39:50 -07:00
Andrew Kushnir 9d3cd9bc83 refactor(animations): make async animations code compatible with Closure compiler (#55686)
Closure compiler optimizations in g3 require `.then` to be present for a dynamic import (or an import should be `await`ed) to detect the set of imported symbols. Currently, the `.then` is located at a later stage in the file, which confuses static code analysis. This change adds the `.then((m) => m)` workaround to satisfy Closure compiler constraints.

PR Close #55686
2024-05-06 12:35:23 -07:00
Alan Agius b3e61ba63f ci: update Renovate configuration: replace matchPackagePatterns with matchDepPatterns (#55683)
This commit addresses a warning in Renovate regarding a deprecated behavior that will be phased out in the future.

```
WARNING: To prevent future issues, replace the usage of matchPackagePatterns with matchDepPatterns (repository=angular/angular, baseBranch=main)
       "packageRule": {
         "matchPackagePatterns": ["^@bazel/.*", "^build_bazel.*"],
         "groupName": "bazel setup",
         "schedule": ["at any time"]
       },
       "packageName": "bazelbuild/rules_nodejs",
       "depName": "build_bazel_rules_nodejs"
```

PR Close #55683
2024-05-06 12:34:09 -07:00
Alan Agius 15e0600521 ci: remove stopUpdatingLabel setting (#55683)
This commit removes the 'stopUpdatingLabel' option from Renovate settings. This option caused pull requests to not automatically rebase when  conflicting.

PR Close #55683
2024-05-06 12:34:09 -07:00
Alan Agius cf84acf44c fix(platform-server): remove event dispatch script from HTML when hydration is disabled (#55681)
Prior to this commit, the included event dispatcher remained in the HTML even when hydration was disabled.

PR Close #55681
2024-05-06 12:33:09 -07:00
Angular Robot 7898957b9d build: lock file maintenance (#55680)
See associated pull request for more information.

PR Close #55680
2024-05-06 12:32:18 -07:00
Alan Agius 73a17904aa build: remove mermaid from deps (#55664)
This dependency is now pulled via `@angular/docs`

PR Close #55664
2024-05-06 12:31:27 -07:00
Alan Agius 9ddb003b6c fix(http): resolve withRequestsMadeViaParent behavior with withFetch (#55652)
This commit addresses dependency injection defects when using the `withFetch` API. Formerly, utilizing `withFetch` led to the automatic setting of `HttpBackend` to `FetchBackend`, which proved problematic in certain scenarios. Notably, conflicts arose when integrating `withRequestsMadeViaParent` and manually overriding tokens, as observed in instances like `InMemoryWebApiModule`.

PR Close #55652
2024-05-06 12:29:53 -07:00
cexbrayat 7a2efd442d fix(migrations): handle more cases in HttpClientModule migration (#55640)
This commit handles two cases that were breaking applications when using the new migration:

- tests using `HttpClientModule` in `TestBed.configureTestingModule` were broken as the import was removed, but the module is still present in the test configuration. It now properly adds `provideHttpClient(withInterceptorsFromDi())` and related imports to the test.
- tests using `HttpClientTestingModule` were migrated to use `provideHttpClient(withInterceptorsFromDi())` but the necessary imports were not added. They are now added by the migration.

PR Close #55640
2024-05-06 12:29:17 -07:00
Andrew Scott 464dae94ee docs: small updates to zoneless docs (#55636)
PR Close #55636
2024-05-06 12:28:36 -07:00
iteriani 8f273ce7a8 refactor(core): Allow the container and the listenable element to be configurable for early event contract. (#55586)
This will allow a multi-app application to listen to early events from different elements and place them
on a separate field on the window.

PR Close #55586
2024-05-06 08:15:54 -07:00
Angular Robot 1872fcd8e0 build: update cross-repo angular dependencies (#55422)
See associated pull request for more information.

PR Close #55422
2024-05-03 13:00:18 -07:00
Alan Agius 6e1e70d3f1 ci: use application builder for integration tests (#55660)
This updates the integration tests to use the application builder.

PR Close #55660
2024-05-03 11:21:06 -07:00
Alan Agius 554a1be51b ci: delate aio-payloads.json (#55659)
This file is no longer used.

PR Close #55659
2024-05-03 11:20:13 -07:00
Alan Agius b80b46215c ci: add adev build as part of the CI process (#55662)
Currently, this is not which caused main to be broken because breakages where not caught during PR

PR Close #55662
2024-05-03 10:20:58 -07:00
Alan Agius b5ab2ef269 build: fix adev build (#55662)
adev is broken at head

PR Close #55662
2024-05-03 10:20:58 -07:00
Alan Agius 46acb55e76 build: update integration tests lock files (#55661)
This should fix CI.

PR Close #55661
2024-05-03 09:17:16 -07:00
Alan Agius aeb3fe26cf build: remove tslint and codelyzer deps from integration tests (#55658)
These are redundant.

PR Close #55658
2024-05-03 08:15:41 -07:00
cexbrayat 14d5094177 docs: typo in RedirectFunction description (#55653)
PR Close #55653
2024-05-03 08:08:12 -07:00
Matthieu Riegler e5331107fd fix(platform-browser): Use the right namespace for mathML. (#55622)
Prior to this change, MathML element were created with the wrong namespace resulting in regular DOM `Element`.

This commit fixes this.

Related to #55608 (but doesn't fix it entirely).

PR Close #55622
2024-05-03 08:07:31 -07:00
Angular Robot 3a930a59f6 build: update dependency typescript to v5.4.5 (#55042)
See associated pull request for more information.

PR Close #55042
2024-05-03 08:06:34 -07:00
Alan Agius 72108bad4d build: update cross-repo angular dependencies (#55654)
See associated pull request for more information.

PR Close #55654
2024-05-03 08:04:40 -07:00
arturovt 9e07b621ea fix(zone.js): add missing APIs to Node.js fs patch (#54396)
This commit updates the list of Node.js `fs` APIs to be patched because
they haven't been updated for a long time. It adds `opendir,lutimes,writev`.
For example, the `opendir` method was added to Node.js in version 12.12.0 in
2019, causing some of the APIs to potentially be always called within the
`<root>` context.

**Note:** There are missing unit tests for these changes because in unit tests,
`fs` is patched by Bazel's Node.js rules and its `node_patches.cjs`. However,
the APIs are successfully patched in the real production code and are called
with the correct context.

PR Close #54396
2024-05-03 08:03:25 -07:00
Doug Parker 58a8f124b0 refactor(devtools): set key in manifest.chrome.json (#55639)
This key comes from the release build of the Chrome extension. Setting it here configures the extension ID of a local build to match the extension ID of the public release. This makes Chrome recognize that local builds are the same extension leading to more intuitive behavior. It's also useful for allowlists of extension IDs to keep the local ID consistent.

PR Close #55639
2024-05-02 14:46:24 -07:00
Andrew Scott 76e7aa8add refactor(core): Update coalescing to just use patched timers in root zone (#55366)
Rather than attempting to use the native timing functions, this commit
simplifies the logic significantly by using the global timer functions
as they are, either patched or unpatched. When Zone is defined, we run
the timers in the root zone. This has more predictable behavior and
timing than (a) using both patched and unpatched versions of timers in
different places (b) trying to get an unpatched timer and failing due to
environment specifics and patches that aren't ZoneJS.

PR Close #55366
2024-05-02 14:43:10 -07:00
Andrew Kushnir 7645325d46 refactor(core): mark @defer APIs as stable (#55625)
This commit removes the `@developerPreview` annotation from the `@defer` APIs, effectively promoting them (and the entire feature!) to stable.

PR Close #55625
2024-05-02 14:42:00 -07:00
Doug Parker b44e35f472 release: bump Angular DevTools to 1.0.15 (#55643)
PR Close #55643
2024-05-02 13:37:34 -07:00
Rahat Ahmed afd87acde4 refactor(core): Turn off JSNAMESPACE_SUPPORT by default (#55598)
All usages in google3 have been deleted so this should be a no-op. Next I'll clean up all the configurations turning this off and then delete the option entirely.

PR Close #55598
2024-05-02 12:34:24 -07:00
twerske c320aa6705 docs: style the nav based on version type (#55628)
PR Close #55628
2024-05-02 12:33:27 -07:00
Kristiyan Kostadinov 2e891ad72a fix(compiler): add math elements to schema (#55631)
Fixes that we didn't have the MathML elements in the schema. Note that we can't discover which tag names are available by looking at globally-available classes, because all MathML elements are `MathMLElement` rather than something like `SVGCircleElement`. As such, I ended up having to hardcode the currently-available tags.

Fixes #55608.

PR Close #55631
2024-05-02 11:12:14 -07:00
cexbrayat 8b5921547c docs: typos in NG0956 (#55630)
PR Close #55630
2024-05-02 11:10:58 -07:00
Angular Robot 45b58059f0 build: update io_bazel_rules_sass digest to 9f8be59 (#55602)
See associated pull request for more information.

PR Close #55602
2024-05-02 11:06:46 -07:00
iteriani 95bf0c85f8 refactor(core): Remove jsaction from element after handling the event. (#55549)
This also adds a test to make sure that the event contract is still listening to other events, especially in the case where we may want partial hydration in the future.

PR Close #55549
2024-05-02 11:04:59 -07:00
Andrew Scott 8cabb7a85d Revert "fix(core): render hooks should not specifically run outside the Angular zone (#55399)" (#55624)
This reverts commit 7e89753eef.

Running render hooks inside the zone is specifically problematic for
`afterRender` hooks. If the callback has async task, it would cause an
infinite change detection. In addition, updating state in render hooks
is generally discourages and certainly should update state in a way that
notifies Angular of the change (either via signal or with `markForCheck`) rather
than relying on ZoneJS to pick it up (which would only work if the
change is done inside an async task).

PR Close #55624
2024-05-02 11:00:29 -07:00
Andrew Scott 7c1b4a49ae fix(core): afterRender hooks registered outside change detection can mark views dirty (#55623)
This commit fixes an error in the looping logic of `ApplicationRef.tick`
when the tick skips straight to render hooks. In this case, if a render
hook makes a state update that requires a view refresh, we would never
actually refresh the view and just loop until we hit the loop limit.

PR Close #55623
2024-05-02 10:58:28 -07:00
Payam Valadkhan 1f2e791c57 refactor(compiler-cli): optimize extra import generation in local compilation mode (#55548)
Currently we add global extra imports to all the files in the compilation unit. However not all the files need extra imports. For example non-Angular files definitely do not need such extra imports, and in some cases these extra imports causes problems as the file is meant to be run the Node but it has Angular dependencies which are not compatible with Node. This change tries to limit extra import generation to a subset of files. Wit hthis change we create extra imports only for the files that contain at least one component whose NgModule is in a different file. This is because all other files do not need extra imports since they are either not Angular files or they already have all the imports that the components need.

PR Close #55548
2024-05-02 10:57:41 -07:00
Kristiyan Kostadinov a0ec2d8915 fix(core): don't schedule timer triggers on the server (#55605)
Fixes that even though we weren't rendering the deferred block the server, we were still triggering the timeout which can delay the response.

Fixes #55475.

PR Close #55605
2024-05-01 15:10:26 -07:00
Emma Twersky fc9602087a docs: update press kit to reduce confusion (#55611)
PR Close #55611
2024-05-01 15:09:33 -07:00
Matthieu Riegler 7ff7dfaee7 docs: fix missing example (#55584)
preview is hidding was responsible for hidding the content.

fixes #55583

PR Close #55584
2024-05-01 15:07:58 -07:00
Angular Robot a33fdfd8da build: update actions/checkout digest to 0ad4b8f (#55537)
See associated pull request for more information.

PR Close #55537
2024-05-01 15:07:18 -07:00
Tom Wilkinson bf25dfae58 refactor(core): Add a boostrapCustomEvent method. (#55603)
This can replace CUSTOM_EVENT_SUPPORT by allowing users to bootstrap
custom event support separately from the `EventContract`.

PR Close #55603
2024-05-01 13:43:27 -07:00
Tom Wilkinson b9a997c467 refactor(core): Remove STOP_PROPAGATION define. (#55582)
This define has been removed at head, and now legacy stop propagation
behavior can be opted into at the LegacyDispatcher level, if necessary.

PR Close #55582
2024-05-01 11:55:31 -07:00
Tom Wilkinson 5903c3752b refactor(core): Move action resolution into a standalone class. (#55523)
This refactor will enable moving this functionality into the dispatcher.

PR Close #55523
2024-05-01 11:54:34 -07:00
Rahat Ahmed cda8bfa8be docs(core): Add event-dispatch README.md (#55521)
PR Close #55521
2024-05-01 11:53:25 -07:00
Andrew Kushnir 379242c910 docs: release notes for the v18.0.0-rc.0 release 2024-05-01 11:50:28 -07:00
Andrew Kushnir 874d33286e docs: release notes for the v17.3.7 release 2024-05-01 11:42:03 -07:00
Doug Parker 7cea897132 release: bump DevTools to 1.0.14 (#55545)
PR Close #55545
2024-04-30 17:01:54 -07:00
Andrew Scott 024e9bf54d refactor(core): Ensure animations are flushed before running render hooks (#55564)
This commit ensures we flush animations by calling renderFactory
begin/end in cases where the ApplicationRef._tick happens in a mode that
skips straight to the render hooks.

PR Close #55564
2024-04-30 15:39:56 -07:00
Doug Parker 3312727aec refactor(zone.js): use Object.prototype.toString directly for improved tree shakability (#55412)
These lines were not tree shakable by Closure Compiler because `.toString()` is special cased as a "pure" function eligible to eliminated if it's return value is unused. However `.toString.call` circumvents this and makes Closure Compiler think the function may have side effects. Switching to `.toString()` should be fine here as `process.toString()` in Node outputs `[object process]` so this should be safe. Presumably the original motivation for this roundabout approach was for type safety reasons which no longer apply as `_global` is `any`.

PR Close #55412
2024-04-30 14:06:43 -07:00
Ben Hong 9f777b692c docs: add README for adev site (#55578)
PR Close #55578
2024-04-30 14:04:56 -07:00
Angular Robot 2ac54f8327 build: lock file maintenance (#55575)
See associated pull request for more information.

PR Close #55575
2024-04-30 14:03:59 -07:00
Andrew Scott 99cf450d38 docs: Reference page anchor scroll consistency (#55566)
The docs-viewer loads asynchronously and can happen after the scroll
event has happened and the Router has attempted to scroll to the
requested position/anchor. This commit saves the scroll event and
handles it again if the cards are loaded after scrolling happens.

PR Close #55566
2024-04-30 14:03:04 -07:00
twerske 73d999f0c7 docs: fix formatting for signal inputs guide (#55275)
PR Close #55275
2024-04-30 14:02:13 -07:00
Serge K Lebedev 7eaa407c22 docs(changelog): remove duplicate mutate removal entry in 17.0.0 (#53471)
PR Close #53471
2024-04-30 14:00:43 -07:00
Andrew Kushnir ff656691c3 release: cut the zone.js-0.14.5 release (#55599)
PR Close #55599
2024-04-30 13:51:16 -07:00
Paul Gschwendtner 0a77825042 build: improve incremental rebuilds of compliance tests (#55594)
Currently whenever a compliance test case TS file is modified, all
compliance tests in repository are rebuilt in partial compilation mode.
This is inefficient and also slows down local development where one may
use a wildcard to run all test targets inside `/test/compliance/...`.

This commit fixes this.

PR Close #55594
2024-04-30 09:22:38 -07:00
Pawel Kozlowski a4a82af865 docs(core): add documentation for errors NG0955 and NG0956 (#55591)
This commit adds detailed description for the errors NG0955 and NG0956.
Those errors correspond to the check introduced in the built-in for loop.

PR Close #55591
2024-04-30 09:21:33 -07:00
Angular Robot 375e9a7c78 build: update scorecard action dependencies (#55589)
See associated pull request for more information.

PR Close #55589
2024-04-30 09:20:06 -07:00
Andrew Scott 66ffeca2de fix(router): Scroller should scroll as soon as change detection completes (#55105)
Using `setTimeout` to delay scrolling can result in scrolling in the
next frame and cause noticeable flicker. This commit scrolls as soon as
the next render happens (or in `setTimeout` if a render does not happen
before then).

fixes #53985

PR Close #55105
2024-04-30 09:19:06 -07:00
Joey Perrott fd544159e3 ci: complete migration to prettier formatting (#55580)
Format the remaining unformatted files in the repository

PR Close #55580
2024-04-29 14:00:16 -07:00
Mikal Callahan 49d3062c0e docs(docs-infra): allow file renaming in code editor (#54989)
Any filename but the main.ts is now editable.

PR Close #54989
2024-04-29 13:42:26 -07:00
Matthieu Riegler 9160a21624 docs: add mention of the HTTP client for interceptors (#55551)
fixes #53911

PR Close #55551
2024-04-29 13:41:04 -07:00
Matthieu Riegler 0650981a54 docs: fix broken link to error doc (#55547)
PR Close #55547
2024-04-29 13:40:03 -07:00
ahmadhakeem18 b87a4c40bf docs: update NgClass example description to match the example's behavior (#55209)
Co-authored-by: Sonu Kapoor <sonukapoor@users.noreply.github.com>

PR Close #55209
2024-04-29 13:39:18 -07:00
ahmadhakeem18 4f9084e514 docs: show the difference between pseudo classes angular uses and native ones in runtime (#53819)
PR Close #53819
2024-04-29 13:35:33 -07:00
Doug Parker 292c987791 refactor(compiler): add handler attribute to XMB output (#54865)
This allows tracking of which tools generated which XMB files and helps attribute Angular usage.

PR Close #54865
2024-04-29 11:56:31 -07:00
Joey Perrott 0d78a92431 refactor: migrate compiler-cli to prettier formatting (#55485)
Migrate formatting to prettier for compiler-cli from clang-format

PR Close #55485
2024-04-29 10:25:43 -07:00
Joey Perrott f307e95459 refactor: migrate zone.js to prettier formatting (#55427)
Migrate formatting to prettier for zone.js from clang-format

PR Close #55427
2024-04-29 09:52:05 -07:00
Joey Perrott 31fdf0fbea refactor: migrate core to prettier formatting (#55488)
Migrate formatting to prettier for core from clang-format

PR Close #55488
2024-04-29 09:49:19 -07:00
Andrew Scott be17de53d4 refactor(core): Permit disabling autoDetect for zoneless fixture (#55494)
The caveat here is that this needs to be done before creating the
fixture. There are some technical issues to overcome with disabling it
after it was already enabled, related to detaching from `ApplicationRef`
without other side effects.

PR Close #55494
2024-04-26 09:42:15 -07:00
Kristiyan Kostadinov 91b1f24d03 fix(migrations): resolve multiple structural issues with HttpClient migration (#55557)
Fixes several issues with the `HttpClient` migration that showed up after I tried updating the Material docs site to the latest v18 release. Includes:
* The migration was assuming that all Angular decorators have at least one argument. This led to a null pointer error that broke the v18 update process when I was testing it.
* The migration incorrectly reimplemented the detection of classes with Angular decorators. This can cause code to be migrated incorrectly and doesn't handle cases like import aliases. I've switched it to use the existing tooling for detecting decorated classes.
* The migration was trying to migrate directives, even though they don't support the `imports` field.
* The migration was detecting `TestBed.configureTestingModule` calls using a raw string match which is very fragile and can be broken by the user's formatting.
* There were syntax errors in the unit tests.
* There were type checking errors in the unit tests, for example none of them were importing the Angular decorators that they were migrating.

There's more room for improvement, but this should resolve the most glaring issues without having to rewrite too much.

PR Close #55557
2024-04-26 09:32:31 -07:00
Matthieu Riegler 4a7402f75d docs: update ChangeDetectionStrategy links (#55553)
fixes #54227
fixes #50943

PR Close #55553
2024-04-26 09:31:41 -07:00
Matthieu Riegler f7233b0589 docs: remove mention of style sanitization. (#55553)
fixes #49566

PR Close #55553
2024-04-26 09:31:41 -07:00
Matthieu Riegler f6e11e67f2 docs: remove image (#55553)
The image was replaced by the following mermaid chart.

PR Close #55553
2024-04-26 09:31:41 -07:00
Matthieu Riegler 5559b7fe63 docs: update app-shell to reflect actual content (#55550)
fixes #55507

PR Close #55550
2024-04-26 09:29:33 -07:00
iteriani 5b4970bbaa refactor(platform-server): Update event_replay_spec to more match production code. (#55517)
Notably, do evals where in SSR we evaluate a contract binary and evaluate scripts.

PR Close #55517
2024-04-25 14:58:11 -07:00
Matthieu Riegler 96972b45ec refactor(devtools): hide hydration error when the component tree is collapsed (#54912)
This commit improves the devtools UX.

PR Close #54912
2024-04-25 14:57:19 -07:00
Matthieu Riegler e0096ef945 refactor(devtools): prevent dblclick on the expand arrow to show the element panel (#54912)
This will improve the UX

PR Close #54912
2024-04-25 14:57:18 -07:00
Matthieu Riegler 54de0f3f0b refactor(devtools): improve signal support. (#54912)
In some cases signals weren't unwraped thus not reading the value correctly. This commit fixes this issue.

PR Close #54912
2024-04-25 14:57:18 -07:00
Matthieu Riegler 8a6027de86 refactor(devtools): fix issue with virtual scroll viewport in the directive forest (#54912)
In some cases the height of the viewport wasn't calculated correctly because of extension tabs quirks. This commit fixes this issue.

Fixes #53704

PR Close #54912
2024-04-25 14:57:18 -07:00
Andrew Scott 356ec6508b refactor(core): Do not duplicate change detection with run coalescing (part 2) (#55403)
This commit prevents doubling change detections when the zoneless
scheduler is notified first, followed by the zone becomeing unstable
(effectively "scheduling" zone-based change detection). When run
coalescing is enabled, this would otherwise result in the zoneless
scheduler running change detection first and then change detection
running again because of the run coalescing since both scheduler use the
same timing function (and then it would be FIFO).

PR Close #55403
2024-04-25 14:31:17 -07:00
Andrew Scott bf8814c6c3 refactor(core): Omit listeners from out-of-zone scheduling when using ZoneJS (#55492) (#55525)
In Angular today, a bound listener automatically marks the view for
check. When using ZoneJS, these listeners are most often executed in the
Angular Zone as well, so synchronization (`ApplicationRef.tick`) will
eventually happen. _However_, developers can opt out of zone-patching
for events in several ways, and often do this for very frequent
listeners like `mousemove`, `resize`, and `scroll`. We do not want to
break existing expectations that these are now "safe" events to have
listeners for by automatically scheduling change detection regardless of
whether the listener executed inside or outside the Angular zone.

In contrast, in order for developers to more easily transition to zoneless,
we need to be able to ensure that components which are using `OnPush`
are, for the most part, compatible with zoneless as well. Because listeners
automatically mark the component for check, developers using `OnPush`
did not/do not need to also call `ChangeDetectorRef.markForCheck` or a
similar API. Unfortunately, this means that we need to consider the
listener callbacks as a notification to schedule a `tick` when Zoneless
is enabled. In the future, we would like to have an opt-out for this
(i.e. signal components) since it's not really how we _want_ things to work.

Also includes the fix for #54919 that got reverted only because it was
easier to revert the set of conflicting commits

PR Close #55525
2024-04-25 12:56:37 -07:00
Kirk Larkin 0dc4df8296 docs: Update di-in-action.md (#55489)
PR Close #55489
2024-04-25 12:55:13 -07:00
Alan Agius 2bd166537b refactor(core): set up framework injector profile exclusively in browser environment (#55530)
This commit modifies the setup of the injector profiler to occur solely when the application is running in a browser context. This adjustment is made because the injector profile serves no purpose when the application is running on the server.

PR Close #55530
2024-04-25 12:53:21 -07:00
Kirk Larkin f4f1d32f7e docs: Update what-is-angular.md (#55536)
PR Close #55536
2024-04-25 12:52:30 -07:00
Matthieu Riegler 5926bf452d refactor(common): increment test coverage (#55532)
Ahead of #55283 and with what we learned from it,  let's improve our test coverage on the i18n subsystem.

PR Close #55532
2024-04-25 12:50:41 -07:00
Matthieu Riegler ae7af8d23b docs: fix the file naming for the NG05000 error (#55519)
PR Close #55519
2024-04-25 12:49:51 -07:00
Andrew Scott 5a52facef7 docs: Add some zoneless documentation (#55500)
Probably needs more work, but it's a start

PR Close #55500
2024-04-25 12:49:16 -07:00
Tom Wilkinson f1d6f867b9 refactor(core): Remove A11Y_SUPPORT_IN_DISPATCHER behavior. (#55497)
The only use case internally has been removed and this can be
accomplished with A11Y_CLICK_SUPPORT_DEFERRED.

PR Close #55497
2024-04-25 10:57:58 -07:00
Andrew Scott 7e89753eef fix(core): render hooks should not specifically run outside the Angular zone (#55399)
The timing of render hook execution is almost entirely identical to
`ngZone.onMicrotaskEmpty`. Developers working towards zoneless
compatibility will need to migrate `onMicrotaskEmpty` calls to use
`afterNextRender`/`afterRender` instead. This, however, would lead to
confusing issues if there are promises in the callbacks because
`onMicrotaskEmpty` emits inside the Angular zone while render hooks
execute outside today. This is problematic because it's not documented
and does not produce any notification or error message when async work
is done inside the hooks that requires change detection. Instead, change detection
simply does not run, and this behavior has proven to be surprising to
developers who are used to ZoneJS change detection behavior.

fixes #55299

PR Close #55399
2024-04-25 09:06:34 -07:00
Kristiyan Kostadinov 97eea8d50e fix(core): resolve error for multiple component instances that use fallback content (#55478)
Currently fallback content for `ng-content` gets declared and rendered out in one go. This breaks down if multiple instances of the same component are used where one doesn't render the fallback content while the other one does, because the `TNode` for the content has to be created during the first creation pass.

These changes resolve the issue by always _declaring_ the template, but only rendering it if the slot is empty.

Fixes #55466.

PR Close #55478
2024-04-25 09:04:01 -07:00
ice-blaze e54c950e92 refactor(forms): replace errors with hasError() (#55379)
Material documentation use hasError. For homogeneity reason, this commit
will adopt material style.

Fixes #55378

PR Close #55379
2024-04-25 08:57:29 -07:00
Kirk Larkin 03934f674e docs: Update lightweight-injection-tokens.md (#55490)
PR Close #55490
2024-04-25 08:55:46 -07:00
yuichi.imori e723635058 docs: Correct code references in Tutorial 01. (#55506)
PR Close #55506
2024-04-25 08:55:07 -07:00
Ben Hong a45a640474 docs: update security guide link references (#55514)
PR Close #55514
2024-04-25 08:54:31 -07:00
Ben Hong 0b53fdb3b4 fix(docs-infra): add cookie consent gtag event default state (#54574)
This PR sets a default state for cookie consent of 'denied'. The other part of the PR exists in the angular/dev-infra repo which will grant permission when the user accepts the cookie banner.

PR Close #54574
2024-04-25 08:53:06 -07:00
Pawel Kozlowski 90389add7a fix(core): hide implementation details of ExperimentalPendingTasks (#55516)
The ExperimentalPendingTasks service was accidently exposing one of its
internal fields as a public one. This commit fixes this by marking the
field in question as private.

PR Close #55516
2024-04-25 08:51:01 -07:00
Andrew Kushnir 3667352ce5 docs: release notes for the v18.0.0-next.6 release 2024-04-25 08:37:59 -07:00
Andrew Kushnir 4cec9fc67a release: bump the next branch to v18.1.0-next.0 2024-04-25 08:37:59 -07:00
Andrew Kushnir e478180b9b docs: release notes for the v17.3.6 release 2024-04-25 08:28:37 -07:00
Andrew Kushnir e3d5607caf Revert "refactor(core): Ensure DOM removal happens when no app views need refresh (#55132)" (#55524)
This reverts commit a07ea069e5.

PR Close #55524
2024-04-24 16:35:57 -07:00
Andrew Kushnir 28905ab9ae Revert "refactor(animations): Ensure async animations applies changes when loaded in zoneless (#55132)" (#55524)
This reverts commit 9ab36cfe0a.

PR Close #55524
2024-04-24 16:35:57 -07:00
Andrew Kushnir 70b478ff59 Revert "refactor(core): Omit listeners from out-of-zone scheduling when using ZoneJS (#55492)" (#55524)
This reverts commit 617bc3337d.

PR Close #55524
2024-04-24 16:35:57 -07:00
Andrew Scott 617bc3337d refactor(core): Omit listeners from out-of-zone scheduling when using ZoneJS (#55492)
In Angular today, a bound listener automatically marks the view for
check. When using ZoneJS, these listeners are most often executed in the
Angular Zone as well, so synchronization (`ApplicationRef.tick`) will
eventually happen. _However_, developers can opt out of zone-patching
for events in several ways, and often do this for very frequent
listeners like `mousemove`, `resize`, and `scroll`. We do not want to
break existing expectations that these are now "safe" events to have
listeners for by automatically scheduling change detection regardless of
whether the listener executed inside or outside the Angular zone.

In contrast, in order for developers to more easily transition to zoneless,
we need to be able to ensure that components which are using `OnPush`
are, for the most part, compatible with zoneless as well. Because listeners
automatically mark the component for check, developers using `OnPush`
did not/do not need to also call `ChangeDetectorRef.markForCheck` or a
similar API. Unfortunately, this means that we need to consider the
listener callbacks as a notification to schedule a `tick` when Zoneless
is enabled. In the future, we would like to have an opt-out for this
(i.e. signal components) since it's not really how we _want_ things to work.

PR Close #55492
2024-04-24 12:25:08 -07:00
Pawel Kozlowski ac863ded48 feat(core): provide ExperimentalPendingTasks API (#55487)
The new ExperimentalPendingTasks API lets developers to add and remove
tasks that control applications stability: a pending task prevents
application from being stable.

This API is important for all the use-cases that depend on the concept
of stability and SSR serialization is a notable example.

Closes #53381

PR Close #55487
2024-04-24 11:23:10 -07:00
Andrew Scott d0c2e1beb8 docs: fix public API from primitives (#55515)
PR Close #55515
2024-04-24 11:22:05 -07:00
Alan Agius cf2e1b3e5d refactor(platform-server): add link that explains nonce application/json (#55505)
Add a link to the specs explaining why nonce is not needed for `application/json`.

PR Close #55505
2024-04-24 10:48:38 -07:00
Joey Perrott b28d0bf704 ci: update @angular/ng-dev (#55513)
Update @angular/ng-dev to latest version

PR Close #55513
2024-04-24 10:46:01 -07:00
Andrew Scott 9ab36cfe0a refactor(animations): Ensure async animations applies changes when loaded in zoneless (#55132)
Async animations currently works in Zones because the render factory
promise resolve causes change detection to happen.

fixes #54919

PR Close #55132
2024-04-24 10:33:47 -07:00
Andrew Scott a07ea069e5 refactor(core): Ensure DOM removal happens when no app views need refresh (#55132)
This change ensures that `ApplicationRef.tick` flushes animations by
calling `rendererFactory2.end`. This might not have happened before if
there were no views that needed to be refreshed.

This is also likely to fix a potential regression caused by #53718 even
in zone apps where animations don't get flushed when no views attached
to ApplicationRef are dirty.

PR Close #55132
2024-04-24 10:33:47 -07:00
Andrew Kushnir 307bc1d6b6 refactor(platform-server): event contract script should follow event dispatch script (#55502)
This commit fixes an issue where event contract init script was injected into the page before the inlined event dispatch script. That resulted in runtime exceptions, since event contract relies on some code being present on a page already.

PR Close #55502
2024-04-24 10:32:36 -07:00
Andrew Kushnir fc90549c9b refactor(core): event replay should account for pages with no events (#55502)
This commit updates the logic to take into account a situation when Event Replay feature is enabled (using `withEventReplay()` method), but there were no events configured in an application. In this case, there is no need to setup an event dispatcher and trigger event replay.

PR Close #55502
2024-04-24 10:32:35 -07:00
Andrew Kushnir bbd0cbfacf refactor(core): disable property renaming for the event dispatch script (#55502)
This commit updates Terser config to disable property renaming for the event delegation script (that we later inline into the HTML during SSR). The problem is that event dispatcher relies on some functions on the EventContract class to have original names after after minification, we loose an ability to call those functions.

PR Close #55502
2024-04-24 10:32:35 -07:00
Tom Wilkinson 4bf3d89dae refactor(core): Remove stop propagation beahavior. (#55435)
This removes stop propagation behavior from `EventContract` and removes
the associated stop propagation logic.

PR Close #55435
2024-04-24 09:12:34 -07:00
Tom Wilkinson 98e861395c refactor(core): Split Dispatcher into base class. (#55372)
This will enable refactoring existing usages of the Dispatcher that use
APIs that we do not intend to support, like registerGlobalHandler and
registerEventInfoHandlers to use the LegacyDispatcher.

PR Close #55372
2024-04-24 09:10:04 -07:00
iteriani 811fe001c9 refactor(core): Replay events from the event contract using the dispatcher. (#55467)
This should accomplish event replay during full page hydration.

PR Close #55467
2024-04-23 16:08:36 -07:00
Angular Robot 2e2ca5e9d9 build: update scorecard action dependencies (#55473)
See associated pull request for more information.

PR Close #55473
2024-04-23 15:17:40 -07:00
fdonzello c001b05c77 refactor(forms): added control name in console errors (#55397)
When a formControlName is used without a parent formGroup, an error is
logged in the console. Before this commit, there was no information
about which control had the issue. Now, it's reported and the
troubleshoot is much faster.

PR Close #55397
2024-04-23 15:16:57 -07:00
Andrew Scott c175bca364 fix(core): DeferBlockFixture.render should not wait for stability (#55271)
The `DeferBlockFixture.render` function should not await the
`whenStable` promise of the fixture. This does not allow developers to
test any intermediate states that might occur between rendering the
initial content and the full app stability.

fixes #55235

PR Close #55271
2024-04-23 15:12:39 -07:00
Angular Robot 86967af904 build: lock file maintenance (#55343)
See associated pull request for more information.

PR Close #55343
2024-04-23 13:37:56 -07:00
Leonardo Collazo Klenina b1e63491bb Update making-requests.md (#55390)
docs(http): change "buffer.length" to "buffer.byteLength"

property "length" does not exist on type "ArrayBuffer" but "byteLength" does
PR Close #55390
2024-04-23 13:34:33 -07:00
Joey Perrott 5a10f405d3 fix(core): complete the removal of deprecation async function (#55491)
Remove the `async` function in favor of using `waitForAsync` instead.

BREAKING CHANGE: `async` has been removed, use `waitForAsync` instead.

PR Close #55491
2024-04-23 13:29:46 -07:00
Kirk Larkin 79a33e4366 docs: Update dependency-injection.md (#55432)
PR Close #55432
2024-04-23 13:29:14 -07:00
Kirk Larkin 86ad37a446 docs: Update dependency-injection-context.md (#55455)
PR Close #55455
2024-04-23 13:27:15 -07:00
Kirk Larkin 62bbed8f5a docs: Update dependency-injection-providers.md (#55454)
PR Close #55454
2024-04-23 13:26:16 -07:00
Kirk Larkin cd390c26a8 docs: Update creating-injectable-service.md (#55449)
PR Close #55449
2024-04-23 13:25:54 -07:00
Kirk Larkin 89a5c7e6f8 docs: Update creating-injectable-service.md (#55449)
PR Close #55449
2024-04-23 13:25:54 -07:00
Angular Robot f4d894b58a docs: update Angular CLI help [main] (#55409)
Updated Angular CLI help contents.

PR Close #55409
2024-04-23 13:24:22 -07:00
lilbeqiri bb673ff458 docs: improve grammar at tutorial steps (#55414)
Fix the grammar issues at some of the tutorial pages making sure they sound correctly.

PR Close #55414
2024-04-23 13:22:58 -07:00
vladboisa 900b5e7dfd docs(docs-infra): fix broken links (#55446)
Add the missing folder's for links

Fixes #55442

docs(docs-infra): fix template reference link

Change the broken link

PR Close #55446
2024-04-23 13:21:48 -07:00
Drew Mares c773238055 docs: Fix typo in waitForAsync example (#55407)
The previous example had an incomplete code snippet that would not work if copied and pasted as is. There were two missing closing parentheses, one for the `inject` function, and the other for the `waitForAsync` function.

PR Close #55407
2024-04-23 13:16:15 -07:00
Joey Perrott 1f288b269a ci: reenable integration tests (#55463)
Begin running integration tests again after they were unintentionally disabled

PR Close #55463
2024-04-23 13:13:20 -07:00
Alan Agius 5674c644ab fix(platform-server): add nonce attribute to event record script (#55495)
This commit fixes an issue where the nonce attribute was not added when `CSP_NONCE` token was provided.

PR Close #55495
2024-04-23 13:12:47 -07:00
Kristiyan Kostadinov 5948193e13 fix(core): skip defer timers on the server (#55480)
Adds a check that disables the timer scheduling for `placeholder` and `loading` blocks on the server since the underlying timer will delay the server response.

Fixes #55475.

PR Close #55480
2024-04-23 13:06:52 -07:00
Alan Agius bcce85af72 refactor(animations): remove deprecated matchesElement from AnimationDriver (#55479)
BREAKING CHANGE: Deprecated `matchesElement` method has been removed from `AnimationDriver` as it is unused.

PR Close #55479
2024-04-23 13:06:27 -07:00
Alan Agius eecde2e413 build: remove no longer required bazel windows patch (#55477)
This patch is no longer required.

PR Close #55477
2024-04-23 13:06:03 -07:00
Alan Agius cba336d4f1 refactor(platform-browser): remove deprecated transfer state APIs (#55474)
BREAKING CHANGE: Deprecated `StateKey`, `TransferState` and `makeStateKey` have been removed from `@angular/platform-browser`, use the same APIs from `@angular/core`.

PR Close #55474
2024-04-23 13:05:38 -07:00
Angular Robot 1e54956025 build: update actions/checkout action to v4.1.3 (#55472)
See associated pull request for more information.

PR Close #55472
2024-04-23 13:05:13 -07:00
Matthieu Riegler 8f62aac6ea docs(docs-infra): improve filtering performances on API page (#55470)
Identity tracking was not a good choice here 🙃

PR Close #55470
2024-04-23 13:04:51 -07:00
Matthieu Riegler 7aff867c78 docs: fix links to packages. (#55469)
fixes #55458

PR Close #55469
2024-04-23 13:04:21 -07:00
Angular Robot c4823dfd63 build: update actions/checkout digest to 1d96c77 (#55464)
See associated pull request for more information.

PR Close #55464
2024-04-23 13:03:49 -07:00
Doug Parker d2d275a275 docs(devtools): update README to be more clear for extension reviewers (#55406)
Mozilla requires add-ons to have reproducible builds and this is managed directly by human reviewers and need to understand how to build Angular DevTools correctly. This commit defines a reproducible way of building Angular DevTools which is useful for reviewers and contributers.

The actual changes I made include:
1. Moving local development content into `devtools/README` (deleting `devtools/DEVELOPING.md`) and explicitly stating the Node version as well as global Yarn install to be clear about the correct way to build the extension. This should make it easier for reviewers to understand and reproduce builds.
2. Moving release instructions to a separate doc to reduce noise as well as making some minor clean ups there.

I briefly considered pointing reviewers at a new `devtools/docs/reviewers.md` doc, but decided against it because I want these instructions to be maintained in a single location where contributors and reviewers use the same content. This way any changes don't miss one of these sets of users. If reviewers have trouble with this format (dev builds isn't useful to reviewers and some content is repeated from other docs for contributors) then we can consider splitting out to a separate `reviewers.md` file. But until then, I'd like to try sharing this content and see how it works out in practice.

PR Close #55406
2024-04-23 13:02:49 -07:00
Matthieu Riegler 8dab93fe2c docs: adev tutorials use v17. (#55437)
Partial revert of #54891. Webcontainers do not support node ^18.19.1 which is required by the v18 CLI.

Until this is solved by the stackblitz team, we're stucked with v17 based tutorials

PR Close #55437
2024-04-23 13:00:45 -07:00
Matthieu Riegler d34c033902 refactor(common): Deprecate Local Data API functions (#54483)
Ahead of delegating the i18n subsystem to the `Intl` API, this commit introduce the intention to remove those functions from the public API.

DEPRECATED: `getCurrencySymbol`, `getLocaleCurrencyCode`, `getLocaleCurrencyName`, `getLocaleCurrencySymbol`, `getLocaleDateFormat`, `getLocaleDateTimeFormat`, `getLocaleDayNames`, `getLocaleDayPeriods`, `getLocaleDirection`, `getLocaleEraNames`, `getLocaleExtraDayPeriodRules`, `getLocaleExtraDayPeriods`, `getLocaleFirstDayOfWeek`, `getLocaleId`, `getLocaleMonthNames`, `getLocaleNumberFormat`, `getLocaleNumberSymbol`, `getLocalePluralCase`, `getLocaleTimeFormat`, `getLocaleWeekEndRange`, `getNumberOfCurrencyDigits`

PR Close #54483
2024-04-23 12:22:43 -07:00
Matthieu Riegler f914f6a362 feat(migrations): Migration schematics for HttpClientModule (#54020)
This migration will allow developers to migrate the deprecated `HttpClientModule`, `HttpClientJsonpModule` & `HttpClientXsrfModule` to their respective provider functions.

PR Close #54020
2024-04-23 12:12:31 -07:00
Matthieu Riegler ef665a40a5 refactor(http): Deprecate HttpClientModule & related modules (#54020)
This commit deprecates the `HttpClientModule` and other related http modules. Those can be replaced by provider function only.

Angular is an opinionated framework, feature guidance will help developer choose the recommended way to enable feature (like Http requests here).

Note: This is not an indication of deprecation for `NgModule`. The deprecated module's only purpose here was to define providers. This can be done directly by the provide function pattern.

DEPRECATED: `HttpClientModule`, `HttpClientXsrfModule` and `HttpClientJsonpModule`

As mentionned, those modules can be replaced by provider function only.

PR Close #54020
2024-04-23 12:12:31 -07:00
iteriani 3d84c988cd refactor(core): Make some minor changes to facilitate testing and usage of event-dispatch. (#55411)
The change in the index is to allow the framework to add a type to the object that is passed from the contract to the dispatcher. ie

registerDispatcher(contract, (eventInfo: EventInfoWrapper) => ...).

The latter is to return the event contract so that tests can clean it up.

PR Close #55411
2024-04-23 11:05:44 -07:00
Andrew Scott f84d7dde87 test(core): Wait for zone stability before test completion (#55468)
Need to wait for microtaskEmty to emit or test will leak into others.

PR Close #55468
2024-04-22 17:06:43 -07:00
Andrew Kushnir 9894278e71 fix(core): make ActivatedRoute inject correct instance inside @defer blocks (#55374)
`RouterOutlet` uses a unique injector logic that returns a value that correspond to the `ActivatedRoute` token dynamically. This logic breaks when a component/directive/pipe that injects the `ActivatedRoute` is located within a `@defer` block, because defer creates an `EnvironmentInjector` instance, which doesn't have that dynamic logic.

We've added some special handling of the `OutletInjector` in one of the previous commits, but it was incomplete and it was not covering cases when different routes use the same component. This commit updates defer logic to re-establish this dynamic behavior for `ActivatedRoute` by creating an instance of the `OutletInjector` when a parent injector was also an instance of `OutletInjector`.

This fix is a short-term solution and longer term we should find a way to achieve the dynamic behavior that Router relies on, but without adding a special case logic into defer.

Resolves #54864.

PR Close #55374
2024-04-22 12:01:36 -07:00
Matthieu Riegler aea5f05c59 docs: change aio to adev for the issue template (#55347)
PR Close #55347
2024-04-22 11:58:18 -07:00
Matthieu Riegler bd784fca99 docs: fix link to inject-based-di tutorial. (#55453)
Fixes #55451

PR Close #55453
2024-04-22 11:57:34 -07:00
Kristiyan Kostadinov 8aef3f8dde docs: remove performance warning for directive composition (#55448)
Removes the warning about performance from the directive composition API docs since some recent benchmarks have snown that their effect is negligible.

PR Close #55448
2024-04-22 11:52:38 -07:00
Alan Agius b0f1552ffe build: use installed deps from main repo (#55433)
This commit updates the zone.js types tests to use the deps installed in the main repo

PR Close #55433
2024-04-22 11:40:07 -07:00
Alan Agius cb7fd67656 ci: disable updates to zone.js types test (#55433)
This breaks renovate
```
### ⚠ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

 - any of the package files in this branch needs updating, or
 - the branch becomes conflicted, or
 - you click the rebase/retry checkbox if found above, or
 - you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

##### File name: packages/zone.js/test/typings/yarn.lock

```
error Package "zone.js" refers to a non-existing file '"/tmp/renovate/repos/github/angular/angular/dist/bin/packages/zone.js/npm_package"'.
```

PR Close #55433
2024-04-22 11:40:06 -07:00
Matthieu Riegler bac5ba328e refactor(http): remove direct usage of HttpStatusCode (#55434)
PR #51670 removed the usage of `const enum`. As a consequence HttpStatusCode that were previously inlined now pull and retains the (fairly large) `HttpStatusCode` enum.

By intermediate constants, we prevent the framework from pulling this big enum by default.

PR Close #55434
2024-04-22 11:36:51 -07:00
Andrew Kushnir ba0036c5c3 refactor(platform-server): remove inlined JSAction script when no events to replay (#55428)
JSAction script is inlined into the HTML by the build process to avoid extra blocking request. The script looks like this:

```
<script type="text/javascript" id="ng-event-dispatch-contract">...</script>
```

This commit updates the logic to remove JSAction if event replay feature is disabled or if there are no events to replay.

PR Close #55428
2024-04-22 11:36:21 -07:00
Alan Agius b153459aaf build: update event dispatch contract to be outputted in IIFE (#55377)
This script is intended to be inlined in the HTML and thus IIFE should be preffered.

PR Close #55377
2024-04-22 11:35:48 -07:00
Matthieu Riegler ebfba7751d docs: add anchors to packages on api page (#55338)
PR Close #55338
2024-04-22 11:28:41 -07:00
Angular Robot a877a62884 build: update actions/cache digest to 0c45773 (#54950)
See associated pull request for more information.

PR Close #54950
2024-04-22 11:26:53 -07:00
Julien Saguet 6f88d80758 feat(http): allow caching requests with different origins between server and client (#55274)
Expose `HTTP_TRANSFER_CACHE_ORIGIN_MAP` injection token in public api. This is useful when different origins are used to access the same APIs between server and browser.

Fixes #53702

PR Close #55274
2024-04-22 11:26:09 -07:00
AleksanderBodurri efe78d5565 fix(devtools): allow DevTools to fail gracefully for unsupported versions of Angular. (#55233)
Angular DevTools depends on many modern Angular features in order to function. As a result, at present the last officially supported version is v12. Angular DevTools may function for some Angular 9, 10 and 11 applications, but they are not officially supported.

This commit fixes an issue where DevTools would not inject a backend script into an Angular application if it detected it was below version 12. This backend script is important because it's used to inform the DevTools panel that the inspected application is in fact Angular, but that it is not on a supported version.

Angular 9, 10 and 11 applications that successfully have Angular DevTools initialize will now have a red highlight and tooltip on their version number, informing the user that they are using Angular DevTools on a version of Angular that is no longer supported.

Angular DevTools for applications that are below version 9 will continue to display the "Angular Devtools supports Angular versions 12 and above" message.

PR Close #55233
2024-04-22 11:25:20 -07:00
Pawel Kozlowski 832fafc6b5 refactor(core): warn developers about collection re-creation in @for loop (#55314)
This commit introduces a check plus an associated warning for situations where
the combination of the collection change and the tracking expression resulted
in the entire view structure managed by @for to be re-created.

The check uses the following conditions before raising a warning:
- the entire collection was re-created and there were no other operations (ex.: move);
- views in a collection are considered "expensive" to re-create;
- a developer is using tracking by identity.

The last condition tries to capture cases where changes to immutable data
collections can cause significent performance and / or corectness problems.

Note that this warning might be "overreacting" and report cases where
the collection re-creation is the intended behavior. Still, the assumption is that
most of the time it is undesired.

PR Close #55314
2024-04-22 11:24:11 -07:00
Andrew Scott 74333e6221 refactor(core): conditionally read data from apply args (#55465)
This commit fixes an error in a previous commit which attempted to read
`data` from the first item in the apply args array, even if it was not
defined.

PR Close #55465
2024-04-22 09:49:05 -07:00
Joey Perrott b1dffa4abe refactor: migrate platform-* to prettier formatting (#55423)
Migrate formatting to prettier for platform-* from clang-format

PR Close #55423
2024-04-19 13:49:24 -07:00
Joey Perrott 488c711a57 refactor: migrate localize to prettier formatting (#55423)
Migrate formatting to prettier for localize from clang-format

PR Close #55423
2024-04-19 13:49:24 -07:00
Joey Perrott a2aca69bd3 refactor: migrate forms to prettier formatting (#55423)
Migrate formatting to prettier for forms from clang-format

PR Close #55423
2024-04-19 13:49:24 -07:00
Angular Robot a743d37f1c build: update scorecard action dependencies (#55419)
See associated pull request for more information.

PR Close #55419
2024-04-19 13:26:38 -07:00
Alan Agius 15f19820b0 build: update Domino to 8f228f8862540c6ccd14f76b5a1d9bb5458618af (#55424)
This contains the fix for https://github.com/angular/angular/issues/55416

PR Close #55424
2024-04-19 13:24:25 -07:00
Thomas Nguyen a730f09ae9 feat(core): Add a public API to establish events to be replayed and an attribute to mark an element with an event handler. (#55356)
These will be consumed by the event-dispatch contract to replay events. The contract and the dispatcher inclusion will be in followups.

PR Close #55356
2024-04-19 13:12:21 -07:00
Angular Robot b67e11a521 build: update cross-repo angular dependencies (#54891)
See associated pull request for more information.

PR Close #54891
2024-04-19 08:51:09 -07:00
Alan Agius 164dde45e6 refactor(migrations): remove v17 migrations (#55391)
This commit removes of migrations introduced in version 17, along with the relocation of a migration from 17.3 to version 18. This ensures that this is ran for users who may have updated from one minor to another without executing `ng update`

PR Close #55391
2024-04-19 06:31:28 -07:00
Matthieu Riegler 4d61501031 docs: fix filePath for manual api docs. (#55388)
Path should have a leading slash.

PR Close #55388
2024-04-19 06:30:34 -07:00
Matthieu Riegler 1bea1fe8a0 docs: improvements for API pages (#55388)
* add link for source files
* add deprecation message for methods
* add usage notes for methods

Fixes #55196
Fixes #52641

PR Close #55388
2024-04-19 06:30:34 -07:00
Kristiyan Kostadinov 7a16d7e969 fix(compiler-cli): don't type check the bodies of control flow nodes in basic mode (#55360)
Angular only checks the contents of template nodes in full type checking mode. After v17, the new control flow always had its body checked, even in basic mode, which started revealing compilation errors for apps that were using the schematic to automatically switch to the new syntax.

These changes mimic the old behavior by not checking the bodies of `if`, `switch` and `for` blocks in basic mode. Note that the expressions of the blocks are still going to be checked.

Fixes #52969.

PR Close #55360
2024-04-19 06:29:56 -07:00
Pawel Kozlowski e67a730688 refactor(core): warn about duplicated keys when using built-in @for (#55243)
This commit a new check that warn users about duplicated keys detected given
a tracking expression and a collection iterated over with @for. Duplicated keys
should be avoided as those are more expensive to manage and can result in
incorrect UI display.

PR Close #55243
2024-04-19 06:28:58 -07:00
Andrew Scott a0eebcd6d1 refactor(core): Add error tracking for infinite notifications (#55231)
This commit adds helpful stack information for the case when change
detection continues to be triggered in the event loop and would cause
the browser to freeze.

PR Close #55231
2024-04-19 06:25:46 -07:00
Andrew Scott b47ac4d7c7 refactor(core): Account for Promise.resolve(() => updateState()) pattern in zoneless (#55231)
There is an existing pattern that zone-based applications use to avoid
`ExpressionChangedAfterItHasBeenCheckedError` which is also used in
`NgModel`: update the state in a microtask instead of doing it
synchronously. This defers the state update to another round of change
detection, and with ZoneJS, also still executes in the same event loop.
These types of changes across multiple rounds of change detection were
still executed before the browser paint.

This update allows the `NgModel` workaround to continue working in
Zoneless. This may not be permanent and is certainly still not
advisable. Render hooks (`afterNextRender`/`afterRender`) will execute between these
rounds of change detection when they are intended to be run after all
DOM updates completed.

PR Close #55231
2024-04-19 06:25:46 -07:00
Alan Agius 8eacb6e4b9 feat(http): exclude caching for authenticated HTTP requests (#55034)
This update modifies the transfer cache logic to prevent caching of HTTP requests that require authorization. To opt-out from this behaviour use the `includeRequestsWithAuthHeaders` option in `withHttpTransferCache`

BREAKING CHANGE: By default we now prevent caching of HTTP requests that require authorization . To opt-out from this behaviour use the `includeRequestsWithAuthHeaders` option in `withHttpTransferCache`.

Example:
```ts
withHttpTransferCache({
  includeRequestsWithAuthHeaders: true,
})
```

Closes: #54745

PR Close #55034
2024-04-19 06:25:22 -07:00
Joey Perrott ca517d7f2c refactor: migrate language-service to prettier formatting (#55405)
Migrate formatting to prettier for language-service from clang-format

PR Close #55405
2024-04-18 14:18:38 -07:00
Joey Perrott 8f69c83b84 refactor: migrate compiler to prettier formatting (#55398)
Migrate formatting to prettier for compiler from clang-format

PR Close #55398
2024-04-18 14:18:08 -07:00
Joey Perrott a5b5b7d5ef refactor: migrate core/primitives to prettier formatting (#55387)
Migrate formatting to prettier for core/primitives from clang-format

PR Close #55387
2024-04-17 15:55:32 -07:00
Andrew Scott 4a42961393 feat(router): withNavigationErrorHandler can convert errors to redirects (#55370)
This commit adds the ability to return `RedirectCommand` from the error
handler provided by `withNavigationErrorHandler`. This will prevent the
error from being surfaced in the `events` observable of the Router and
instead convert the error to a redirect. This allows developers to
have more control over how the Router handles navigation errors. There
are some cases when the application _does not_ want the URL to be reset
when an error occurs.

resolves #42915

PR Close #55370
2024-04-17 15:53:02 -07:00
Andrew Scott 18a43b56e5 refactor(core): Prevent running change detection twice with run coalescing and zoneless (#55352)
This commit ensures we correctly handle the exit from the zone.run in
the zoneless scheduler. Run coalescing would delay the `onMicrotaskEmpty` event
until after we have exited the change detection triggered by the
zoneless scheduler and mean that the subscription cannot determine if
`ApplicationRef.tick` should be skipped.

PR Close #55352
2024-04-17 15:50:59 -07:00
Gerald Monaco 5f06ca8f55 feat(core): add HOST_TAG_NAME token (#54751)
For ideal DOM usage, you would not unwrap an ElementRef outside of the browser. However, it's reasonable to want to find the tag name of the host node on the server, and so this introduces a HOST_TAG_NAME token that can be injected to read this value.

PR Close #54751
2024-04-17 15:50:31 -07:00
Angular Robot e1eae847db build: update github/codeql-action action to v3.25.0 (#55358)
See associated pull request for more information.

PR Close #55358
2024-04-17 18:02:48 +02:00
Pawel Kozlowski 011cc06411 release: cut the v18.0.0-next.5 release 2024-04-17 17:55:10 +02:00
Pawel Kozlowski 9d2704c258 docs: release notes for the v17.3.5 release 2024-04-17 17:49:40 +02:00
Tom Wilkinson a34267b72e refactor(core): Switch stopPropagation default to false (#55351)
Flip `stopPropagation` constructor parameter default to `false` for
`EventContract` and `EventContractMultiContainer`. Change type for
`EventContract` to `false` to indicate that no values besides `false`
should be passed. This enables removing all usages of `stopPropagation`
in `EventContract` and leaving only usages of `stopPropagation = true`
for `EventContractMultiContainer`.

PR Close #55351
2024-04-17 11:29:38 +02:00
Tom Wilkinson 0cec9e4f9a fix(core): Fix null dereference error addEvent (#55353)
When `cleanUp` is called `containerManager` is set to null. Currently
the `EventContract` API assumes that users know not to call further
methods on `EventContract`, but this lead to a bug in a downstream app,
b/333750059. So instead, this makes a defensive check to make sure it's
not null.

PR Close #55353
2024-04-17 11:29:00 +02:00
Alan Agius 9f5e90e03d build: make JSA contract binary accessible (#55361)
This commit integrates the JSA contract binary into the NPM package and ensures its accessibility by including it in the package exports. This adjustment is essential for enabling Angular CLI to effectively access and inject the script. Additionally, sourcemaps are removed from the minified bundle to prevent their inclusion in the HTML page.

PR Close #55361
2024-04-17 10:37:31 +02:00
Andrew Scott ff686f3ca5 refactor(core): Permit detectChanges with zoneless ComponentFixture (#55325)
This commit loosens the restrictions on calling `ComponentFixture.detectChanges`
when using the zoneless scheduler. While we don't necessarily think it's
a good idea, the thought is that it's unnecessary mental overhead to
diverge behaviors in the API when zoneless is enabled versus when it is
not. Instead, these opinionated restrictions can be considered when we
look at new testing APIs.

PR Close #55325
2024-04-17 08:07:52 +02:00
Ben Hong c778977445 docs: update v0 render to v17 (#55368)
PR Close #55368
2024-04-17 08:01:26 +02:00
Alan Agius 3b0de30b37 refactor(common): remove deprecated isPlatformWorkerApp and isPlatformWorkerUi API (#55302)
BREAKING CHANGE: The deprecated `isPlatformWorkerUi` and `isPlatformWorkerApp` have been removed without replacement, as they serve no purpose since the removal of the WebWorker platform.

PR Close #55302
2024-04-17 08:00:01 +02:00
Doug Parker 5f859727e2 release: bump Angular DevTools version to 1.0.13 (#55371)
PR Close #55371
2024-04-17 07:53:11 +02:00
Andrew Scott de7447d15e fix(core): Angular should not ignore changes that happen outside the zone (#55102)
When Angular receives a clear indication that change detection should
run again, this should not be ignored, regardless of what Zone it
happened in. This change updates the default change detection scheduling
approach of Zone-based applications to ensure a change detection will
run when these events happen outside the Angular zone (which includes,
for example, updating a signal that's read in a template, setting an
input of a `ComponentRef`, attaching a view marked for check, calling
`ChangeDetectorRef.markForCheck`, etc.).

This does not apply to applications using `NoopNgZone` or those which
have a custom `NgZone` implementation without ZoneJS.

The impact of this change will most often be seen in existing unit tests. Tests
execute outside the Angular Zone and this can mean that state in the
test is not fully recognized by Angular. Now that Angular will ensure
change detection _does_ run, even when the state update originates from
outside the zone, tests may observe additional rounds of change
detection compared to the previous behavior. Often, this should be seen
as more correct and the test should be updated, but in cases where it is
too much effort to debug, the test can revert to the old behavior by adding
`provideZoneChangeDetection({schedulingMode: NgZoneSchedulingMode.NgZoneOnly})`
to the `TestBed` providers.

fixes #55238
fixes #53844
fixes #53841
fixes #52610
fixes #53566
fixes #52940
fixes #51970
fixes #51768
fixes #50702
fixes #50259
fixes #50266
fixes #50160
fixes #49940
fixes #49398
fixes #48890
fixes #48608
fixes #45105
fixes #42241
fixes #41553
fixes #37223
fixes #37062
fixes #35579
fixes #31695
fixes #24728
fixes #23697
fixes #19814
fixes #13957
fixes #11565
fixes #15770
fixes #15946
fixes #18254
fixes #19731
fixes #20112
fixes #22472
fixes #23697
fixes #24727
fixes #47236

BREAKING CHANGE:

Angular will ensure change detection runs, even when the state update originates from
outside the zone, tests may observe additional rounds of change
detection compared to the previous behavior.

This change will be more likely to impact existing unit tests.
This should usually be seen as more correct and the test should be updated,
but in cases where it is too much effort to debug, the test can revert to the old behavior by adding
`provideZoneChangeDetection({schedulingMode: NgZoneSchedulingMode.NgZoneOnly})`
to the `TestBed` providers.

Similarly, applications which may want to update state outside the zone
and _not_ trigger change detection can add
`provideZoneChangeDetection({schedulingMode: NgZoneSchedulingMode.NgZoneOnly})`
to the providers in `bootstrapApplication` or add
`schedulingMode: NgZoneSchedulingMode.NgZoneOnly` to the
`BootstrapOptions` of `bootstrapModule`.

PR Close #55102
2024-04-16 17:27:04 -07:00
Alex Rickabaugh a5623dc14b Revert "refactor(core): warn about duplicated keys when using built-in @for (#55243)" (#55373)
This reverts commit 9f7b9ed87a. Reason: g3
users reported a bug in the logic that produces false warnings in some
cases.

PR Close #55373
2024-04-16 17:11:08 -07:00
Andrew Scott e6425f7bc1 refactor(core): use patched timers in root zone for zoneless scheduler (#55367)
Rather than attempting to use the native timing functions, this commit
simplifies the logic significantly by using the global timer functions
as they are, either patched or unpatched. When Zone is defined, we run
the timers in the root zone. This has more predictable behavior and
timing than (a) using both patched and unpatched versions of timers in
different places (b) trying to get an unpatched timer and failing due to
environment specifics and patches that aren't ZoneJS.

We will try to update the coalescing behavior of ZoneJS in a future PR
to also just use the patched version of the timers instead of the
"fakeTopEvent" workaround with the native timers.

PR Close #55367
2024-04-16 16:31:19 -07:00
Andrew Scott f09c5a7bc4 feat(core): Add zoneless change detection provider as experimental (#55329)
This commit adds the zoneless change detection provider function to the
public API surface as experimental.

PR Close #55329
2024-04-16 20:51:25 +02:00
Andrew Scott 785c3c1dd4 refactor(core): Calling ApplicationRef.tick should cancel scheduled change detections (#55290)
This commit ensures that manually calling ApplicationRef.tick will
result in any scheduled change detections being canceled. There is no
need for the scheduled one to run because it was manually done by the
`tick` already.

PR Close #55290
2024-04-16 20:50:35 +02:00
Andrew Scott c3a5acb8cc refactor(core): change detection should not be scheduled during appRef.tick (#55290)
This commit ensures that change detection is not scheduled if the
scheduler is notified during an applicationRef.tick

PR Close #55290
2024-04-16 20:50:35 +02:00
arturovt 3bc63eaaf3 fix(service-worker): avoid running CDs on controllerchange (#54222)
This commit updates the implementation of `ngswAppInitializer` to configure
the `controllerchange` event listener outside of the Angular zone. This adjustment
is made to prevent unnecessary change detections, as the `controllerchange` event
is unrelated to view updates.

**NOTE**: This change may result in breaking unit tests that implicitly rely on a
specific number and sequence of change detections for their assertions to pass.

PR Close #54222
2024-04-16 17:29:59 +02:00
Matthieu Riegler e606ac6023 refactor(core): transform Predicate from interface to type (#54566)
This interface should have been a type as there are no other properties

PR Close #54566
2024-04-16 17:26:53 +02:00
Kristiyan Kostadinov 4eb0165750 fix(compiler): remove support for unassignable expressions in two-way bindings (#55342)
Two-way bindings are meant to represent a property binding to an input and an event binding to an output, e.g. `[(ngModel)]="foo"` represents `[ngModel]="foo" (ngModelChange)="foo = $event"`. Previously due to a quirk in the template parser, we accidentally supported unassignable expressions in two-way bindings.

In #54154 the quirk was fixed, but we kept support or some common expression because of internal usages. Now the internal usages have been cleaned up so the backwards-compatibility code can be deleted.

Externally a migration was added in #54630 that will automatically fix any places that depended on the old behavior.

BREAKING CHANGE:
Angular only supports writable expressions inside of two-way bindings.

PR Close #55342
2024-04-16 17:26:09 +02:00
Thomas Nguyen d28614b90e feat(core): Modify EventType from an enum to an object. (#55323)
This is needed to reduce the binary size of the event contract.

PR Close #55323
2024-04-16 15:36:45 +02:00
Thomas Nguyen bce5e2344f feat(core): Add build target for jsaction contract binary. (#55319)
Right now this binary sits at 9.5kb. Additional changes to the library will
be done to reduce the binary size, such as converting event_type from
an enum to an object, and other code size reductions.

PR Close #55319
2024-04-16 12:09:08 +02:00
Kristiyan Kostadinov 7d5bc1c628 fix(compiler): remove container index from conditional instruction (#55190)
Stops passing in the `containerIndex` argument to the `conditional` instruction since it isn't being used anymore.

PR Close #55190
2024-04-16 10:23:30 +02:00
cexbrayat 32eb23defb refactor(compiler): duplicate instructions in template pipeline (#54776)
Both `textInterpolate` and `collateInterpolationArgs` were doing the same work.

PR Close #54776
2024-04-16 10:21:52 +02:00
Matthieu Riegler 9afa2ea345 refactor(compiler-cli): include filepath for DocEntry (#55201)
This is allow the API docs to provide a direct link to implementation on github.

PR Close #55201
2024-04-15 17:41:45 +02:00
Pawel Kozlowski 43cf23954e refactor(migrations): exit developer preview for built-in control flow (#55348)
This commit removes the warning about developer preview in our
built-in control flow migration.

PR Close #55348
2024-04-15 17:29:12 +02:00
Pawel Kozlowski f17d0b414e docs: exit developer preview for built-in control flow (#55348)
This commit removes the warning about developer preview in our
built-in control flow documentation page.

PR Close #55348
2024-04-15 17:29:12 +02:00
Paul Gschwendtner 3471c41ca9 build(docs-infra): fix playground lezer parsing (#55349)
When we started fixing the version mismatch with local 1st-party
packages, we also re-routed all dependencies like `@lezer/javascript`
into `adev/node_modules`. This works fine, but results in a different
version mismatch because the codemirror dependencies may resolve the
Angular version from `/node_modules`- causing some subtle complex
runtime error.

This commit fixes this by only re-routing dependencies that have
dependency on e.g. `@angular/core` into `adev/node_modules`.

Fixes #55298.

PR Close #55349
2024-04-15 16:36:39 +02:00
Pawel Kozlowski 9f7b9ed87a refactor(core): warn about duplicated keys when using built-in @for (#55243)
This commit a new check that warn users about duplicated keys detected given
a tracking expression and a collection iterated over with @for. Duplicated keys
should be avoided as those are more expensive to manage and can result in
incorrect UI display.

PR Close #55243
2024-04-15 16:10:27 +02:00
Pawel Kozlowski cfed97d2a9 docs: update public APIs golden after doc changes (#55346)
Build got broken after merging https://github.com/angular/angular/pull/54577
due to the missing golden files update for the public API.

PR Close #55346
2024-04-15 14:19:54 +02:00
hansi_reit 5eda3bf5f0 docs: add missing usage-notes (#54577)
Fixes #54228

PR Close #54577
2024-04-15 12:25:40 +02:00
Matthieu Riegler 3af54d5114 docs: fix links to output function (#55335)
fixes #55334

PR Close #55335
2024-04-15 11:09:33 +02:00
Andrew Scott 571a61beeb refactor(core): add the fakeTopEvent workaround to zoneless scheduler (#55324)
Add the same fix to the zoneless scheduler that was needed for zone
coalescing (#36839).

PR Close #55324
2024-04-12 16:10:06 -07:00
Andrew Scott e41a52286f Revert "refactor: move example generation into adev, removing content from aio (#55263)" (#55326)
This reverts commit 9bc15994ce.

PR Close #55326
2024-04-12 14:57:05 -07:00
Matthieu Riegler 5cf5f04460 build: bump to node 18.20 to support v18 (#55162)
The v18 CLI requires node `^18.19.1`, so we need to bump the node version to be able to run ADEV with v18.

PR Close #55162
2024-04-12 14:51:44 -07:00
Andrew Scott 6534c035c0 fix(core): Remove deprecated Testability methods (#53768)
This commit removes the long-deprecated Testability methods that track
pending tasks. This is done by NgZone today and will be done by other
APIs in zoneless.

BREAKING CHANGE: Testability methods `increasePendingRequestCount`,
`decreasePendingRequestCount` and `getPendingRequestCount` have been
removed. This information is tracked with zones.

PR Close #53768
2024-04-12 14:49:23 -07:00
Andrew Scott fdd560ea14 feat(core): Add ability to configure zone change detection to use zoneless scheduler (#55252)
This commit adds a configuration option to zone-based change detection
which allows applications to enable/disable the zoneless scheduler.
When the zoneless scheduler is enabled in zone-based applications,
updates that happen outside the Angular zone will still result in a
change detection being scheduled. Previously, Angular change detection
was solely based on the state of the Angular Zone.

PR Close #55252
2024-04-12 12:29:05 -07:00
Andrew Scott c9abe775d0 docs: Simply redirect function example for router (#55317)
PR Close #55317
2024-04-12 10:43:26 -07:00
Andrew Scott 11523c1cb7 docs(router): Add some additional docs for new Router features (#55184)
This commit adds some additional documentation for recent router
features.

PR Close #55184
2024-04-12 10:22:04 -07:00
Angular Robot c3e34f1822 build: update babel dependencies to v7.24.4 (#55257)
See associated pull request for more information.

PR Close #55257
2024-04-12 10:21:24 -07:00
Mo Ibrahim f947dd5ba4 docs: fix repeated note in "Add an Input to the component" section (#55306)
PR Close #55306
2024-04-12 10:14:01 -07:00
Jeremy Elbourn 145356c22e docs: add team docs for when to use dev preview and experimental (#55308)
Adds a brief team doc for when to use developer preview and experimental
API tags.

PR Close #55308
2024-04-12 10:10:50 -07:00
Charles Lyding 5c29416d3e refactor(language-service): add a plugin factory initialize helper (#55264)
An implementation of a TypeScript server plugin module factory has
been added to the main plugin code which minimizes the amount of
infrastructure code necessary to directly setup the Angular plugin.
This is not yet used externally but can be integrated in the future.

PR Close #55264
2024-04-12 18:21:29 +02:00
Angular Robot 75a186e321 build: update io_bazel_rules_sass digest to c3f163f (#55307)
See associated pull request for more information.

PR Close #55307
2024-04-12 10:34:39 +02:00
Leon Senft f2f2c2acc0 test(core): fix expectations that accidentally used incorrect matchers (#55294)
Expect that the number of template executions is `===` to a number, rather than expect that it
does not contain a number. As they were, these expectations would pass regardless of the expected
value.

PR Close #55294
2024-04-12 07:38:52 +02:00
Matthieu Riegler ab910e2476 build(http): Mark the http tests as flaky because of one particular transferCache test. (#55255)
There is one particular transfer cache test that seldom fails. Let's mark it as flaky for now as this issue is non-obvious.

PR Close #55255
2024-04-11 20:50:19 +02:00
Thomas Nguyen 1ee9f32621 feat(core): Synchronize changes from internal JSAction codebase. (#55182)
1: Remove USE_EVENT_PATH, which has no users.

2: Create a new `EventActionInfo` object to represent actions, update all `EventInfoWrapper` users.

3: Fix `stopPropagation` behavior in JSAction Dispatcher - it should only `stopPropagation` if an action is found, which is only known during normal dispatch rather than global.

PR Close #55182
2024-04-11 17:27:39 +02:00
ehlemur 6fef658cc3 docs(core): add missing space (#55287)
Add missing space after period in section describing producers and consumers.

PR Close #55287
2024-04-11 17:25:33 +02:00
Chinthoorie 0a8c48e76e refactor(compiler-cli): move config initialization into constructor (#54975)
refactor(compiler-cli): move config initialization into constructor
PR Close #54975
2024-04-11 11:20:17 +02:00
Andrew Scott aae062e8db release: cut the v18.0.0-next.4 release 2024-04-10 16:18:45 -07:00
Andrew Scott 69927ce103 docs: release notes for the v17.3.4 release 2024-04-10 15:17:39 -07:00
Andrew Scott 19a238dfee Revert "refactor(core): warn about duplicated keys when using built-in @for (#55243)" (#55293)
This reverts commit e3696ad0d6.
caused a test failure internally

PR Close #55293
2024-04-10 13:45:49 -07:00
Rahat Ahmed 92debf4476 ci: Merge primitives-shared and primitives-event-dispatch groups (#55273)
This simplifies the approvals necessary for the event dispatch directory

PR Close #55273
2024-04-10 10:59:43 -07:00
Angular Robot 66e8cd2f8a docs: update Angular CLI help [main] (#55267)
Updated Angular CLI help contents.

PR Close #55267
2024-04-10 10:51:43 -07:00
Angular Robot bc9114a547 build: update github/codeql-action action to v3.24.10 (#55258)
See associated pull request for more information.

PR Close #55258
2024-04-10 10:50:50 -07:00
Paul Gschwendtner 28b3c9214c build: do not clear stdout of architect-cli when building adev (#55282)
Similar to what we did for aio, we should not clear the architect CLI
output in Bazel. This messes up with the output and makes debugging
hard.

PR Close #55282
2024-04-10 10:48:39 -07:00
Paul Gschwendtner 0ae7542d8c build(docs-infra): disable caching of adev inside bazel (#55282)
Similar to `aio`, disables caching inside Bazel as it would be discarded
anyway and is likely a source of slowness then.

PR Close #55282
2024-04-10 10:48:39 -07:00
Paul Gschwendtner f82898436e build(docs-infra): fix version mismatch of local built packages (#55282)
There is quite some trickery going on with the adev build related to
local packages:

- Adev builds using npm packages from `/node_modules`
- At runtime, we are adding `HEAD` packages for e.g. `@angular/core` to
  the bundles.
- At build time, the CLI, or Angular devkit may accidentally resolve to
  `@angular/core` from `/node_modules/`— which is the core version from
  npm, transitively installed via `@angular/docs`.

This causes a version mismatch, leading to issues like:

- CLI throwing because of a mismatch. https://github.com/angular/angular/issues/54858#issuecomment-2047188739
- Compiler changes not being picked up. https://github.com/angular/angular/issues/54858#issuecomment-2041322427

This commit attempts to fix this by:

- Linking all Angular `HEAD` packages into `adev/node_modules`. The
  current logic attempts to link into `/node_modules`, but this does not
  override existing `@angular/core`!
- Linking all direct external NPM packages, like
  `@angular_devkit/build-angular` into `adev/node_modules` without their
  transitive deps. This allows proper resolution of e.g. compiler as
  node looks in `adev/node_modules` first, and falls back for the rest
  to the execroot `node_modules`, or symlink target destination (if
  `preserveSymlinks=false`).

Note: This is still not 100% ideal because a direct external NPM
dependency may have a transitive dependency that has another transitive
dependency on `@angular/core`. In those cases, the may be a conflict
that is not resolvable until we switch to a Bazel toolchain with better
first party resolution support.

PR Close #55282
2024-04-10 10:48:38 -07:00
Paul Gschwendtner e742787c6f docs: add guide for the output() function (#54946)
Adds a guide for angular.io that introduces the new `output()` function
(and `outputFromObservable`).

PR Close #54946
2024-04-10 10:40:41 -07:00
Pawel Kozlowski e3696ad0d6 refactor(core): warn about duplicated keys when using built-in @for (#55243)
This commit a new check that warn users about duplicated keys detected given
a tracking expression and a collection iterated over with @for. Duplicated keys
should be avoided as those are more expensive to manage and can result in
incorrect UI display.

PR Close #55243
2024-04-10 10:39:23 -07:00
Alan Agius 9b903c52d8 docs: remove ng doc link (#55284)
This command has been removed in version 18.

PR Close #55284
2024-04-10 10:38:41 -07:00
Andrew Scott acf5f73a7b Revert "fix(core): TestBed should not override NgZone from initTestEnvironment (#55226)" (#55286)
This reverts commit e9a0c86766.
flakes and broken tests. needs more investigation.

PR Close #55286
2024-04-10 10:37:42 -07:00
Andrew Scott 6993146a25 refactor(http): Do not contribute to stability when using provideHttpClientTesting (#54974)
`HttpClient` uses the `PendingTasks` service to contribute to
application stability. This was added in v16 to support SSR without
relying on an infinite `setTimeout` with ZoneJS like it did pre-v16.
Prior to version 16, this was also only done on the server and did not
affect clients or unit tests (https://github.com/angular/angular/commit/28c68f709cdc930e12bac51a266e7bf790656034).

Today, `PendingTasks` contribute to `ApplicationRef.isStable` but do not
contribute to the stability of `ComponentFixture`. This divergence in
stability behavior was not intended and we plan to make these two
stability indicators the same again, like they were when it was solely
based on the state of the Zone.

By aligning the two behaviors again, this would include all pending
tasks in the stability of fixtures. After investigation, this seems
likely to be a pretty large breaking change. Tests appear to quite often use
`await fixture.whenStable` when there are unfinished requests that have
not been mocked or flushed.

This change prevents request in `HttpClient` from contributing to
stability through the `PendingTasks` automatically but only when using
`HttpClientTesting`. In this scenario, requests need to be expected and
flushed manually for them to resolve. When the test backend and controllers
aren't used, requests should resolve on their own so `await fixture.whenStable`
shouldn't be particularly affected or problematic.

PR Close #54974
2024-04-10 09:27:40 -07:00
Angular Robot cae993c3b7 build: lock file maintenance (#55241)
See associated pull request for more information.

PR Close #55241
2024-04-09 15:22:11 -07:00
Matthieu Riegler 3547e1e769 refactor(forms): emit status/value event in a consistant order (#55198)
We emit `ValueChangeEvent` first and then `StatusChangeEvent`

PR Close #55198
2024-04-09 15:21:39 -07:00
Angular Robot 4be03d64ee build: update all non-major dependencies (#55164)
See associated pull request for more information.

PR Close #55164
2024-04-09 15:20:52 -07:00
Jeffrey Smith 11705f58a7 fix(common): skip transfer cache on client (#55012)
transfer cache interceptor should not run again on the client as it is intended for server to client handoff

PR Close #55012
2024-04-09 14:45:36 -07:00
Charles Lyding bd236cc150 fix(language-service): implement getDefinitionAtPosition for Angular templates (#55269)
The `getDefinitionAtPosition` function may be called by consumers instead
of `getDefinitionAndBoundSpan` with the later of which already implemented.
The `getDefinitionAtPosition` result is a subset of what `getDefinitionAndBoundSpan`
returns and currently delegates to that function.

PR Close #55269
2024-04-09 14:04:21 -07:00
Matthieu Riegler 1c6553e823 refactor(compiler-cli): Link to adev (#55043)
Replace aio links with to adev guides

PR Close #55043
2024-04-09 12:23:09 -07:00
Matthieu Riegler d364f6ecc9 docs: redirect upgrade guide to aio (#55043)
Adev doesn't document upgrade anymore.

PR Close #55043
2024-04-09 12:23:09 -07:00
Matthieu Riegler f45fbb0f43 docs: remove deprecation details link (#55043)
PR Close #55043
2024-04-09 12:23:09 -07:00
Matthieu Riegler 457d02cca3 docs: Use new Urls to drop the docs url mapper (#55043)
PR Close #55043
2024-04-09 12:23:09 -07:00
Martin Machava 216199dd4d docs(forms): validate email field with proper validator (#55142)
PR Close #55142
2024-04-09 12:15:29 -07:00
Matthieu Riegler 4b31a88592 refactor(core): Remove zone assertion from hydration cleanup. (#55214)
In zoneless apps with hydration, this assertion was throwing.

Fixes #52160

PR Close #55214
2024-04-09 12:12:59 -07:00
Martin Machava bc394de75a docs: fix input name (#55141)
This commit fixes the name of the input used for the email.

PR Close #55141
2024-04-09 11:21:05 -07:00
Joey Perrott 9bc15994ce refactor: move example generation into adev, removing content from aio (#55263)
Remove the content from aio and set up the example generation in adev

PR Close #55263
2024-04-09 11:18:48 -07:00
Matthieu Riegler 323611141b docs: split CLI subcommands in separate doc page (#55185)
PR Close #55185
2024-04-09 11:05:18 -07:00
Matthieu Riegler 9d76cc367b docs: update readme link (#55155)
fixes#55153

PR Close #55155
2024-04-09 10:32:49 -07:00
cexbrayat 9c776d6802 docs(forms): add docs for emitEvent flag (#55249)
PR Close #55249
2024-04-09 10:31:10 -07:00
Angular Robot 18ba2bbc4b docs: update Angular CLI help [main] (#55251)
Updated Angular CLI help contents.

PR Close #55251
2024-04-09 10:29:52 -07:00
Jessica Janiuk f83da4f94f ci: required by is optional for primitives (#55265)
This adjusts the need for required by in PR reviews for shared primitives.

PR Close #55265
2024-04-09 10:29:09 -07:00
Boris Pouw e032427817 docs: add back dynamic form image to fix adev broken link (#55247)
This commit adds back the dynamic form image that was previously removed. This fixes the broken link in the adev documentation.

PR Close #55247
2024-04-08 14:33:24 -07:00
Mahdi Lazraq 6484ac21f9 docs: add closing tag in hierarchical injectors documentation (#54954)
PR Close #54954
2024-04-08 14:11:18 -07:00
Andrew Mayer 2eb83c6e86 docs: update links to calling-compilecomponents intesting-utility-apis (#55055)
PR Close #55055
2024-04-08 14:08:38 -07:00
Andrew Mayer 76d00b253d docs: update links to the calling-compilecomponents section (#55055)
PR Close #55055
2024-04-08 14:08:37 -07:00
Charles Lyding ed6df68914 refactor(language-service): use compiler for current program instance (#55097)
Within the language service, the Angular compiler instance can provide
access to the current TypeScript program via `getCurrentProgram`. By
using the compiler, the need to pass around the program driver is no longer
required and can also be removed as an instance field of the Angular language
service class. This change also provides a higher assurance that the correct
program is being used throughout each language service request.

PR Close #55097
2024-04-08 13:49:31 -07:00
gwario faafadb436 docs: fix typo in event-binding documentation (#55189)
PR Close #55189
2024-04-08 13:47:36 -07:00
Pawel Kozlowski 9bb570b1e2 refactor(core): use performance API for zone options (#55086)
This commit adds a standard performance marker that can be viewed in Chrome dev tools and other tooling.
See more info at https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark

PR Close #55086
2024-04-08 13:43:44 -07:00
Angular Robot 2de06cae72 build: update io_bazel_rules_sass digest to 147f7fa (#55208)
See associated pull request for more information.

PR Close #55208
2024-04-08 13:41:24 -07:00
lilbeqiri 831da9ba1e refactor: do cleanups to theme, version and content loader services at adev (#55234)
Keep theme constants in sync betwee index.html file and theme manager. Move versions config static data to their own file, and replace the deprecated toPromise() api with the new firstValueFrom() api

PR Close #55234
2024-04-08 13:38:04 -07:00
Matthieu Riegler 87cdfaf88f docs: replace code-example with docs-code (#55186)
PR Close #55186
2024-04-08 11:49:25 -07:00
Matthieu Riegler f8d59211ac docs(docs-infra): move CLI docs to ADEV (#55242)
Previously located in the `aio` directory, the commit moves the docs file into `adev` and also moves the `script` used to generated them from the `angular-cli` repo.

PR Close #55242
2024-04-08 11:35:11 -07:00
Matthieu Riegler e57042e540 docs(docs-infra): remove compiler import (#55229)
PR Close #55229
2024-04-08 11:31:56 -07:00
Matthieu Riegler 03581b929c build: update licence date. (#55129)
Wasn't done last year, let's do it in 2024

PR Close #55129
2024-04-08 11:31:12 -07:00
Matthieu Riegler 59c166a2bc docs: remove link to resources (#55224)
The page doesn't exist anymore on ADEV.
Fixes #55221

PR Close #55224
2024-04-08 11:28:48 -07:00
Andrew Scott e9a0c86766 fix(core): TestBed should not override NgZone from initTestEnvironment (#55226)
Prior to this change, `NgZone` was provided by default in TestBed in a
location that would override anything configured in
`TestBed.initTestEnvironment`. This change moves the default `NgZone`
provider to the `RootScopeModule` and these providers can be overridden
by the ones in `additionalModuleTypes`, which are assigned from the
first argument of `initTestEnvironment`. This makes it possible to
configure Zone globally for all tests as opposed to needing to repeat it
in `configureTestingModule` of each suite.

PR Close #55226
2024-04-08 11:28:07 -07:00
Andrew Scott dda9d9aa91 refactor(core): No need for zone.root.run in zoneless scheduler (#55230)
Now that #55092 has merged, we now consistently get the `setTimeout` and
`rAF` implementations that are not patched by zone. There's no longer a
need to run them in the root zone.

PR Close #55230
2024-04-08 11:27:05 -07:00
Mohamed 13d37e0b43 docs: fix broken logo link (#55239)
replace logo in main readme

PR Close #55239
2024-04-08 11:26:03 -07:00
Angular Robot 3583d679fd build: update dependency madge to v7 (#55245)
See associated pull request for more information.

PR Close #55245
2024-04-08 10:43:15 -07:00
Angular Robot a84cb62522 build: lock file maintenance (#55145)
See associated pull request for more information.

PR Close #55145
2024-04-05 11:08:44 -07:00
Andrew Scott 59c7538f0c refactor(core): treat embedded views attached to AppRef as transplants (#55154)
PR #55099 updated zoneless behavior to treat all views attached to
`ApplicationRef` as `OnPush`. Put another way, Zoneless change detection
will only refresh view trees that notified Angular of a change. This
generally works as expected but there was one situation where it did
not.

Some views are logically linked to their declaration locations and
should refresh when the declaration refreshes. These views are called
"transplanted views" and work correctly when inserted into another view
container. This change updates the logic to also work when they are
attached directly to `ApplicationRef`.

PR Close #55154
2024-04-05 10:56:28 -07:00
Johnny Gérard 58e2f47426 test(common): update ImageKit low quality test (#55193)
For commit cd911a8008

PR Close #55193
2024-04-05 14:55:13 +00:00
Johnny Gérard 2a6f809507 fix(common): invalid ImageKit quality parameter (#55193)
The current quality parameter is ignored by ImageKit.

PR Close #55193
2024-04-05 14:55:13 +00:00
Jessica Janiuk 8cd1b2323a ci: pullapprove is case sensitive (#55220)
This fixes thePunderWoman for case sensitivity

PR Close #55220
2024-04-04 21:27:18 -07:00
Kristiyan Kostadinov 39624c6b12 fix(compiler): output input flags as a literal (#55215)
Previously the input flags were being generated as a reference to an enum member for better readability and under the assumption that minifiers would inline the values. That doesn't appear to be the case so these changes switch to using the literal values instead.

PR Close #55215
2024-04-04 11:13:52 -07:00
ashish-sharma4u 493c1922bf docs: bind 'occupation' property to UserComponent (#54935)
added the binding of occupation property which was missing in UserComponent

Co-authored-by: Sonu Kapoor <sonukapoor@users.noreply.github.com>

PR Close #54935
2024-04-04 11:12:51 -07:00
Matthieu Riegler 9ad4ed13bd docs: use structural directives workflow for structural directives docs. (#55212)
fixes #53078

PR Close #55212
2024-04-04 16:03:43 +00:00
Jessica Janiuk 6c25f29535 ci: jessicajaniuk is thePunderWoman (#55205)
this swaps jessica for jessica.

PR Close #55205
2024-04-03 16:05:17 -07:00
Jessica Janiuk 4e25e402f8 release: cut the v18.0.0-next.3 release 2024-04-03 15:28:04 -07:00
Jessica Janiuk 6f960afd31 ci: fixes jsaction path name (#55199)
This updates the jsaction path to be event-dispatch.

PR Close #55199
2024-04-03 18:27:45 +00:00
Jessica Janiuk 2656fd9d19 refactor(core): remove unnecessary folder (#55197)
This removes a temporary folder for jsaction.

PR Close #55197
2024-04-03 18:08:15 +00:00
Matthieu Riegler 1c736dc3b2 feat(forms): Unified Control State Change Events (#54579)
This commit introduces a new method to subscribe to on every `AbstractControl` subclass.
It allows to track value, pristine, touched and status changes on a given control.

Fixes #10887

PR Close #54579
2024-04-03 17:12:04 +00:00
Jessica Janiuk 2ff74dcd95 ci: Add primitives groups to pullapprove (#53404)
This adds the shared primitives reviewers groups and list of reviewers
to the pullapprove rules.

PR Close #53404
2024-04-03 17:06:04 +00:00
Gerald Monaco 45ae7a6b60 feat(platform-browser): add withI18nSupport() in developer preview (#55130)
Expose withI18nSupport() as a hydration feature to enable i18n hydration

PR Close #55130
2024-04-03 15:27:24 +00:00
Andrew Kushnir 231e0a3528 fix(core): handle ChainedInjectors in injector debug utils (#55144)
The fix from PR #55079 introduced a configuration of the injector chain, which wasn't properly handled by the injector debug utils, thus resulting in JS exceptions in DevTools. This commit updates injector debug utils logic that calculates injector resolution path to also handle `ChainedInjector`s.

Resolves #55137.

PR Close #55144
2024-04-03 15:26:47 +00:00
James f5773196ec docs: fix typo in first-app/steps/06-property-binding/README.md (#55181)
PR Close #55181
2024-04-03 00:14:14 +00:00
Joey Perrott 894c1c5f10 refactor: apply prettier formatting to integration (#54653)
Apply prettier formatting to integration directories

PR Close #54653
2024-04-02 20:42:04 +00:00
Joey Perrott ade024407d fix(docs-infra): remove part aio infra (#54929)
Remove parts of the aio infra

PR Close #54929
2024-04-02 18:38:04 +00:00
Jessica Janiuk 199150849b ci: bump ng-dev hashes (#55172)
This updates ng-dev to the latest hash fixing the merge files query.

PR Close #55172
2024-04-02 18:32:21 +00:00
Andrew Scott 58942dbe93 refactor(core): Update method of grabbing native setTimeout and rAF (#55092)
As mentioned in https://github.com/angular/angular/pull/54600#discussion_r1528372804
a more effective way of getting the unpatched version of a zone-patched
API is to grab it from global[Zone.__symbol__('apiname')].

PR Close #55092
2024-04-02 16:21:54 +00:00
ivanwonder 104dfd4cef refactor(language-service): support showing tags info in the completion (#51140)
The Angular VSCode extension will support showing the tags info in this

[PR][1], so the language service can return the tags info now.

[1]: https://github.com/angular/vscode-ng-language-service/pull/1904

PR Close #51140
2024-04-02 16:21:01 +00:00
Dylan Hunn f824911510 fix(compiler): For FatalDiagnosticError, hide the message field without affecting the emit (#55160)
We want to hide `.message` from users, but the previous approach is not compatible with a specific [TS 3.7 flag](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier) ("using class fields to specialize properties from base classes also won’t work"). I received a request from the TS team to fix this, so they can enable that flag.

Instead, we just override `message` to `never` in the .d.ts using `declare`.

PR Close #55160
2024-04-02 16:20:23 +00:00
Kristiyan Kostadinov c04ffb1fa6 fix(compiler-cli): use switch statements to narrow Angular switch blocks (#55168)
In #52110 we had to use `if` statements to represent `switch` blocks, because TypeScript had a bug when narrowing the type of parenthesized `switch` statements. Now that it has been fixed by TypeScript and we don't support any version that has the broken behavior, we can go back to generating `switch` statements in the TCB which are simpler and better represent the user's code.

PR Close #55168
2024-04-02 16:19:47 +00:00
Thomas Nguyen 666d646575 feat(core): Add event delegation library to queue up events and replay them when the application is ready (#55121)
This adds the JSAction library from the Wiz framework to core/primitives.

PR Close #55121
2024-04-02 16:09:13 +00:00
Andrew Scott 840c375255 fix(core): do not save point-in-time setTimeout and rAF references (#55124)
Grabbing and saving the references to global `setTimeout` and `rAF`
implementations at a certain point in time can be problematic, espcially
in tests. Tests might call something like `jasmine.clock().install();`
and `jasmine.clock().uninstall();`. If the install happens before we
grab the implementation and then the uninstall happens after, our
scheduling function will be broken because it would have saved a reference to
the jasmine `setTimeout` implementation, which would have since been
cleaned up and will throw  an error when attempting to access `delayedFunctionScheduler`.

There are other scenarios that may apply, not even just for tests, when
patches are applied and removed to the globals.

PR Close #55124
2024-04-01 11:00:11 -07:00
garrettld e18a0ed1a3 fix(devtools): fix padding in property tree view (#54648)
This import was missed when switching devtools to standalone.

fixes #54622

PR Close #54648
2024-04-01 10:52:37 -07:00
Jessica Janiuk 0ceefae7dc ci: Update workflows to use latest dev infra hash (#55128)
This bumps the hash for dev-infra dependencies to utilize the latest build and changes

PR Close #55128
2024-04-01 10:00:06 -07:00
Andrew Scott 940a3587b7 refactor(router): prevent navigationErrorHandler from breaking transition subscription (#55152)
Following up on #55068, this change prevents errors in the handler from
breaking navigations.

PR Close #55152
2024-04-01 09:47:54 -07:00
Andrew Scott 3839cfbb18 fix(router): Routed components never inherit RouterOutlet EnvironmentInjector (#54265)
This commit ensures components in the route config predictably always
get their providers from the hierarchy available to routes rather than
sometimes being dependent on where they are inserted.

fixes #53369

BREAKING CHANGE: Providers available to the routed components always
come from the injector heirarchy of the routes and never inherit from
the `RouterOutlet`. This means that providers available only to the
component that defines the `RouterOutlet` will no longer be available to
route components in any circumstances. This was already the case
whenever routes defined providers, either through lazy loading an
`NgModule` or through explicit `providers` on the route config.

PR Close #54265
2024-04-01 09:19:13 -07:00
Andrew Scott 87f3f27f90 feat(router): Allow resolvers to return RedirectCommand (#54556)
Returning a `RedirectCommand` from a resolver can be interpreted as
distinctly different from regular resolved data. When a resolver returns
`RedirectCommand` we can interperet this as an intention to redirect in
the same way as other guards.

resolves #29089

PR Close #54556
2024-03-30 10:52:44 -07:00
Paweł Kubiak 8a8181a54d fix(docs-infra): scrolling experience in API Reference (#55133)
Fix scrolling experience in API Reference:
- set correct margin top for members container (right side) which is aligned with tabs (left side)
- prevent scroll on focus
- remove redundant blur calls

PR Close #55133
2024-03-29 19:05:53 -07:00
Matthieu Riegler bc7f140928 docs(docs-infra): Use monospace font for API reference (#54558)
fixes #52612

PR Close #54558
2024-03-29 16:46:19 -07:00
Andrew Scott 7d4dd08591 test(core): Update hybrid mode scheduling test to wait for fixture stable (#55076)
Now that pending tasks contribute to fixture stability, the tests can be
simplified.

PR Close #55076
2024-03-29 16:37:43 -07:00
Kristiyan Kostadinov 0c20c4075a fix(migrations): avoid conflicts with some greek letters in control flow migration (#55113)
The control flow migration was using a couple of Greek letters as placeholders. This ended up conflicting with templates authored in Greek.

These changes use a more obscure placeholder to make conflicts less likely. It also moves the placeholder generation to a centralized function so it's easier to make changes if we decide to update the pattern again.

Fixes #55085.

PR Close #55113
2024-03-29 13:10:52 -07:00
Matthieu Riegler f01e8da53d docs(docs-infra): move Features APIs above the filter section & rename to "Most Common (#54557)
Fixes #52705

PR Close #54557
2024-03-29 13:08:29 -07:00
vladboisa e0a31b68f5 refactor(docs-infra): move gif to display (#54795)
To display the image correctly, swap the image from the folders

Fixes  #54778

feat(docs-infra): change path for correct ADEV

Changing path for correctly displaying in adev

PR Close #54795
2024-03-29 13:06:42 -07:00
Johnny Gérard 50da50103f docs(common): clean up comment (#55088)
PR Close #55088
2024-03-29 13:02:44 -07:00
Angular Robot 418b7dff4b build: lock file maintenance (#55022)
See associated pull request for more information.

PR Close #55022
2024-03-29 12:59:32 -07:00
Andrew Scott 38bb95a8f5 Revert "refactor(compiler): add support for the new search element (#54945)" (#55127)
This reverts commit 367b3ee6e9.
The search element is not a void element but existing components may use
the same selector and be used as a void element.

PR Close #55127
2024-03-29 12:56:31 -07:00
Andrew Scott d3c75f8dbb Revert "ci: Update workflows to use latest dev infra hash (#55123)" (#55126)
This reverts commit e4fde98279.

PR Close #55126
2024-03-29 12:48:27 -07:00
Matthieu Riegler 1ae460c387 docs: remove unused examples (#55110)
fixes #52660

PR Close #55110
2024-03-29 11:58:31 -07:00
Jessica Janiuk e4fde98279 ci: Update workflows to use latest dev infra hash (#55123)
This bumps the hash for dev-infra dependencies to utilize the latest build and changes

PR Close #55123
2024-03-29 11:51:30 -07:00
Andrew Scott 3974c2184e refactor(core): All views attached to application are treated as OnPush in zoneless (#55099)
This change treats all views attached to `ApplicationRef` as `OnPush`,
meaning that they have to be explicitly marked for check in order to be
refreshed when a tick happens. This prevents "accidentally" refreshing
views which have `Default` change detection as a side effect of running
change detection from an unrelated notification.

In addition, this change helps us achieve one of the big goals of the
project: that we can provide a testing experience which gives developers
more confidence that a component is zoneless-compatible. Because
`ComponentFixture` change detection is run through `ApplicationRef`
instead of `ChangeDetectorRef` when zoneless is enabled, this ensures
that the component under test has correctly been marked for check in
order to be updated. Without this, calling
`ComponentFixture.detectChanges` would allow a test to _force_ change
detection on a view when Angular would have otherwise not known that it
needed to be updated. Calling `ComponentFixture.detectChanges` on a component
which is not marked for check will now omit refreshing component view.

PR Close #55099
2024-03-29 10:42:21 -07:00
Angular Robot a122bd14ea build: update dependency gulp to v5 (#55108)
See associated pull request for more information.

PR Close #55108
2024-03-29 10:13:07 -07:00
Matthieu Riegler 367b3ee6e9 refactor(compiler): add support for the new search element (#54945)
See #whatwg/html#5811
Spec: https://html.spec.whatwg.org/multipage/grouping-content.html#the-search-element

fixes #54944

PR Close #54945
2024-03-29 10:01:54 -07:00
Andrew Scott a99cb7ce5b fix(core): zoneless scheduler should check if Zone is defined before accessing it (#55118)
zoneless scheduler should check if Zone is defined before accessing it

fixes #55116

PR Close #55118
2024-03-29 09:59:00 -07:00
Angular Robot 218c5bd2b3 build: update dependency @babel/core to v7.24.3 (#55038)
See associated pull request for more information.

PR Close #55038
2024-03-29 09:44:58 -07:00
reafernandes10 112fae56c5 docs(http): Update the Setup for testing in Http Client to include provideHttpClient() (#53716)
It is not enough to use provideHttpClientTesting() for HTTP Client Testing, it will throw a dependency injection error. Update the docs to include both provideHttpClient() and provideHttpClientTesting()

Fixes #53390

PR Close #53716
2024-03-29 09:40:11 -07:00
Dan Wahlin 1b8bf1d4b8 docs: fix typo in control-flow.md (#54976)
PR Close #54976
2024-03-29 09:39:31 -07:00
Gerald Monaco a5fa279b6e fix(core): prevent i18n hydration from cleaning projected nodes (#54823)
Rework the i18n cleanup behavior to more closely match that of containers. Specifically, we assume that nodes are going to be claimed unless they are part of a branching ICU block.

During hydration, we then track which ICU case was active at serialization time, and which was active during hydration. Any remaining cases that weren't used during hydration are then cleaned up.

PR Close #54823
2024-03-29 09:35:43 -07:00
Gerald Monaco f44a5e4604 fix(core): support content projection and VCRs in i18n (#54823)
Modifies the i18n pre-hydration logic to correctly support content projection and elements that act as view containers.

PR Close #54823
2024-03-29 09:35:43 -07:00
Gerald Monaco 146306a141 feat(core): add support for i18n hydration (#54823)
Add support for hydrating i18n blocks. This is accomplished by serializing information about selected ICU cases for a block during server-side rendering.

During hydration, this data is read and is used to traverse both an AST of the translated message and the DOM, in parallel, to map each LView with an RNode.

Finally, this mapping is used while nodes are being created (either via i18n or their respective instructions) to locate existing nodes.

PR Close #54823
2024-03-29 09:35:43 -07:00
vladboisa 1c11d89e9e docs(docs-infra): rephrase sentence to make sense (#54914)
Remove the confuse sentences with 2 categories, and rephrase

Fixes #54792

PR Close #54914
2024-03-29 09:34:49 -07:00
Matthieu Riegler 1d821d1b87 docs: fix API tabs height to allow overflow/scrolling (#55109)
fixes #53294

PR Close #55109
2024-03-29 09:33:13 -07:00
Matthieu Riegler 1c5f158c46 docs: document why undefined is usefull and does not remove classes (#55112)
Fixes #54601

PR Close #55112
2024-03-29 09:22:10 -07:00
Andrew Scott 860de662b6 refactor(router): Navigation promise should resolve false instead of null on skip (#55068)
This commit updates the internal resolve value of the navigation promise
to use `false` instead of `null` when a navigation is skipped. The
navigation promise type requires `boolean` so the correct resolution to
match the truthy/falsiness of the currently resolved value, `null`, is
`false` instead.

PR Close #55068
2024-03-29 09:16:47 -07:00
Andrew Scott 2794084d74 refactor(router): move navigation error handler call to location of error emit (#55068)
This commit moves the call to the error handler to the location where
the error event emits instead of having it indirectly work through the
events subscription. This change would also allow the handler to return
a value which can be handled by the navigation transition.

PR Close #55068
2024-03-29 09:16:47 -07:00
Andrew Scott 17369ed1e9 refactor(router): Correct resolve value for error handler case (#55068)
This commit fixes the types on the error handler resolve and reject
functions and also ensures that the resolve value matches the API type
(`boolean`, not "any random value returned from `errorHandler`"). This
could be considered a breaking change but I would argue instead that
relying on the return value of the error handler is API misuse because
the promise returned by the router navigation _does not_ include `any`
in its type.

PR Close #55068
2024-03-29 09:16:46 -07:00
Andrew Scott 4073d3854f refactor(router): fix internal types of resolve and reject promises (#55068)
This commit fixes the internal types for the resolve and reject
functions used for the router navigation Promise. These are currently
typed as `any`.

PR Close #55068
2024-03-29 09:16:46 -07:00
Andrew Scott 0b450ffa6f refactor(core): Move private export testing file to src (#55103)
This matches the private export approach for files in other packages.

PR Close #55103
2024-03-28 16:35:25 -07:00
Andrew Scott ac0a51ce3d refactor(core): Update SchedulingMode to be regular enum (#55103)
Angular recently gained a local compilation mode (see commit 345dd6d).
This is intended to be used with the TypeScript compiler option isolatedModules, which bans imports of const enums.

PR Close #55103
2024-03-28 16:35:24 -07:00
Matthieu Riegler d839c58031 docs(docs-infra): improve styling for deprecated CLI option (#54794)
Related to #54770

PR Close #54794
2024-03-28 15:48:22 -07:00
Matthieu Riegler 431fb9740d docs(docs-infra): add margin for command aliases (#54794)
PR Close #54794
2024-03-28 15:48:22 -07:00
Matthieu Riegler ec59b2fe74 docs(docs-infra): improve space between cli command options (#54794)
fixes #54767

PR Close #54794
2024-03-28 15:48:22 -07:00
Andrew Scott ea2d42507e refactor(core): Remove unused change detection flags (#55057)
This commit removes unused change detection flags.

PR Close #55057
2024-03-28 15:47:41 -07:00
Angular Robot 474b6c22da build: update dependency puppeteer-core to v22.6.1 (#55040)
See associated pull request for more information.

PR Close #55040
2024-03-28 15:46:46 -07:00
Allan Barrantes fac8d34edc docs: remove broken link from CONTRIBUTING.md (#54953)
PR Close #54953
2024-03-28 15:06:56 -07:00
Angular Robot d992be55e6 build: update eslint dependencies to v7.4.0 (#55041)
See associated pull request for more information.

PR Close #55041
2024-03-28 15:06:06 -07:00
Andrew Scott 22dd52f460 refactor(core): re-export private exports from testing (#55101)
This commit re-exports private exports  from testing package.

PR Close #55101
2024-03-28 13:54:16 -07:00
Andrew Scott f9417ea3a8 refactor(core): Privately export SchedulingMode enum (#55100)
Expose enum for early testers so they don't have to awkwardly put `0`
for Hybrid mode.

PR Close #55100
2024-03-28 13:15:03 -07:00
Andrew Scott edfc5a9c3b refactor(core): private export token to disable fixture.detectChanges error (#55098)
While we do want to discourage `fixture.detectChanges`, it is yet to be
determined how this should be accomplished (warning, documentation, etc.). At
the moment, not being able to disable the error at all is entirely
prohibitive for existing test suites to use zoneless change detection in
tests. We would much rather allow existing test suites to disable the
error and use the zoneless change detection than prevent them from using
it entirely until all the `detectChanges` calls have been fixed.
Calling `detectChanges` manually can hide errors related to change
detection timing, but it is even worse when the "PseudoApplication"
fixture used (since it runs change detection _only_ on the component
rather than through `ApplicationRef`).

PR Close #55098
2024-03-28 13:14:27 -07:00
Garrett Darnell b87b2fc05c docs(core): fix toSignal docs (#54964)
PR Close #54964
2024-03-28 13:06:43 -07:00
Angular Robot 40e41e4d33 build: update github/codeql-action action to v3.24.9 (#55039)
See associated pull request for more information.

PR Close #55039
2024-03-28 13:05:57 -07:00
Matthieu Riegler f523415203 docs: drop glossary links (#55044)
PR Close #55044
2024-03-28 13:02:50 -07:00
Ben Hong f911aef72a docs: fix outdated security guide reference (#55069)
PR Close #55069
2024-03-28 13:01:59 -07:00
Andrew Scott 914e4530b0 fix(core): test cleanup should not throw if Zone is not present (#55096)
The test hooks should not throw if applications choose not to load ZoneJS.

fixes #48198

PR Close #55096
2024-03-28 12:12:30 -07:00
Charles Lyding a48afe0d94 fix(language-service): avoid generating TS syntactic diagnostics for templates (#55091)
Angular's template files are not valid TypeScript. Attempting to get syntactic
diagnostics from the underlying TypeScript language service will result in
a large amount of false positive errors. Only actual TypeScript files should
be analyzed by the underlying TypeScript language service for syntactic errors.

PR Close #55091
2024-03-28 12:10:40 -07:00
Ben Hong d63706e9d6 docs: add missing h1 to page for skip to main content on home page (#55052)
PR Close #55052
2024-03-28 12:09:57 -07:00
JiaLiPassion ddbf6bb038 fix(zone.js): make sure fakeasync use the same id pool with native (#54600)
Close #54323

fakeAsync should use the same timerId pool with native, so they will not
conflict.

PR Close #54600
2024-03-28 10:30:25 -07:00
Dylan Hunn 6d14fc52b9 release: cut the v18.0.0-next.2 release 2024-03-28 10:05:21 -07:00
Dylan Hunn a64eca2a9a docs: release notes for the v17.3.2 release 2024-03-28 10:00:27 -07:00
Kristiyan Kostadinov 63688714ae fix(migrations): account for variables in imports initializer (#55081)
Fixes that the control flow migration was throwing an error if the `imports` of a component are initialized to an identifier.

Fixes #55080.

PR Close #55081
2024-03-28 09:40:31 -07:00
Matthieu Riegler f17134a7a4 docs: remove AIO guides (#54829)
PR Close #54829
2024-03-28 09:37:06 -07:00
Andrew Kushnir 86a359b399 fix(core): establish proper injector resolution order for @defer blocks (#55079)
This commit updates the `@defer` logic to establish proper injector resolution order. More specifically:

- Makes node injectors to be inspected first, similar to how it happens when `@defer` block is not used.
- Adds extra handling for the Router's `OutletInjector`, until we replace it with an `EnvironmentInjector`.

Resolves #54864.
Resolves #55028.
Resolves #55036.

PR Close #55079
2024-03-28 09:23:38 -07:00
Kristiyan Kostadinov 336916ceb0 refactor(compiler-cli): allow source file validator rule to produce a single diagnostic (#54993)
Allows for `SourceFileValidatorRule.checkNode` to produce a single diagnostic. The most common case should be one diagnostic per node so this allows us to save some array allocations.

PR Close #54993
2024-03-28 09:17:04 -07:00
Kristiyan Kostadinov 694ba79cbf fix(compiler-cli): report cases where initializer APIs are used in a non-directive class (#54993)
Expands the check for initializer APIs to also flag when the function is called on a class that isn't a component or directive.

PR Close #54993
2024-03-28 09:17:03 -07:00
Kristiyan Kostadinov 78188e877a fix(compiler-cli): add diagnostic if initializer API is used outside of an initializer (#54993)
Adds a rule that will produce a diagnostic when an initializer-based API is used outside of an initializer.

Fixes #54381.

PR Close #54993
2024-03-28 09:17:02 -07:00
Kristiyan Kostadinov 8226be6abf refactor(compiler-cli): introduce infrastructure for running additional checks against TypeScript files (#54993)
Adds the new `SourceFileValidator` that will be used to check for file-level issues that may prevent Angular from working, like invoking the `input()` function outside of an initializer. Currently only one check is planned, but this setup will allow us to easily add more in the future.

PR Close #54993
2024-03-28 09:17:01 -07:00
Kristiyan Kostadinov 3d9f01c6ec refactor(compiler-cli): add API to check if imports exist (#54993)
Adds a couple of APIs to the `ImportedSymbolsTracker` that allow us to quickly check if a specific symbol is imported in a file.

PR Close #54993
2024-03-28 09:17:00 -07:00
Matthieu Riegler 9a9ce0d419 refactor(devtools): prevent exeception on state serializer (#55061)
`Object.getPrototypeOf(obj)` returns `null` if `obj` is an empty object. `Object.getOwnPropertyDescriptors` throws on `null`/`undefined`

PR Close #55061
2024-03-28 09:14:23 -07:00
Andrew Scott e02bcf89cf fix(core): Fix clearing of pending task in zoneless cleanup implementation (#55074)
This commit fixes a mistake in #54952 where the first pending task was falsey because its ID is 0

PR Close #55074
2024-03-27 14:29:08 -07:00
Andrew Scott 80f96e7c51 refactor(core): Provide scheduler for use and coordination with zone change detection (#54952)
This commit makes the zoneless scheduler (privately) available to applications that
have ZoneJS-based change detection. This would catch any changes of
interest (signal updates, `markForCheck` calls, attaching `Dirty` views)
that happen outside the Angular Zone.

See #53844 for additional information about why this is important.
More details to come in the a future commit that makes this a public option.

PR Close #54952
2024-03-27 11:36:56 -07:00
Matthieu Riegler e523f27e67 docs: fix link to NPM release cycle page (#54793)
PR Close #54793
2024-03-27 11:33:09 -07:00
Matthieu Riegler 2a395f8917 docs: link to http security now at best-practices/security (#55060)
fixes #55058

PR Close #55060
2024-03-27 11:32:08 -07:00
Esteban Luchsinger 9e606093e6 docs: explain difference between @placeholder and @loading (#54779)
Add a sentence to the `@loading` block documentation that emphasizes more that the `@loading` block will replace the `@placeholder` block once the deferred view starts loading.

PR Close #54779
2024-03-27 11:09:15 -07:00
Andrew Scott 658cf8c384 fix(core): ComponentFixture stability should match ApplicationRef (#54949)
This change aligns the stability of `ComponentFixture` with that of
`ApplicationRef`, preventing confusing differences between the two as
more APIs start using the `PendingTasks` that may not be tracked by
`NgZone`.

BREAKING CHANGE: `ComponentFixture.whenStable` now matches the
`ApplicationRef.isStable` observable. Prior to this change, stability
of the fixture did not include everything that was considered in
`ApplicationRef`. `whenStable` of the fixture will now include unfinished
router navigations and unfinished `HttpClient` requests. This will cause
tests that `await` the `whenStable` promise to time out when there are
incomplete requests. To fix this, remove the `whenStable`,
instead wait for another condition, or ensure `HttpTestingController`
mocks responses for all requests. Try adding `HttpTestingController.verify()`
before your `await fixture.whenStable` to identify the open requests.
Also, make sure your tests wait for the stability promise. We found many
examples of tests that did not, meaning the expectations did not execute
within the test body.

In addition, `ComponentFixture.isStable` would synchronously switch to
true in some scenarios but will now always be asynchronous.

PR Close #54949
2024-03-27 11:01:28 -07:00
David Calawa 60f1d681e0 fix(router): preserve replaceUrl when returning a urlTree from CanActivate (#54042)
This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when
returning a urlTree from a CanActivateFn.

Fixes #53503

BREAKING CHANGE: When a a guard returns a `UrlTree` as a redirect, the
redirecting navigation will now use `replaceUrl` if the initial
navigation was also using the `replaceUrl` option. If this is not
desirable, the redirect can configure new `NavigationBehaviorOptions` by
returning a `RedirectCommand` with the desired options instead of `UrlTree`.

PR Close #54042
2024-03-27 10:57:52 -07:00
Andrea Canciani f3b624553a refactor: fix a number of typos throughout the codebase (#55018)
Fix some typos detected using spellchecking tools, both in
documentation and in code (comments, identifiers).

PR Close #55018
2024-03-27 10:54:31 -07:00
vladboisa 42eab69a1f docs(docs-infra): replace link by HTTPsecurity tab (#55029)
Replace a broke link by content of HTTP Client Security Tab.

Fixes #54918 & #54922

PR Close #55029
2024-03-27 10:50:20 -07:00
Dmitrii Kuzmin 3650b3795f docs: added note about toSignal (#54996)
PR Close #54996
2024-03-27 10:49:37 -07:00
Matthieu Riegler b230bbc90d refactor(compiler): Do not extract internal methods. (#54850)
internal methods are not exposed to end users and should not be extracted.

PR Close #54850
2024-03-27 10:48:05 -07:00
JiaLiPassion e44b077cbd fix(zone.js): should not clear onhandler when remove capture listener (#54602)
Close #54581

Should not clear `onHandler` when remove capture event listeners.

PR Close #54602
2024-03-27 10:40:05 -07:00
Andrew Scott eae75ff3f9 fix(router): RouterLinkActive will always remove active classes when links are not active (#54982)
Previously, `RouterLinkActive` would only add or remove the active classes when
its active state changed. This means that if you accidentally add one of
the active classes to the static class attribute, it won't get removed
until the link becomes active and then deactives (because the class is
added at creation time and never removed until the `RouterLinkActive`
state changes from active to inactive).

fixes #54978

PR Close #54982
2024-03-27 10:16:16 -07:00
Charles Lyding f2a98cdce0 refactor(language-service): use native Array flatMap (#55011)
The custom flatMap implementation can now be removed as Array contains a
native implementation that is available for all supported Node.js versions.

PR Close #55011
2024-03-27 10:15:34 -07:00
Matthieu Riegler 14235b7f0c docs: update compat table with 17.3 (#54882)
PR Close #54882
2024-03-27 09:58:06 -07:00
Charles Lyding 4166dfc1b6 fix(language-service): prevent underlying TS Service from handling template files (#55003)
When the `angularOnly` option is disabled, the underlying TypeScript language service
was previously used for all files including `.html` template files. This can result in
incorrect responses including a large amount of invalid diagnostics for a template file.
Checks have now been added to only use the Angular Language service for template files
which can properly handle template files. Additionally, the check for a TypeScript file
name has now been expanded to encompass all current file extension forms.

PR Close #55003
2024-03-27 09:57:31 -07:00
Ben Hong 311f5527a6 docs: reduce confusion on tutorial intro and reorder how resources are introduced (#55051)
PR Close #55051
2024-03-27 09:56:42 -07:00
Doug Parker abd973d0bb release: bump Angular DevTools version to 1.0.12 (#55056)
Also fixes a typo in release docs for the Firefox `zip` command.

PR Close #55056
2024-03-27 09:55:36 -07:00
Paul Gschwendtner 03b1ac3ce7 refactor(compiler-cli): improve error message for uncaught FatalDiagnosticError (#54981)
For `FatalDiagnosticError` we are currently hiding the `message` string
field in favor of the actual TS `diagnosticMessage`.

This works as expected, but makes these errors hard to debug in certain
environments (e.g. Jasmine). That is because `null` is the value of
`message` at runtime. We fix this by just overriding the type, like we
originally intended to do.

In addition, we properly render message chains in the `Error#message`
field— so that these errors, when uncaught, are somewhat reasonable and
can be useful.

PR Close #54981
2024-03-27 09:54:46 -07:00
Paul Gschwendtner 6219341d26 fix(compiler-cli): report errors when initializer APIs are used on private fields (#54981)
This commit ensures that the new APIs like `input`, `model`, `output`,
or signal-based queries are not accidentally used on fields that have a
problematic visibility/access level that won't work.

For example, queries defined using a private identifier (e.g. `#bla`)
will not be accessible by the Angular runtime and therefore _dont_ work.

This commit ensures:

- `input` is only declared via public and protected fields.
- `output` is only declared via public and protected fields.
- `model` is only declared via public and protected fields.
- signal queries are only declared via public, protected and TS private
  fields (`private` works, while `#bla` does not).

Fixes #54863.

PR Close #54981
2024-03-27 09:54:45 -07:00
Paul Gschwendtner 64ae07766e refactor(compiler-cli): support enforcing field access for initializer APIs (#54981)
An initializer API like `input`, `output`, or signal queries may not be
compatible with certain access levels. E.g. queries cannot work with ES
private class fields.

This commit introduces a check for access levels into the initializer
API recognition— enforcing that every initializer API *clearly*
specifies what type of access is allowed.

PR Close #54981
2024-03-27 09:54:45 -07:00
Paul Gschwendtner 9366a94781 refactor(compiler-cli): reflection should inspect ES private fields and visibility (#54981)
This commit changes the TypeScript reflection host to:

* inspect / process ES private fields. e.g. `#someField` — those are
  ignored right now and we would want to check them to issue
  diagnostics.

* determine an access level of a class member. E.g. a member may be
  public, may be private, may be ES private, or public readonly. This
  can then be used in various checks later.

PR Close #54981
2024-03-27 09:54:45 -07:00
Kristiyan Kostadinov 6b725c9dfd refactor(compiler-cli): expand type of initializer parsing function (#54981)
Updates the function that parses initializer APIs to check any `Expression`, instead of expecting a class member. This will be useful for the upcoming changes.

PR Close #54981
2024-03-27 09:54:45 -07:00
Paul Gschwendtner adf3ee8fea ci: fix build failures in patch branch (#55064)
This commit fixes various issues that seem to cause the 17.3.x patch
to be red for weeks:

- Eslint checking a file for aio/tools that is not part of a tsconfig—
  hence an error is being reported.

- Audit-web-app importing some Lighthouse APIs that aren't available
  under the given path.

PR Close #55064
2024-03-27 11:58:45 +00:00
AleksanderBodurri d15dca054c fix(devtools): issue where backendReady race condition causes Angular not detected error (#54805)
Previously, a race condition could cause DevTools to enter a state where it can't detect an application on reload. This was caused by a sequencing issue between the content script connection, the devtools panel connection and an event "backendReady" that lets DevTools know when a particular frame is ready to be inspected.

This commit replaces the previously stored backendReady boolean with a promise, so that the devtools panel can eventually run a callback to connect to a content script when that content script emits it's backendReady message.

PR Close #54805
2024-03-26 09:19:06 -07:00
AleksanderBodurri a3e67036f6 Revert "Revert "refactor(devtools): implement multiframe support in devtools page (#53934)" (#54629)" (#54805)
This reverts commit 133319eba0.

PR Close #54805
2024-03-26 09:19:06 -07:00
AleksanderBodurri 15b54ce8dd Revert "Revert "refactor(devtools): implement iframe support for Angular DevTools' browser code (#53934)" (#54629)" (#54805)
This reverts commit dd9f9d7d44.

PR Close #54805
2024-03-26 09:19:05 -07:00
Kristiyan Kostadinov 2fc11eae9e fix(core): account for re-projected ng-content elements with fallback content (#54854)
Passes the attributes of the `ng-content` element to the container that is created for the fallback content so that it can be re-projected into the same slot.

PR Close #54854
2024-03-26 09:18:00 -07:00
Kristiyan Kostadinov 08b3163b58 refactor(core): move template declaration logic into reusable function (#54854)
Moves the logic that declares a template out into a separate function so that it can be reused in other places like control flow and defer, without having to call directly into the `template` instruction.

PR Close #54854
2024-03-26 09:17:59 -07:00
Kristiyan Kostadinov a600a39d0c feat(core): add support for fallback content in ng-content (#54854)
Adds the ability to specify content that Angular should fall back to if nothing is projected into an `ng-content` slot. For example, if we have the following setup

```
@Component({
  selector: 'my-comp',
  template: `
    <ng-content select="header">Default header</ng-content>
    <ng-content select="footer">Default footer</ng-content>
  `
})
class MyComp {}

@Component({
  template: `
    <my-comp>
      <footer>New footer</footer>
    </my-comp>
  `
})
class MyApp {}
```

The instance of `my-comp` in the app will have the default header and the new footer.

**Note:** Angular's content projection happens during creation time. This means that dynamically changing the contents of the slot will not cause the default content to show up, e.g. if a `if` block goes from `true` to `false`.

Fixes #12530.

PR Close #54854
2024-03-26 09:17:59 -07:00
Kristiyan Kostadinov cf8fb33a23 refactor(compiler-cli): integrate fallback content for ng-content into template type checker (#54854)
Adds logic to ingest the content of an `ng-content` element in the template type checker. We treat `ng-content` as a `ScopedNode`, because its content is inserted conditionally.

PR Close #54854
2024-03-26 09:17:58 -07:00
Kristiyan Kostadinov 8997837f3c refactor(compiler): pass default content to projection instruction (#54854)
Updates the code that generates the `projection` instruction to pass the template function containing the default content into it.

PR Close #54854
2024-03-26 09:17:58 -07:00
Kristiyan Kostadinov c7348084f0 refactor(compiler-cli): capture ng-content children in AST (#54854)
Updates the template AST to capture the content of `ng-content` elements instead of throwing an error.

PR Close #54854
2024-03-26 09:17:58 -07:00
Paul Gschwendtner e53e36bba9 refactor(compiler-cli): support ignoring specific doc entries during extraction (#54925)
This commit adds support for ignoring specific doc entries when
extracting doc entries. This allows us to drop e.g. `InputFunction` from
the API docs, given that the `input` API entry holds all the relevant
information.

`InputFunction` only exists for type purposes in the `.d.ts`.

PR Close #54925
2024-03-26 09:17:21 -07:00
Paul Gschwendtner 0b38172628 refactor(core): improve API documentation for query initializer APIs (#54925)
Similar to `input`, `model`, `output`, the query initializer APIs are
also explicitly denoted as such. This allows angular.dev to display them
more readable and compactly.

PR Close #54925
2024-03-26 09:17:21 -07:00
Paul Gschwendtner 318c5b0a5d refactor(core): improve API documentation for output (#54925)
This improves the API documentatino for `output` in angular.dev,
similar to how we improved the API for `input`.

Angular.dev can now show these documentation entries more
readable if annotated explicitly as initializer API.

Note: output API is short enough that we want to include
the types in the code snippet previews.

PR Close #54925
2024-03-26 09:17:21 -07:00
Paul Gschwendtner c91159aee4 refactor(core): improve API documentation for model (#54925)
Improves the API documentation for `model`, similarly to how
we updated the `input` function.

PR Close #54925
2024-03-26 09:17:20 -07:00
Paul Gschwendtner 72adf0dac7 refactor(core): improve API documentation for input after angular.dev support (#54925)
This commit improves the API documentation for `input` after
we added support for initializer APIs in angular.dev docs generation.

Changes:

- Rename `ReadT` to `T`. This conceptually makes it easy to talk about
  inputs of type `T` if there is no transform involved. The common case.
- Rename `WriteT` to `TransformT`. This makes it clear that this is the
  type that the "transform" needs to handle.
- Improves the "overall" description of the input function so that it
  can be shown as a general overview for the API site.
- Improves usage notes to be a little more helpful, yielding more useful
  content in the API docs usage notes section.
- Add short JSDoc description for each individual overload.

PR Close #54925
2024-03-26 09:17:20 -07:00
Paul Gschwendtner 2419f2c747 refactor(docs-infra): support initializer API functions (#54925)
This commit ensures that extracted initializer API functions are
showing up in angular.dev and can be filtered.

PR Close #54925
2024-03-26 09:17:20 -07:00
Paul Gschwendtner 5672c6442c refactor(compiler-cli): support extracting initializer API functions (#54925)
This commit adds support for extracting initializer API functions.
Initialixer API functions are functions conceptually that can are
intended to be used as class member initializers.

Angular started introducing a few of these for the new signal
APIs, like `input`, `model` or signal-based queries.

These APIs are currently confusingly represented in the API docs because
the API extraction:

- does not properly account for call signatures of interfaces
- does not expose information about sub-property objects and call
  signatures (e.g. `input.required`)
- the docs rendering syntax highlighting is too bloated and confusing
  with all types being included.

This commit adds support for initializer API functions, namely two
variants:

- interface-based initializer APIs. e.g. `export const input:
  InputFunction`- which is a pattern for `input` and `input.required`.
- function-based simpler initializer APIs with overloads. e.g.
  `contentChildren` has many signatures but doesn't need to be an
  interface as there are no sub-property call signatures.

PR Close #54925
2024-03-26 09:17:20 -07:00
Alan Agius 6ea5e2161e Revert "fix(http): exclude caching for authenticated HTTP requests (#54746)" (#55033)
This reverts commit 2258ac7a32.

Closes: #55031

PR Close #55033
2024-03-26 09:16:28 -07:00
Charles Lyding 6d1b82df32 fix(language-service): allow external projects to use provided compiler options (#55035)
When creating the Angular Language Service instance, attempts to read
configuration files are now only attempted if the project is considered
a `Configured` project. Such a project has been analyzed by TypeScript
and one or more configuration files (tsconfig/jsconfig) files have been
found for the project.

PR Close #55035
2024-03-26 09:15:43 -07:00
Kristiyan Kostadinov e1650e3b13 fix(compiler): throw error if item name and context variables conflict (#55045)
Based on some internal feedback, these changes add validations to prevent cases where the `@for` loop variable name is the same as one of the built-in context variables, or when one of the context variables is aliased to the same name as the item.

PR Close #55045
2024-03-26 09:10:06 -07:00
Matthieu Riegler ee3bb81f99 refactor(common): request low quality placeholder images (#54899)
For every built-in load, this commit adds a parameter to load low quality placeholder images. Using 20/100 as base value.

PR Close #54899
2024-03-25 11:17:33 -07:00
Alan Agius 13554f9637 fix(http): manage different body types for caching POST requests (#54980)
This update enhances the encoding handling of request bodies to generate the necessary cache key for transfer cache functionality.

Closes #54956

PR Close #54980
2024-03-25 11:17:02 -07:00
Matthieu Riegler b2ba945436 docs: unescape html entities (#55016)
adev supports regular characters in place of entity. Let's use them to make the ease the work for the editors.

PR Close #55016
2024-03-25 11:16:35 -07:00
Andrea Canciani 9dabef08ec test(zone.js): fix zone.js test listener removal (#55017)
The test was checking the wrong set of listeners because of a typo.

PR Close #55017
2024-03-25 11:16:06 -07:00
Kristiyan Kostadinov 5bd188a394 feat(compiler-cli): add partial compilation support for deferred blocks (#54908)
Builds on top of the previous changes to add support for deferred blocks during partial compilation. To do this, the following changes had to be made:
* The metadata passed into `ɵɵngDeclareComponent` has an additional field called `deferBlockDependencies` which has an array of the dependency loading functions for each defer block in the template. During linking, the dependency functions are loaded by matching their template index to the index in the `deferBlockDependencies` array.
* There's a new `ɵɵngDeclareClassMetadataAsync` function that is created for components that have deferred dependencies. It gets transpiled to `setClassMetadataAsync` and works in the same way by capturing a dependency loading function and setting the metadata after the dependencies are resolved. It also has some extra fields for capturing the version which are standard in linker-generated code.
* Deferred import statements are now stripped in partial compilation mode, similar to full compilation.

PR Close #54908
2024-03-21 22:15:32 -07:00
Kristiyan Kostadinov 84410f58ae refactor(core): introduce API for declaring asynchronous partial metadata (#54908)
Adds the `ɵɵngDeclareClassMetadataAsync` function that will be produced during partial compilation for component classes that have deferred dependencies. At runtime the dependencies will be resolved before setting the metadata.

PR Close #54908
2024-03-21 22:15:31 -07:00
Kristiyan Kostadinov ffa217eabd refactor(compiler-cli): add method for extracting function parameters (#54908)
Updates the linker's AST host to add the ability to extract a function's parameters. This will be required for the next commits.

PR Close #54908
2024-03-21 22:15:30 -07:00
Kristiyan Kostadinov 102688bf83 refactor(compiler): widen type of resolver function (#54908)
Updates the type of the resolver function to be any `Expression` since JIT may receive a function reference rather than a `ArrowFunctionExpr`.

PR Close #54908
2024-03-21 22:15:30 -07:00
Kristiyan Kostadinov 36de5c3434 refactor(compiler): ensure defer blocks maintain the template order in the binder (#54908)
Switches to tracking the deferred blocks in a flat array in the binder to ensure that their template order is maintained. This will be relevant in the next commits where we'll match deferred blocks by their index.

Note that the current map we have technically guarantees the insertion order in the spec, but the array is a bit more explicit.

PR Close #54908
2024-03-21 22:15:30 -07:00
Kristiyan Kostadinov fc13144ef9 refactor(compiler-cli): exit early when checking content projection (#54921)
Updates the logic that detects if a node should be checked for control flow content projection to exit as soon as it detects a second root node, instead of counting the total and then checking if it's more than one.

PR Close #54921
2024-03-21 22:14:17 -07:00
Kristiyan Kostadinov a369f43fbd fix(compiler): capture switch block cases for content projection (#54921)
Captures the individual cases in `switch` blocks for content projection purposes.

PR Close #54921
2024-03-21 22:14:17 -07:00
Kristiyan Kostadinov 7fc7f3f05f fix(compiler): capture all control flow branches for content projection in if blocks (#54921)
Previously only the first branch of an `if` block was captured for content projection. This was done because of some planned refactors in the future. Since we've decided not to apply those refactors to conditionals, these changes update the compiler to capture each branch individually for content projection purposes.

PR Close #54921
2024-03-21 22:14:16 -07:00
Pawel Kozlowski 1c0ec56c46 fix(core): correctly project single-root content inside control flow (#54921)
This commit changes the way we use containers to insert conditional content.
Previously if and switch conditional would always use the first content as the
insertion container. This strategy interfered with content projection that
projects entire containers - as the consequence content for _all_ cases would
end up in slot matched by the first container. This could be very surprising
as desicribed in https://github.com/angular/angular/issues/54840

After the change each conditional content is projected into its own container.
This means that content projection can match more than one container and
result in correct display.

Fixes #54840

PR Close #54921
2024-03-21 22:14:16 -07:00
Mahdi Lazraq b80434a07b refactor(http): use nullish coalescing operator in HttpRequest.clone() (#54939)
Refactor how boolean options are handled in HttpRequest.clone() method by using nullish coalescing operator

PR Close #54939
2024-03-21 22:13:43 -07:00
Mahdi Lazraq cf73983fdc fix(http): include transferCache when cloning HttpRequest (#54939)
Fixes a bug where HttpRequest.clone() does not include the transferCache property.

Fixes #54924.

PR Close #54939
2024-03-21 22:13:42 -07:00
Kristiyan Kostadinov eb625d3783 fix(compiler): declare for loop aliases in addition to new name (#54942)
Currently when aliasing a `for` loop variable with `let`, we replace the variable's old name with the new one. Since users have found this to be confusing, these changes switch to a model where the variable is available both under the original name and the new one.

Fixes #52528.

PR Close #54942
2024-03-21 22:13:14 -07:00
Joey Perrott 76b921ed63 ci: change label set by renovate to be merge ready immediately (#54947)
Since the PR is always expected to be ready to merge as renovate won't make changes in response to any sort of comment, it should already be marked as merge ready

PR Close #54947
2024-03-21 22:11:09 -07:00
Kristiyan Kostadinov bfd0bd574e fix(compiler): invoke method-based tracking function with context (#54960)
Previously we assumed that if a `for` loop tracking function is in the form of `someMethod($index, $item)`, it will be pure so we didn't pass the parameter to bind the context to it. This appears to be risky, because we don't know if the method is trying to access `this`.

These changes play it safe by always binding method-based tracking functions.

Fixes #53628.

PR Close #54960
2024-03-21 22:08:40 -07:00
Kristiyan Kostadinov b02b31a915 feat(compiler-cli): drop support for TypeScript older than 5.4 (#54961)
Drops support for TypeScript versions older than 5.4.

BREAKING CHANGE:
* Angular no longer supports TypeScript versions older than 5.4.

PR Close #54961
2024-03-21 22:07:45 -07:00
Andrew Scott 0461bff95f release: cut the v18.0.0-next.1 release 2024-03-20 15:01:08 -07:00
Andrew Scott a9f5a3350a docs: release notes for the v17.3.1 release (#54971)
PR Close #54971
2024-03-20 14:32:24 -07:00
Andrew Scott 7b070c30c2 ci: temporarily disable failing test (#54970)
this test is failing after #54711

PR Close #54970
2024-03-20 13:31:23 -07:00
Alex Rickabaugh 6aff144232 fix(compiler-cli): symbol feature detection for the compiler (#54711)
Use the actual symbol presence in the .d.ts to detect whether two-way
binding to writable signals should be template type-checked.

PR Close #54711
2024-03-20 12:14:41 -07:00
Andrew Scott b3d045b9a4 fix(zone.js): Add 'declare' to each interface to prevent renaming (#54966)
This commit adds `declare` to each interface in the `zone-impl` to
prevent renaming of any interface properties by compiler optimizations.
This would otherwise cause issues if multiple applications depend on ZoneJS and
compile the interface properties to different names.

PR Close #54966
2024-03-20 09:16:07 -07:00
Angular Robot 2dced3ac17 build: update eslint dependencies (#54934)
See associated pull request for more information.

PR Close #54934
2024-03-19 12:34:52 -07:00
Angular Robot 353eae5d82 build: update babel dependencies to v7.24.1 (#54933)
See associated pull request for more information.

PR Close #54933
2024-03-19 17:01:29 +00:00
Angular Robot e7d54aba8b build: update dependency google-closure-compiler to v20240317 (#54931)
See associated pull request for more information.

PR Close #54931
2024-03-19 17:00:45 +00:00
Angular Robot 1c0814f7a2 build: update github/codeql-action action to v3.24.8 (#54932)
See associated pull request for more information.

PR Close #54932
2024-03-19 16:59:48 +00:00
Joey Perrott 456aefe83b refactor(docs-infra): don't rely on aio_npm in adev (#54928)
Use @npm// instead of @aio_npm// in adev BUILD files

PR Close #54928
2024-03-19 09:55:44 -07:00
Alan Agius 18a7c92a31 refactor(router): optimize single character check by replacing startsWith with direct access [0] (#54940)
This commit refactors the router module to enhance performance by substituting the startsWith method with direct access `[0]` when verifying the value of a single character. This optimization improves efficiency, as direct access retrieves the character's value stored at a specific index in the string, resulting in slightly faster execution.

PR Close #54940
2024-03-19 09:55:00 -07:00
Angular Robot d099d650ec build: lock file maintenance (#54920)
See associated pull request for more information.

PR Close #54920
2024-03-19 16:51:45 +00:00
Andrew Scott 314112de99 fix(core): Prevent markForCheck during change detection from causing infinite loops (#54900)
This change updates the approach to the loop in `ApplicationRef.tick`
for allowing state updates in `afterRender` hooks. It is valid to update
state in render hooks and we need to ensure we refresh views that may be
marked for check in these hooks (this can happen simply as a result of
focusing an element). This change ensures that the behavior of `markForCheck`
with respect to this loop does not change while we are actively running
change detection on a view tree.

This approach also has the benefit of preventing a regression for #18917,
where updating state in animation listeners can cause `ExpressionChanged...Error`
This should be allowed - there is nothing wrong with respect to unidirectional
data flow in this case.

There may be other cases in the future where it is valid to update
state. Rather than wrapping the render hooks and the animation flushing
in something which flips a global state flag, the idea here is that
`markForCheck` is safe and valid in all cases whenever change detection
is not actively running.

PR Close #54900
2024-03-18 16:54:01 -07:00
Alan Agius eb20c1a8b1 refactor(platform-browser-dynamic): unused RESOURCE_CACHE_PROVIDER API has been removed (#54875)
BREAKING CHANGE: No longer used `RESOURCE_CACHE_PROVIDER` APIs have been removed.

PR Close #54875
2024-03-18 16:53:27 -07:00
Matthieu Riegler 55c3932f5e refactor(core): Add hydration missmatch on the component rather than the node. (#54671)
In some cases the hydration mismatch is nested within a component.

As the devTool only reports issues on the component level, we need to mark the component node rather than the actual mismatched node.

PR Close #54671
2024-03-18 16:52:19 -07:00
Andrew Kushnir 89eca1df8b refactor(core): allow passing an environment injector while creating a view (#54903)
This commit updates the name of an internal function argument that represents an embedded view injector. Also it introduces a new config option that allows passing an environment injector to be used in the underlying LView. There are no changes to the behavior, just some initial cleanup for upcoming changes.

PR Close #54903
2024-03-18 16:37:35 -07:00
Alan Agius e0b60ad89f test: update platform-server API golden (#54874)
This is following a number of cleanups.

PR Close #54874
2024-03-18 16:37:07 -07:00
Alan Agius 2357d3566c refactor(platform-server): remove legacy URL handling logic (#54874)
BREAKING CHANGE:

Legacy handling or Node.js URL parsing has been removed from `ServerPlatformLocation`.

The main differences are;
  - `pathname` is always suffixed with a `/`.
  - `port` is empty when `http:` protocol and port in url is `80`
 - `port` is empty when `https:` protocol and port in url is `443`

PR Close #54874
2024-03-18 16:37:07 -07:00
Alan Agius 3b1967ca64 refactor(platform-server): remove deprecated useAbsoluteUrl and baseUrl from PlatformConfig (#54874)
BREAKING CHANGE: deprecated `useAbsoluteUrl` and `baseUrl` been removed from `PlatformConfig`. Provide and absolute `url` instead.

PR Close #54874
2024-03-18 16:37:07 -07:00
Alan Agius 07ac017731 refactor(platform-server): remove deprecated platformDynamicServer API (#54874)
BREAKING CHANGE: deprecated `platformDynamicServer` has been removed. Add an `import @angular/compiler` and replace the usage with `platformServer`

PR Close #54874
2024-03-18 16:37:06 -07:00
Alan Agius e8b588d8b7 refactor(platform-server): remove deprecated ServerTransferStateModule API (#54874)
BREAKING CHANGE: deprecated `ServerTransferStateModule` has been removed. `TransferState` can be use without providing this module.

PR Close #54874
2024-03-18 16:37:06 -07:00
Joey Perrott 0be64c1628 ci: move saucelabs to regular CI job (#54926)
Move the saucelabs job to regular CI instead of the priviledged CI to prevent cache poisoning/overload

PR Close #54926
2024-03-18 11:02:37 -07:00
Joey Perrott f50afb10c3 build: update to latest angular/dev-infra/github-actions/create-pr-for-changes (#54904)
Update to latest to correct node verison issue

PR Close #54904
2024-03-17 00:41:30 +00:00
Doug Parker 5328be6660 refactor(zone.js): formatting recently changed files (#53443)
For some reason CI started complaining about lack of formatting here.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker cc1b0f4e8e refactor(zone.js): update imports for Zone setup to invoke patches (#53443)
I initially tried switching to use public entry points under `zone.js/plugins/*`, however this file is both manually compiled for Saucelabs and also built with Bazel for a number of tests. The Bazel integration doesn't work well with depending on real NPM packages, so importing `zone.js/plugins/*` in that context doesn't really work. Instead we need to depend on the internals and manually call the `patch*` functions.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker 635227b881 refactor(zone.js): package Zone *.d.ts files (#53443)
This was a bit complicated, but the typings test (`packages/zone.js/test/typings/...`) was failing due to an unresolved import on `./zone-impl`.

The main cause is that `//packages/zone.js:zone_js_d_ts` was generating the output `zone.d.ts` file by _concatenating_ `zone.d.ts` with `zone.api.extensions.d.ts` and `zone.configurations.api.d.ts`. Now that `zone.d.ts` imports `zone-impl.d.ts`, concatenation is no longer a viable means of bundling this content.

To fix this, I created a new `packages/zone.js/zone.ts` entry point and imported the underlying `zone.ts` file as well as the two extensions. I added `extract_types` to pull the `*.d.ts` files out of the target (because all the JS is bundled separately) and used those files in the final NPM package. This is sufficient to pass the typings test and should be equivalent to what exists today.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker 1081c51d1a refactor(zone.js): only treat the electron package (not paths with electron) as external (#53443)
The `rxjs|electron` regex was causing `import { /* ... */ } from './electron';` to be treated as external and not bundled, which is an issue for the Electron entry point which just happens to be named `electron.ts`. Now only the actual `electron` package should be treated as external, while internal files of any name should not.

I actually tried updating to `^rxjs` as well, however this appears to break some tests and isn't necessary to fix the failing Electron test, so I'm leaving it alone.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker 79308d1668 refactor(zone.js): fix Node fs tests (#53443)
Not sure why this becomes a problem now. These errors appear to be preexisting. Most likely the file wasn't loaded previously and now it is.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker cb0379c8df refactor(zone.js): fix Node error disable/lazy policy tests (#53443)
The lazy policy tests call the same error policy entry point, so this fixes both at the same time.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker e8e1178e42 refactor(zone.js): fix Bluebird test by updating the entry point and calling patches appropriately (#53443)
This executes the patches in the top-level scope of the Bluebird test.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker 54a1fe05df refactor(zone.js): fix fake async test by reading parentUnresolved symbol lazily (#53443)
As this was, `__symbol__` was being called as a static field initializer, which runs during module evaluation, meaning it happened at import time. However for tests, the Zone prefix is overridden which changes the result of `__symbol__`. This change happens too late to be picked up by `__symbol__` at top-level execution, so instead we defer it until `symbolParentUnresolved` is actually read.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker b334e29d59 refactor(zone.js): read patched timers after they are patched (#53443)
This moves timer patching from a top-level side effect into the `patchFakeAsyncTest` function. Top-level statements are evaluated before the Node patches run and have a chance to patch them with the Zone versions of these timers, meaning `FakeAsyncTestZoneSpec` was repatching the native versions between tests. The fix here is to grab the patched versions of these timers during the `patchFakeAsyncTest` function where we can be confident Node patches have already run.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker 6ca1911967 refactor(zone.js): export fake-async-test.ts functions (#53443)
This moves the internals of `fake-async-test.ts` outside `patchFakeAsyncTest` and exports them. This way they can be imported without depending on the top-level side effects of loading Zone.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker 8af7d3a50b refactor(zone.js): update Node test entry point to call patch functions (#53443)
This executes the patches in the top-level scope of Node tests.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker 33c08e5aba refactor(zone.js): switch async-test.ts to use __symbol__ from an import (#53443)
This removes a dependency on the top-level side effect of `Zone` global initialization.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker 181121dd9e refactor(zone.js): rename __global variable (#53443)
For some reason the `_global` name appears to conflict with another `_global` name. Not entirely sure how or why, but the easiest fix seems to be to just give the variable a unique name.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker 5e45bb771b refactor(zone.js): delay reading __Zone_symbol_prefix until needed (#53443)
While reading this is not a top-level side effect, it does _depend_ on a top-level side effect. Specifically, `node-env-setup.ts` set this value. Now that its side effect is moved into a function, we can't read it as the top-level of `zone-impl.ts` and need to wait until `__symbol__` is actually called outside of top-level scope.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker 417cd71830 refactor(zone.js): updates fake polyfill to remove top-level side effect (#53443)
This shifts the side effect from `test_Fake_polyfill.ts` into `browser-env-setup.ts` instead.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker 73969ae9d4 refactor(zone.js): extracts TaskTrackingZoneSpec and exports it (#53443)
While `TaskTrackingZoneSpec` was implicitly global previously, it does not need to be exposed in a `declare global {}` block. This is because classic scripts in TypeScript are only implicitly global within the same compilation. `TaskTrackingZoneSpec` was not exposed in the existing `.d.ts` files shipped with the `zone.js` package. Within google3, this is also a separate compilation and was not accessible. As a result, `TaskTrackingZoneSpec` was always private and we do not need a global to maintain compatibility.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker cf61126ef3 refactor(zone.js): extracts ProxyZoneSpec and exports it (#53443)
While `ProxyZoneSpec` was implicitly global previously, it does not need to be exposed in a `declare global {}` block. This is because classic scripts in TypeScript are only implicitly global within the same compilation. `ProxyZoneSpec` was not exposed in the existing `.d.ts` files shipped with the `zone.js` package. Within google3, this is also a separate compilation and was not accessible. As a result, `ProxyZoneSpec` was always private and we do not need a global to maintain compatibility.

PR Close #53443
2024-03-15 18:11:34 -07:00
Doug Parker d2e5f23c38 refactor(zone.js): update utils.ts to import __symbol__ (#53443)
This removes a dependency on a top-level side effect of global Zone initialization.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker 1b9c807efa refactor(zone.js): update Zone bundles to call patch* functions (#53443)
Since each patch no longer contains top-level side effects, each bundled entry point needs to import and call its associated patch. For the most part this just means that each entry point imports the associated patch and invokes it at the top-level scope.

Note that many of these entry points did not actually have a dependency on `Zone` and had no guarantee that it was loaded prior to execution. To maintain consistency, the missing dependencies on `Zone` are left as-is. They will use the global instance of `Zone` and if users fail to load it prior to importing a specific patch, then the patch will fail just as it did previously.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker 829a10937a refactor(zone.js): wrap Zone.js global initialization in a loadZone function (#53443)
This drop the top-level side effects in `zone.ts` and allows the initialization to be reused across the various entry points in the package.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker a75d9de874 refactor(zone.js): wrap browser-legacy.ts in a patchBrowserLegacy function. (#53443)
This particular is slightly different from the others because it does not have a hard dependency on `Zone`. It doesn't actually use `Zone` directly during the patch because the patch just sets a `legacyPatch` global. To maintain consistency, this continues to use global `Zone` and does _not_ accept `Zone` as a parameter. While it's using a global in an inconvenient way, this isn't a problem right now because it doesn't cause or require a dependency on a top-level side effect.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker 7c1991048b refactor(zone.js): wrap Zone.__load_patch calls in exported functions (#53443)
This removes top-level side effects from each of these files and drops the dependency on global `Zone`, instead allowing it to be provided to each patch as a parameter.

Most of these are pure mechanical transformations. A couple notable files which were somewhat unique:

* `async-test.ts`, `fake-async-test.ts`, and `wtf.ts` had unique IIFE usage and patch `Zone` itself. This removes the IIFE and exports the function instead.
* `jest.ts` and `jasmine.ts` have a unique `jest` global usage which needs to be declared.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker 52d672dd13 refactor(zone.js): move Error type into declare global block in zone.ts (#53443)
This helps consolidate globals into a single declaration in a single file.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker d8db402833 refactor(zone.js): move duplicate Zone check into zone.ts file (#53443)
`zone.ts` contains the global variable definition and is the appropriate place for an error side effect when Zone is initialized twice.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker c5cdd8954c refactor(zone.js): export remaining Zone types as globals (#53443)
These are all the symbols originally under `declare global {}` with the same names. Unfortunatley TypeScript treats a `declare global {}` scope as the parent scope, so we need to import with a different name than the global, meaning everything gets an `_` prefix.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker 4876ed9510 refactor(zone.js): rename types to drop the _ prefix convention (#53443)
Now that we have real ES modules, there's no need for the prefix convention.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker d90b6844a1 refactor(zone.js): move Zone global declaration and assignment to zone.ts (#53443)
Global state is to be managed in `zone.ts` rather than `zone-impl.ts`.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker 1a4d783bf8 refactor(zone.js): clear zone.ts file (#53443)
All its content has been copied to `zone-impl.ts`, so this file will become a wrapper for those symbols.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker 6c7e1e61c6 refactor(zone.js): export Zone initialization function instead of invoking it as an IIFE (#53443)
This removes the top-level side effects from this file. Indenting is left as-is to minimize changes.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker 17c59eb962 refactor(zone.js): rename Zone class to ZoneImpl (#53443)
This removes a name collision on `Zone` with the interface. Otherwise putting the `interface Zone {}` and `class Zone {}` in the same scope when the IIFE is removed will cause a conflict.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker 482335657b refactor(zone.js): moves global constant outside IIFE (#53443)
The IIFE will be removed shortly to support exporting symbols inside it.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker 4feec728c0 refactor(zone.js): export previously global types from zone-impl.ts. (#53443)
This allows the types to be directly imported when used.

PR Close #53443
2024-03-15 18:11:33 -07:00
Doug Parker 76d8c7344e refactor(zone.js): remove declare global from zone-impl.ts (#53443)
This drops global declarations from this file (as they will be limited to `zone.ts`. It also deletes the `/** @internal */` annotation on `AmbientZone` which is no longer necessary since it isn't in the `declare global` and deletes the global Zone declaration which is also unnecessary.

PR Close #53443
2024-03-15 18:11:32 -07:00
Doug Parker a760470b20 refactor(zone.js): copy zone.ts to zone-impl.ts (#53443)
This is just a straight copy, no code is altered. The new `zone-impl.ts` file will contain the actual definitions exported directly without any global declarations or top-level side effects. The existing `zone.ts` will remain as an entry point with those globals and side-effects.

PR Close #53443
2024-03-15 18:11:32 -07:00
Paul Gschwendtner 5a63a475fb test(compiler-cli): add unit tests for output() JIT transform (#54841)
We are already testing the JIT transforms via integration tests, but
this commit adds dedicated unit tests for the transform behavior for
proper test coverage (planned follow-up).

PR Close #54841
2024-03-15 15:14:32 -07:00
Matthieu Riegler c3da79710d docs(docs-infra): bump xterm to 5.4.0 to fix a layout issue on Firefox. (#54897)
With 5.4.0 `xterm` has migrated to scoped packages. We're now using `@xterm/xterm`.

Fixes #54894

PR Close #54897
2024-03-15 15:13:39 -07:00
Kristiyan Kostadinov 879bd80b57 fix(compiler): capture data bindings for content projection purposes in blocks (#54876)
Fixes a regression in the template pipeline where data bindings weren't being captured for content projection purposes.

Fixes #54872.

PR Close #54876
2024-03-15 15:11:19 -07:00
Chinthoorie b961075f92 refactor(compiler-cli): move DelegatingPerfRecorder initialization into constructor (#54834)
Move the initialization of class field `DelegatingPerfRecorder` into the constructor.

This fixes the error : `TypeError: Cannot read properties of undefined (reading 'eventCount')`

This is blocking the roll-out of public class.

PR Close #54834
2024-03-15 15:10:46 -07:00
Paul Gschwendtner d01576b104 refactor(compiler-cli): properly preserve file overview comments (#54819)
This commit updates the logic for preserving file overview comments
to be more reliable and less dependent on previous transforms.

Previously, with the old import manager, we had a utility called
`addImport` that always separated import statements and non-import
statements. This meant that the non-emitted statement from Tsickle
for the synthetic file-overview comments no longer lived at the
beginning of the file.

`addImports` tried to overcome this by adding another new non-emitted
statement *before* all imports. This then was later used by the
transform (or was assumed!) to attach the synthetic file overview
comments if the original tsickle AST Node is no longer at the top.

This logic can be improved, because the import manager shouldn't need to
bother about this fileoverview non-emitted statement, and the logic for
re-attaching the fileoverview comment should be local. This commit fixes
this and makes it a local transform.

PR Close #54819
2024-03-15 15:09:41 -07:00
Paul Gschwendtner de75fe0358 test(compiler-cli): add tests to verify import generation in TCB files/blocks (#54819)
This commit adds some unit tests verifying the import generation in TCB
files and inline blocks. We don't seem to have any unit tests for these
in general. This commit adds some, verifying some characteristics we
would like to guarantee.

PR Close #54819
2024-03-15 15:09:41 -07:00
Paul Gschwendtner 0e9c075cac refactor(compiler-cli): rename ImportManagerV2 to ImportManager (#54819)
To ease review and to allow for both instances to co-exist, `ImportManagerV2`
was introduced. This commit renames it to `ImportManager` now that we
deleted the older one.

PR Close #54819
2024-03-15 15:09:41 -07:00
Paul Gschwendtner 922f950e45 refactor(compiler-cli): delete old unused ImportManager (#54819)
This commit deletes the older and now unused `ImportManager`.

PR Close #54819
2024-03-15 15:09:40 -07:00
Paul Gschwendtner bec0179afe test(compiler-cli): enable incremental re-use type checking with signal inputs (#54819)
Enables the incremental type-checking test that we never enabled when we
landed signal inputs. Now that we fixed incremental re-use by re-using
the existing user imports for inline type check blocks, the test is
passing and can be enabled.

PR Close #54819
2024-03-15 15:09:40 -07:00
Paul Gschwendtner 94bc3afc23 refactor(compiler-cli): switch jit transforms to use new import manager (#54819)
Switches the JIT transforms to use the new import manager.

PR Close #54819
2024-03-15 15:09:40 -07:00
Paul Gschwendtner dc80046132 refactor(compiler-cli): update type check generation code to use new import manager (#54819)
Updates the type-check block generation code (also for inline type check
blocks) to use the new import manager.

This is now a requirement because the translator utilities from the
reference emit environment expect an import manager that follows the
new contract established via `ImportGenerator<TFile, TExpression>`.

For type check files, we can simply print new imports as we don't expect
existing imports to be updated. That is because type check files do not
have any _original_ source files (or in practice— those are empty).

For type check blocks inline, or constructors, imports _may_ be re-used.
This is great as it helps fixing some incrementality bugs that we were
seeing in the type check code. That is, sometimes the type check block
code may generate imports conditionally for e.g. `TemplateRef`, or
animations. Those then **prevent** incremental re-use if TCB code
switches between those continously. We tried to account for that with
signal inputs by always pre-generating such imports. This fixed the
issue for type-check files, but for inline type check blocks this is
different as we would introduce new imports in user code that would then
be changed back in subsequential edit iterations. See:
https://github.com/angular/angular/pull/53521#pullrequestreview-1778130879.

In practice, the assumption was that we would be fine since user code is
most likely containing imports to `@angular/core` already. That is a
true assumption, but unfortunately it doesn't help with incremental
re-use because TypeScript's structural change detection does not dedupe
and expects 1:1 exact imports from their old source files.

https://github.com/microsoft/TypeScript/pull/56845

To improve incremental re-use for the type check integration, we should
re-use original source file imports when possible. This commit enables
this.

To update imports and execute inline operations, we are now uisng
`magic-string` (which is then bundled) as it simplifies the string
manipulatuons.

PR Close #54819
2024-03-15 15:09:40 -07:00
Paul Gschwendtner 6288f1c679 refactor(compiler-cli): use new import manager for ngtsc transforms (#54819)
This commit switches ngtsc's JS and DTS transform to use the new import
manager. This is a drop-in replacement as we've updated the translator
helpers in the previous commit to align with the new API suggested by
the `ImportManagerV2` (to be renamed then).

PR Close #54819
2024-03-15 15:09:40 -07:00
Paul Gschwendtner 0482b6b4c7 refactor(compiler-cli): update ImportGenerator abstraction for new manager (#54819)
`ImportGenerator` is the abstraction used by the translator functions to
insert imports for `ExternalExpr` in an AST-agnostic way.

This was built specifically for the linker which does not use any of the
complex import managers- but rather re-uses `ngImport` or uses
`ngImport.Bla`.

This commit also switches the linker AST-agnostic generator to follow
the new signatures. This was rather trivial.

PR Close #54819
2024-03-15 15:09:40 -07:00
Paul Gschwendtner 9a56bd50f5 refactor(compiler-cli): introduce new implementation of ImportManager (#54819)
This commit introduces a new implementation of `ImportManager` that has
numerous benefits:

- It allows efficient re-use of original source file imports.
  * either fully re-using original imports if matching
  * updating existing import declarations to include new symbols.
- It allows efficient re-use of previous generated imports.
- The manager can be used for schematics and migrations.

The implementation is a rework of the import manager that we originally
built for schematics in Angular Material, but this commit improved it
to be more flexible, more readable, and "correct".

In follow-ups we can use this for schematics/migrations.

PR Close #54819
2024-03-15 15:09:40 -07:00
Alex Rickabaugh 5901b0ca80 Revert "fix(router): Routed components never inherit RouterOutlet EnvironmentInjector (#54265)" (#54895)
This reverts commit da906fdafc.

This change causes some test failures in google3.

PR Close #54895
2024-03-15 15:08:45 -07:00
Angular Robot 369157063c build: update dependency google-closure-compiler to v20231112 (#54893)
See associated pull request for more information.

PR Close #54893
2024-03-15 18:31:22 +00:00
Angular Robot 406448a09a build: update dependency archiver to v7 (#54892)
See associated pull request for more information.

PR Close #54892
2024-03-15 18:18:34 +00:00
Joey Perrott 9574edaa44 build: lock file maintenance (#54890)
See associated pull request for more information.

PR Close #54890
2024-03-15 18:01:45 +00:00
Angular Robot e56c86f93c build: update actions/cache digest to ab5e6d0 (#54886)
See associated pull request for more information.

PR Close #54886
2024-03-15 17:28:14 +00:00
Angular Robot d3309d7d9c build: update dependency @octokit/graphql to v8 (#54888)
See associated pull request for more information.

PR Close #54888
2024-03-15 17:24:51 +00:00
Angular Robot dbe2e3898b build: update dependency lighthouse to v11 (#54292)
See associated pull request for more information.

PR Close #54292
2024-03-15 17:22:55 +00:00
Angular Robot 8cee78d25b build: update all non-major dependencies (#54616)
See associated pull request for more information.

PR Close #54616
2024-03-15 17:21:28 +00:00
Angular Robot 97da5f7804 build: update io_bazel_rules_sass digest to 79bd239 (#54887)
See associated pull request for more information.

PR Close #54887
2024-03-15 17:16:23 +00:00
Angular Robot 0472a92bc6 build: update cross-repo angular dependencies (#54883)
See associated pull request for more information.

PR Close #54883
2024-03-15 17:06:43 +00:00
Angular Robot e473b709bc docs: update events (#54749)
Generated `events.json` with the latest events retrieved from the Firebase DB.

PR Close #54749
2024-03-15 16:38:14 +00:00
Angular Robot 70e2431b75 build: update dependency puppeteer-core to v22 (#54298)
See associated pull request for more information.

PR Close #54298
2024-03-15 16:31:25 +00:00
Angular Robot 17199b9214 build: update peter-evans/create-or-update-comment action to v4 (#54299)
See associated pull request for more information.

PR Close #54299
2024-03-15 16:30:51 +00:00
Angular Robot 1f8a30dca9 build: update eslint dependencies (#50993)
See associated pull request for more information.

PR Close #50993
2024-03-15 16:30:11 +00:00
Andrew Scott da906fdafc fix(router): Routed components never inherit RouterOutlet EnvironmentInjector (#54265)
This commit ensures components in the route config predictably always
get their providers from the hierarchy available to routes rather than
sometimes being dependent on where they are inserted.

fixes #53369

BREAKING CHANGE: Providers available to the routed components always
come from the injector heirarchy of the routes and never inherit from
the `RouterOutlet`. This means that providers available only to the
component that defines the `RouterOutlet` will no longer be available to
route components in any circumstances. This was already the case
whenever routes defined providers, either through lazy loading an
`NgModule` or through explicit `providers` on the route config.

PR Close #54265
2024-03-14 12:33:13 -07:00
Andrew Scott 2b802587f2 feat(router): Allow Route.redirectTo to be a function which returns a string or UrlTree (#52606)
This commit updates the logic around `Route.redirectTo` to enable using a
function to create the redirect. This function can return a string,
ands acts the same as previous string redirects, or a `UrlTree`, which
will act as an absolute redirect.

To be useful, the redirect function needs access to the params and data.
Today, developers can access these in their redirect strings, for
example `{path: ':id', redirectTo: '/user/:id'}`. Unfortunately,
developers only have access to params and data on the _current route_
today in the redirect strings. The params and data in the `RedirectFn`
give developers access to anything from the matched parent routes as
well. This is done as the same way as param and data aggregation later
on (https://github.com/angular/angular/blob/897f014785578d87bc655ea6ae9e113653960f50/packages/router/src/router_state.ts#L236-L278).
In order to accomplish this, we inherit params and data while
matching, after the `ActivatedRouteSnapshot` is created for the matched
route rather than waiting until the end.

The `RedirectFunction` does not return the full
`ActivatedRouteSnapshot` interface. Some things are not accurately known
at the route matching phase. For example, resolvers are not run until
later, so any resolved title would not be populated. The same goes for lazy
loaded components. The is also true for all the snapshots up to the
root, so properties that include parents (root, parent, pathFromRoot)
are also excluded. And naturally, the full route matching hasn't yet
happened so firstChild and children are not available either.

fixes #13373
resolves #28661 (though not for the redirect string - you would return a
`UrlTree` from the function)

BREAKING CHANGE: This change allows `Route.redirectTo` to be a function
in addition to the previous string. Code which expects `redirectTo` to
only be a string on `Route` objects will need to be adjusted.

PR Close #52606
2024-03-14 11:19:01 -07:00
Angular Robot b71a32324e docs: update Angular CLI help [main] (#54861)
Updated Angular CLI help contents.

PR Close #54861
2024-03-14 08:55:42 -07:00
Andrew Scott 77a397b382 release: cut the v18.0.0-next.0 release 2024-03-14 08:44:29 -07:00
Andrew Scott 700c0520bb fix(core): Update ApplicationRef.tick loop to only throw in dev mode (#54848)
This commit updates the loop in ApplicationRef.tick to only throw in dev
mode. In addition, it reduces the reruns to 10 from 100 in order to
reduce the impact on production applications that encounter this error.
That is, the loop will bail out much earlier and prevent prolonged
unresponsiveness.

PR Close #54848
2024-03-13 15:35:34 -07:00
Andrew Scott 1b19d2d430 docs: release notes for the v17.3.0 release 2024-03-13 14:09:11 -07:00
Andrew Scott 2d47329444 build: update symbol goldens (#54843)
fix goldens after recent commit

PR Close #54843
2024-03-13 11:36:06 -07:00
Andrew Scott 0dd441d08f refactor(core): Remove cancelation funtion from scheduler return value (#54578)
Canceling a scheduled callback is not used.

PR Close #54578
2024-03-13 11:09:56 -07:00
Andrew Scott 10c5cdb49c fix(core): ensure change detection runs in a reasonable timeframe with zone coalescing (#54578)
Zone event and run coalescing now races `requestAnimationFrame` and
`setTimeout`. There are tradeoffs to both functions and racing the two
gives us the benefits of both. This is explained in more detail in the
jsdoc comment. This change also aligns the timing of zone coalescing
with what will be used for zoneless.

BREAKING CHANGE: The exact timing of change detection execution when
using event or run coalescing with `NgZone` is now the first of either
`setTimeout` or `requestAnimationFrame`. Code which relies on this
timing (usually by accident) will need to be adjusted. If a callback
needs to execute after change detection, we recommend `afterNextRender`
instead of something like `setTimeout`.

fixes #54544
fixes #44314
fixes #39854 (unverified but seems likely)

PR Close #54578
2024-03-13 11:09:55 -07:00
Andrew Scott 8cad4e8cbe fix(core): ComponentFixture autoDetect respects OnPush flag of host view (#54824)
This is a follow-up to #53718 that applies the same logic to the
`autoDetect` feature of the fixture's host view. This now unifies the
logic between `ApplicationRef` and `ComponentFixture` autodetect.

BREAKING CHANGE: The `ComponentFixture` `autoDetect` feature will no
longer refresh the component's host view when the component is `OnPush`
and not marked dirty. This exposes existing issues in components which
claim to be `OnPush` but do not correctly call `markForCheck` when they
need to be refreshed. If this change causes test failures, the easiest
fix is to change the component to `ChangeDetectionStrategy.Default`.

PR Close #54824
2024-03-13 08:32:03 -07:00
JoostK edc1740d7e refactor(core): restructure logic in isCssClassMatching function (#54800)
The logic in `isCssClassMatching` is only interested in two areas in the attributes:
implicit attributes and the `AttributeMarker.Classes` area, with the first area only
of interest for projection matching, not directive matching. This commit splits these
two searches to make this more apparent.

PR Close #54800
2024-03-12 14:05:16 -07:00
JoostK e6ee6d25f9 fix(core): exclude class attribute intended for projection matching from directive matching (#54800)
This commit resolves a regression that was introduced when the compiler switched from
`TemplateDefinitionBuilder` (TDB) to the template pipeline (TP) compiler. The TP compiler
has changed the output of

```html
if (false) { <div class="test"></div> }
```

from

```ts
defineComponent({
  consts: [['class', 'test'], [AttributeMarker.Classes, 'test']],
  template: function(rf) {
    if (rf & 1) {
      ɵɵtemplate(0, App_Conditional_0_Template, 2, 0, "div", 0)
    }
  }
});
```

to

```ts
defineComponent({
  consts: [[AttributeMarker.Classes, 'test']],
  template: function(rf) {
    if (rf & 1) {
      ɵɵtemplate(0, App_Conditional_0_Template, 2, 0, "div", 0)
    }
  }
});
```

The last argument to the `ɵɵtemplate` instruction (0 in both compilation outputs) corresponds with
the index in `consts` of the element's attribute's, and we observe how TP has allocated only a single
attribute array for the `div`, where there used to be two `consts` entries with TDB. Consequently,
the `ɵɵtemplate` instruction is now effectively referencing a different attributes array, where the
distinction between the `"class"` attribute vs. the `AttributeMarker.Classes` distinction affects
the behavior: TP's emit causes the runtime to incorrectly match a directive with `selector: '.foo'` to
be instantiated on the `ɵɵtemplate` instruction as if it corresponds with a structural directive!

Instead of changing TP to align with TDB's emit, this commit updates the runtime instead. This uncovered
an inconsistency in selector matching for class names, where there used to be two paths dealing with
class matching:

1. The first check was commented to be a special-case for class matching, implemented in `isCssClassMatching`.
2. The second path was part of the main selector matching algorithm, where `findAttrIndexInNode` was being used
   to find the start position in `tNode.attrs` to match the selector's value against.

The second path only considers `AttributeMarker.Classes` values if matching for content projection, OR of the
`TNode` is not an inline template. The special-case in path 1 however does not make that distinction, so it
would consider the `AttributeMarker.Classes` binding as a selector match, incorrectly causing a directive to
match on the `ɵɵtemplate` itself.

The second path was also buggy for class bindings, as the return value of `classIndexOf` was incorrectly
negated: it considered a matching class attribute as non-matching and vice-versa. This bug was not observable
because of another issue, where the class-handling in part 2 was never relevant because of the special-case
in part 1.

This commit separates path 1 entirely from path 2 and removes the buggy class-matching logic in part 2, as
that is entirely handled by path 1 anyway. `isCssClassMatching` is updated to exclude class bindings from
being matched for inline templates.

Fixes #54798

PR Close #54800
2024-03-12 14:05:16 -07:00
Ben Hong 0f7bbd0fc5 docs: fix missing security guide in navigation (#54830)
The paths for the security guide were flipped in the original PR. As a result, it looked for a markdown file in the best-practices directory when it should have looked for it in the guide directory instead.

PR Close #54830
2024-03-12 13:12:58 -07:00
Gerald Monaco 456f18be2e refactor(core): add internal API to enable i18n hydration (#54784)
Add an internal API to enable and use i18n hydration for testing and development. This helps ensure that we don't accidentally break the current behavior until we are completely ready to roll out i18n support.

PR Close #54784
2024-03-12 11:38:59 -07:00
cexbrayat db2f9a9561 refactor(compiler-cli): cleanup unused code (#54775)
The initializer api no longer needs to take care of `ɵoutput`.

PR Close #54775
2024-03-12 11:31:39 -07:00
Ben Hong 4ff94aa46c docs: improve in-depth guides information architecture (#54365)
PR Close #54365
2024-03-12 10:25:31 -07:00
Joey Perrott 6a07c0c2b2 fix(docs-infra): remove the prerender directory from adev (#54820)
Remove the prerender directory as it is entirely unused and unneeded

PR Close #54820
2024-03-12 10:24:04 -07:00
Paul Gschwendtner 1294b9a02a refactor(core): report subscription errors for OutputEmitterRef to ErrorHandler (#54821)
Currently if an `(output)` listener fails, it will be handled gracefully
by Angular and reported to the `ErrorHandler`.

For programmatic subscriptions with `OutputEmitterRef`, this is not the case.
Instead, as soon as any subscription is failing, all other subsequent
subscription callbacks are not firing anymore.

This commit intends to make this more consistent by gracefully
reporting errors from `OutputEmitterRef#emit` to `ErrorHandler`,
allowing for listener execution to continue.

PR Close #54821
2024-03-12 10:21:48 -07:00
Andrew Scott 8735af08b9 feat(router): Add ability to return UrlTree with NavigationBehaviorOptions from guards (#45023)
Returning `UrlTree` from a guard was a convenient new feature added to
the `Router`. However, it does not have feature-parity with the old
`router.navigate(...); return false;` pattern. The most common use-case
for this feature is to redirect to a new page _without_ updating the URL
from the initially attempted navigation. For example, rendering a 404
page when the user does not have access privelages to a route.

Fixes #17004
Fixes #27148

BREAKING CHANGE: Guards can now return `RedirectCommand` for redirects
in addition to `UrlTree`. Code which expects only `boolean` or `UrlTree`
values in `Route` types will need to be adjusted.

PR Close #45023
2024-03-12 09:19:14 -07:00
cexbrayat 87cae55e55 docs: typo in output documentation (#54773)
PR Close #54773
2024-03-12 09:15:04 -07:00
Angular Robot bea7f33ad7 docs: update Angular CLI help [main] (#54815)
Updated Angular CLI help contents.

PR Close #54815
2024-03-12 09:13:55 -07:00
Kristiyan Kostadinov 018f8266b3 fix(core): ensure all initializer functions run in an injection context (#54761)
Ensures that all of the functions intended to be run in initializers are in an injection context. This is a stop-gap until we have a compiler diagnostic for it.

PR Close #54761
2024-03-12 09:08:06 -07:00
Pawel Kozlowski 47f79e78c0 refactor(core): assert presence of the track function (#54814)
This commits assert that the repeater instruction gets a reference
to a tracking function. This change will allow us to better track
occurences of https://github.com/angular/angular/issues/53628 -
in certain situations a reference to a tracking function might be
undefiened.

We are not fixing the underlying issue here, just getting better
visibility.

PR Close #54814
2024-03-11 16:33:01 -07:00
Paul Gschwendtner 142825d7b1 perf(core): speed up retrieval of DestroyRef in EventEmitter (#54748)
Speeds up the retrieval of `DestroyRef` in `EventEmitter` because
`try/catch` is expensive if there is no injection context.

We saw a script time regression in Cloud.

The goldens had to be updated because `getInjectImplementation` is now
referenced. `inject` also references the underlying field, but directly.
This is super minimal overhead of a function exposing the internal
field.

PR Close #54748
2024-03-11 16:31:03 -07:00
Matthieu Riegler f0a26001c5 docs: use the right path for first-app images (#54694)
PR Close #54694
2024-03-11 16:30:28 -07:00
Kristiyan Kostadinov 6ea208ee90 refactor(compiler-cli): move defer resolver compilation into compiler package (#54759)
Moves the logic that creates the defer resolver function into `@angular/compiler` for consistency with the rest of the compilation APIs. Also renames some of the symbols to make it clearer what they're used for.

PR Close #54759
2024-03-11 15:52:42 -07:00
Kristiyan Kostadinov 9b424d7224 fix(compiler-cli): preserve original reference to non-deferrable dependency (#54759)
Fixes an issue where we were outputting the reference to non-deferrable dependencies as strings, rather than going through the reference emitter. This caused some issues internally because the reference wasn't maintained in the generated JS.

PR Close #54759
2024-03-11 15:52:41 -07:00
Kristiyan Kostadinov 83932aa85e refactor(compiler): rework defer block analysis (#54759)
Currently we have the `deferrableDeclToImportDecl`, `deferBlocks`, `deferrableTypes` and `deferBlockDepsEmitMode` fields on the `R3ComponentMetadata` which is incorrect, because the interface is used both for JIT and AOT mode even though the information for those fields is AOT-specific. It will be problematic for partial compilation since the runtime will have a reference to the dependency loading function, but will not be able to provide any of the other information.

These changes make the following refactors:
1. It changes the defer-related information in `R3ComponentMetadata` to include only references to dependency functions which can be provided both in JIT and AOT.
2. Moves the AOT-specific defer analysis into the `ComponentResolutionData`.
3. Moves the construction the defer dependency function into the compilation phase of the `ComponentDecoratorHandler`.
4. Drops support for defer blocks from the `TemplateDefinitionBuilder`. This allows us to clean up some TDB-specific code and shouldn't have an effect on users since the TDB isn't used anymore.

PR Close #54759
2024-03-11 15:52:41 -07:00
Andrew Scott 64f870c12b fix(core): ApplicationRef.tick should respect OnPush for host bindings (#53718) (#53718)
This commit updates `ApplicationRef.tick` to use `detectChangesInternal` for root
views rather than go through the `ChangeDetectorRef.detectChanges` API
which refreshes the host view without first looking at whether the view
is `OnPush` and not dirty. The current behavior would hide errors in
`OnPush` components that do not correctly get marked for check and would
break when migrating to zoneless change detection because `markForCheck`
was never called so change detection was never scheduled.
The error would be surprising and blamed on switching to zoneless when in
reality the issue already exists and is a problem with the component not
calling `markForCheck`. However, this error is hidden today because
`ApplicationRef.tick` refresh host bindings unconditionally.

BREAKING CHANGE: `OnPush` views at the root of the application need to
be marked dirty for their host bindings to refresh. Previously, the host
bindings were refreshed for all root views without respecting the
`OnPush` change detection strategy.

PR Close #53718

PR Close #53718
2024-03-11 13:46:11 -07:00
Joey Perrott d714e998d6 docs: bump to 2024 for copyright text (#54822)
Bump copyright text to 2024

PR Close #54822
2024-03-11 13:39:38 -07:00
Andrew Kushnir eaff724b77 fix(core): prevent infinite loops in clobbered elements check (#54425)
This commit updates HTML sanitization logic to avoid infinite loops in case clobbered elements contain fields like `nextSibling` or `parentNode`. Those fields are used for DOM traversal and this update makes sure that those calls return valid results.

Also this commit fixes an issue when clobbering `nodeName` causes JS exceptions.

PR Close #54425
2024-03-11 12:46:16 -07:00
Gerald Monaco 280a3a2d62 refactor(core): add i18nNodes in preparation for i18n hydration (#54750)
An i18n message effectively acts as a dynamic template: two elements with contiguous instruction indices won't necessarily be contiguous in the DOM.

For that reason, we need to maintain a mapping from instruction index to a physical DOM node in order to hydrate views with i18n, pointing to where hydration for that view should begin.

PR Close #54750
2024-03-11 11:12:43 -07:00
Matthieu Riegler 837016ccca build: remove AIO related extensions (#54698)
With AIO being deprecated those extensions can be removed.
PR Close #54698
2024-03-11 11:04:38 -07:00
Kristiyan Kostadinov 5ae2bf4806 fix(compiler): handle two-way bindings to signal-based template variables in instruction generation (#54714)
Updates the instruction generation for two-way bindings to only emit the `twoWayBindingSet` call when writing to template variables. Since template variables are constants, it's only allowed to write to them when they're signals. Non-signal values are flagged during template type checking.

Fixes #54670.

PR Close #54714
2024-03-11 11:01:43 -07:00
Kristiyan Kostadinov ffb9b44333 fix(compiler-cli): flag two-way bindings to non-signal values in templates (#54714)
We have a diagnostic that reports writes to template variables which worked both for regular event bindings and two-way bindings, however the latter was broken by #54154 because two-way bindings no longer had a `PropertyWrite` AST.

These changes fix the diagnostic and expand it to allow two-way bindings to template variables that are signals.

PR Close #54714
2024-03-11 11:01:42 -07:00
Kristiyan Kostadinov fd17b4e155 refactor(compiler-cli): move illegal template assignment check into template semantics checker (#54714)
Moves the check which ensures that there are no writes to template variables into the `TemplateSemanticsChecker` to prepare for the upcoming changes.

PR Close #54714
2024-03-11 11:01:42 -07:00
Kristiyan Kostadinov 6235095011 refactor(compiler-cli): move signal identification function (#54714)
Moves the function that identifies signals into a separate file so that it can be reused outside of extended diagnostics.

PR Close #54714
2024-03-11 11:01:42 -07:00
Kristiyan Kostadinov f86088f164 refactor(compiler-cli): introduce template semantics checker (#54714)
Introduces a new `TemplateSemanticsChecker` that will be used to flag semantic errors in the user's template. Currently we do some of this in the type check block, but the problem is that it doesn't have access to the template type checker which prevents us from properly checking cases like #54670. This pass is also distinct from the extended template checks, because we don't want users to be able to turn the checks off and we want them to run even if `strictTemplates` are disabled.

PR Close #54714
2024-03-11 11:01:42 -07:00
Matthieu Riegler 09a2f3d592 docs: adding signal inputs and model to ADEV. (#54753)
Those docs are a copy from AIO.

PR Close #54753
2024-03-11 11:00:49 -07:00
theRealc0d3c 55c647bf90 docs: fix typo in tutorial (#54817)
PR Close #54817
2024-03-11 10:59:49 -07:00
Matthieu Riegler 1c9abb9ac8 build: Unplug AIO from CI (#54765)
The time has come to unplug AIO from the CI.

Farewell and thanks for your services 🫡

PR Close #54765
2024-03-11 10:59:07 -07:00
Kristiyan Kostadinov 81ccf5d102 fix(compiler): not catching for loop empty tracking expressions (#54772)
Fixes that the template parser wasn't catching empty expressions in the `track` parameter of for loops.

Fixes #54763.

PR Close #54772
2024-03-11 09:17:39 -07:00
Kristiyan Kostadinov 5b927c094d build: update to TypeScript 5.4 stable (#54743)
Updates the repo to the stable version of TypeScript 5.4.

PR Close #54743
2024-03-11 09:16:55 -07:00
JoostK d269c88ae4 refactor(core): avoid additional closure for queued microtask callback (#54801)
The `runCallbackOnce` closure is declared not to have any parameters itself, so it is
compatible as `queueMicrotask` callback without the extra closure. This reduces the call
stack by a frame and avoids the extra closure allocation.

PR Close #54801
2024-03-11 08:59:55 -07:00
JoostK fa315d4dad refactor(core): properly type withBody and withHead testing helpers (#54801)
This commit addresses a typing mismatch, where these functions were declared to return whichever
value their callback returned, but this was inaccurate: it's always a test callback function
with `done` argument.

PR Close #54801
2024-03-11 08:59:55 -07:00
JoostK 0bcaa0ebee test(core): ensure async tests are awaited properly (#54801)
The assertion in `packages/core/test/acceptance/after_render_hook_spec.ts:165` was prone to flakes,
where Jasmine could frequently report an error:

```
Error: 'expect' was used when there was no current spec, this could be because an asynchronous test timed out
    at Env.expect (node_modules/jasmine-core/lib/jasmine-core/jasmine.js:1945:15)
    at expect (node_modules/jasmine-core/lib/jasmine-core/jasmine.js:8267:18)
    at file:///packages/core/test/acceptance/after_render_hook_spec.ts:165:12
```

This happens because `wrapTestFn` checks for an exact type of `Promise`, which may have been patched by zone.js
such that the `instanceof` condition is dependent on whether zone.js has patched the `Promise` constructor.

PR Close #54801
2024-03-11 08:59:55 -07:00
Matthieu Riegler 484ae23bbf build: remove non-exisiting target from test:ci (#54791)
This target doesn't exist any more.

PR Close #54791
2024-03-11 14:06:50 +00:00
Dylan Hunn 54340a9fff refactor(compiler): Delete TemplateDefinitionBuilder acceptance test expectations (#54757)
Many acceptance tests define goldens for both `TemplateDefinitionBuilder` and Template Pipeline. All such tests have had the TDB golden files removed, and the corresponding expectations adjusted.

PR Close #54757
2024-03-08 16:51:01 -08:00
Dylan Hunn ef32b5322e refactor(compiler): Delete TemplateDefinitionBuilder and helpers (#54757)
`TemplateDefinitionBuilder` is the legacy template compiler, and was replaced by Template Pipeline as the default in v17.3.

This PR attempts to delete `TemplateDefinitionBuilder`, `ExpressionConverter`, and various helpers (i18n context, style builder, property visitors, etc).

Consider this a first pass: a lot of code has not yet been deleted (e.g. old TDB-specific test cases), and I'm sure I have missed additional helper code.

PR Close #54757
2024-03-08 16:51:01 -08:00
Andrew Scott 37d1f713a4 Revert "fix(core): ApplicationRef.tick should respect OnPush for host bindings (#53718)" (#54774)
This reverts commit d888da4606.
2024-03-08 05:57:15 -08:00
Andrew Scott fb189c6997 Revert "refactor(compiler): rework defer block analysis (#54700)" (#54758)
This reverts commit eee620aa00.
2024-03-07 16:20:09 -08:00
Kristiyan Kostadinov 8180c39479 build: fix size failure (#54756)
Fixes a broken size CI check.

PR Close #54756
2024-03-07 16:13:43 -08:00
Andrew Scott 115ee88ba9 fix(router): Navigations triggered by cancellation events should cancel previous navigation (#54710)
There is an edge case where synchronous navigations caused in
response to navigation events can result in a previous navigation not
being unsubscribed from. b/328219996

PR Close #54710
2024-03-07 13:07:08 -08:00
Andrew Scott 2787c50107 refactor(core): render hooks should always run on node attach or detach (#54083)
This commit ensures that render hooks are rerun when a node is attached
or detached. We do not necessarily need to run change detection but DOM
did change so render hooks should execute.

PR Close #54083
2024-03-07 12:59:10 -08:00
Andrew Scott d4247af8c5 refactor(core): Skip refresh views if render hooks are the only notification source (#54083)
Do not refresh views if the only thing that notified the scheduler was
registration of a new render hook.

PR Close #54083
2024-03-07 12:59:10 -08:00
Andrew Scott 53e743938f refactor(core): registering afterRender hooks notify scheduler (#54083)
This commit updates the `afterRender` and `afterNextRender` hooks to
notify the scheduler (which subsequently schedules change detection)
when created. This makes the hooks similar to `requestAnimationFrame`,
which requests that the browser schedule a rendering operation. This
reqeust is not conditional. Even if there was nothing to repaint, the
`requestAnimationFrame` callback will execute.

In Angular, this is useful because callers of `afterNextRender` don't
necessarily have any way of knowing whether a change detection is even
scheduled. For example, the anchor scrolling with the Angular Router
needs to wait for rendering to complete before attempting to scroll
because rendering can affect the size of the page. However, if the user
is already on the page that the navigation is targeting, such as
navigating to an anchor on the page, there is nothing new for the Router
to render so a render might not even be scheduled.

Related to https://github.com/angular/angular/issues/53985, which
could use `afterNextRender` instead of `setTimeout` to ensure the
scrolling happens in the same frame as the page rendering, but would not
necessarily work without this change (as described above). Note that the
scrolling _cannot_ use a microtask to ensure scrolling happens in the
same frame because `NgZone` will ensure microtasks flush before
change detection, so it would cause the scroll to happen before rendering.

PR Close #54083
2024-03-07 12:59:09 -08:00
Gerald Monaco 43ab781b70 refactor(core): refactor i18n node creation to prepare for hydration (#54722)
Adds a `locateOrCreateNode` helper and uses it for all DOM operations in preparation for supporting hydration.

PR Close #54722
2024-03-07 12:41:43 -08:00
Kristiyan Kostadinov eee620aa00 refactor(compiler): rework defer block analysis (#54700)
Currently we have the `deferrableDeclToImportDecl`, `deferBlocks`, `deferrableTypes` and `deferBlockDepsEmitMode` fields on the `R3ComponentMetadata` which is incorrect, because the interface is used both for JIT and AOT mode even though the information for those fields is AOT-specific. It will be problematic for partial compilation since the runtime will have a reference to the dependency loading function, but will not be able to provide any of the other information.

These changes make the following refactors:
1. It changes the defer-related information in `R3ComponentMetadata` to include only references to dependency functions which can be provided both in JIT and AOT.
2. Moves the AOT-specific defer analysis into the `ComponentResolutionData`.
3. Moves the construction the defer dependency function into the compilation phase of the `ComponentDecoratorHandler`.
4. Drops support for defer blocks from the `TemplateDefinitionBuilder`. This allows us to clean up some TDB-specific code and shouldn't have an effect on users since the TDB isn't used anymore.

PR Close #54700
2024-03-07 12:40:44 -08:00
Andrew Scott d888da4606 fix(core): ApplicationRef.tick should respect OnPush for host bindings (#53718)
This commit updates `ApplicationRef.tick` to use `detectChangesInternal` for root
views rather than go through the `ChangeDetectorRef.detectChanges` API
which refreshes the host view without first looking at whether the view
is `OnPush` and not dirty. The current behavior would hide errors in
`OnPush` components that do not correctly get marked for check and would
break when migrating to zoneless change detection because `markForCheck`
was never called so change detection was never scheduled.
The error would be surprising and blamed on switching to zoneless when in
reality the issue already exists and is a problem with the component not
calling `markForCheck`. However, this error is hidden today because
`ApplicationRef.tick` refresh host bindings unconditionally.

BREAKING CHANGE: `OnPush` views at the root of the application need to
be marked dirty for their host bindings to refresh. Previously, the host
bindings were refreshed for all root views without respecting the
`OnPush` change detection strategy.

PR Close #53718
2024-03-07 11:13:03 -08:00
Leonardo Ortiz 8bf842d595 docs: update content readme link (#53763)
PR Close #53763
2024-03-07 11:06:55 -08:00
Leonardo Ortiz 30dccd4b77 docs: readme from blossom (#53763)
PR Close #53763
2024-03-07 11:06:55 -08:00
Angular Robot 4f808ad353 docs: update events (#54721)
Generated `events.json` with the latest events retrieved from the Firebase DB.

PR Close #54721
2024-03-07 11:05:36 -08:00
Gerald Monaco e0c1f1e183 refactor(core): don't hydrate detached nodes (#54723)
In preparation for hydration support, make sure that we don't attempt to hydrate detached nodes and instead, always newly create them.

PR Close #54723
2024-03-07 11:01:29 -08:00
Gerald Monaco 9104c62ab3 refactor(core): add i18n AST to prepare for hydration (#54724)
In order to serialize and hydrate i18n blocks, we need to be able to walk an AST for the translated message. This AST is generated during normal parsing of the message.

PR Close #54724
2024-03-07 11:00:36 -08:00
Alan Agius 2258ac7a32 fix(http): exclude caching for authenticated HTTP requests (#54746)
This update modifies the transfer cache logic to prevent caching of HTTP requests that require authorization.

Closes: #54745

PR Close #54746
2024-03-07 11:00:00 -08:00
Dylan Hunn ef39107ce5 refactor(language-service): Replace tsserverlibrary -> typescript (#54726)
Typescript recently consolidated `tsserverlibrary` into `typescript`: [blog post](https://devblogs.microsoft.com/typescript/announcing-typescript-5-3/#consolidation-between-tsserverlibrary-js-and-typescript-js)

In this commit, we remove all references to `tsserverlibrary` accordingly. This should be safe, since v18 and later support TS 5.3+.

PR Close #54726
2024-03-07 10:49:01 -08:00
Dylan Hunn 126879e9d0 refactor(language-service): Make a variety of fixes to the language service to build in g3. (#54726)
The following changes help the language service code build in g3:
* `Omit<T>` produces an index signature, so we must access the resulting properties with square bracket (because `noPropertyAccessFromIndexSignature` is on in g3).
* Explicitly export `absoluteFrom` from `packages/compiler-cli/index.ts`, since the `*` re-export is patched out in g3.
* Remove const from a few const enums, since accessing const enums across modules is not compatible with `isolatedModules` (which is on in g3).

PR Close #54726
2024-03-07 10:49:01 -08:00
Andrew Scott cd242a11f5 refactor(core): Remove isInternal flag (#54740)
This is not needed any longer since the changes that used it have
landed.

PR Close #54740
2024-03-07 09:07:01 -08:00
Andrew Scott ad045efd4b fix(core): Ensure views marked for check are refreshed during change detection (#54735)
When a view has the `Dirty` flag and is reattached, we should ensure that it is
reached and refreshed during the next change detection run from above.

In addition, when a view is created and attached, we should ensure that it is reached
and refreshed during change detection. This can happen if the view is
created and attached outside a change run or when it is created and
attached after its insertion view was already checked. In both cases, we
should ensure that the view is reached and refreshed during either the
current change detection or the next one (if change detection is not
already running).

We can achieve this by creating all views with the `Dirty` flag set.

However, this does happen to be a breaking change in some scenarios.
The one identified internally was actually depending on change detection
_not_ running immediately because it relied on an input value that was
set using `ngModel`. Because `ngModel` sets its value in a `Promise`, it
is not available until the _next_ change detection cycle. Ensuring
created views run in the current change change detection will result in
different behavior in this case.

fixes #52928
fixes #15634

BREAKING CHANGE: Newly created and views marked for check and reattached
during change detection are now guaranteed to be refreshed in that same
change detection cycle. Previously, if they were attached at a location
in the view tree that was already checked, they would either throw
`ExpressionChangedAfterItHasBeenCheckedError` or not be refreshed until
some future round of change detection. In rare circumstances, this
correction can cause issues. We identified one instance that relied on
the previous behavior by reading a value on initialization which was
queued to be updated in a microtask instead of being available in the
current change detection round. The component only read this value during
initialization and did not read it again after the microtask updated it.

PR Close #54735
2024-03-06 15:44:09 -08:00
Andrew Scott ba8e465974 fix(core): Change Detection will continue to refresh views while marked for check (#54734)
When the `ApplicationRef` refreshes attached views, it will continue to
do so while there is still one marked for check after the refresh
completes.

BREAKING CHANGE: When Angular runs change detection, it will continue to
refresh any views attached to `ApplicationRef` that are still marked for
check after one round completes. In rare cases, this can result in infinite
loops when certain patterns continue to mark views for check using
`ChangeDetectorRef.detectChanges`. This will be surfaced as a runtime
error with the `NG0103` code.

PR Close #54734
2024-03-06 15:43:16 -08:00
Andrew Scott d9c0a16521 refactor(core): Fix internal test util types (#54736)
This fixes and error that has been seen recently where compilation fails
due to domino.impl type not being recognized

PR Close #54736
2024-03-06 13:34:53 -08:00
Andrew Scott 24bc0ed4f2 fix(core): ComponentFixture autodetect should detect changes within ApplicationRef.tick (#54733)
The current behavior of `autoDetect` in `ComponentFixture` does not
match production very well. It has several flaws that make it an
insufficient change detection mechanism:

* It runs change detection for the component under test _after_ views
  attached to the `ApplicationRef`. This can cause real behavior
  differences that break in production, because tests can observe view
  refreshes in the incorrect order (for example, a dialog refreshing
  before the component which opened it).
* Because of the above ordering, render hooks registered during change
  detection of the fixture views _will not execute at all_ because
  `ApplicationRef.tick` already happen.
* It does not rerun change detection on the view tree if there are more
  dirty views to refresh after the render hooks complete.
* It effectively hides/swallows errors from change detection inside the
  `onMicrotaskEmpty` subscription by not reporting them to the error
  handler. Instead, this error ends up being unhandled in the
  subscription and rxjs throws these in a `setTimeout`.

All of the above are problematic but this commit _does not_ fix the
final point. Ideally, we can land this in a future change but this
requires additional internal fixes. In the meantime, we have to juggle
special-case handling of the component fixture views within
`ApplicationRef.tick` using some special events to retain current
behavior and avoid errors from the fixture propagating to the `ErrorHandler`.

BREAKING CHANGE: The `ComponentFixture.autoDetect` feature now executes
change detection for the fixture within `ApplicationRef.tick`. This more
closely matches the behavior of how a component would refresh in
production. The order of component refresh in tests may be slightly
affected as a result, especially when dealing with additional components
attached to the application, such as dialogs. Tests sensitive to this
type of change (such as screenshot tests) may need to be updated.
Concretely, this change means that the component will refresh _before_
additional views attached to `ApplicationRef` (i.e. dialog components).
Prior to this change, the fixture component would refresh _after_ other
views attached to the application.

PR Close #54733
2024-03-06 13:33:54 -08:00
Andrew Scott fc0f47c53f release: bump the next branch to v18.0.0-next.0 (#54737) 2024-03-06 13:26:34 -08:00
Pawel Kozlowski 781dbe2cc2 docs: release notes for the v17.3.0-rc.0 release 2024-03-06 20:44:52 +01:00
Pawel Kozlowski 24a35366ca release: bump the next branch to v17.4.0-next.0 2024-03-06 20:44:52 +01:00
Pawel Kozlowski 4be96326a7 docs: release notes for the v17.2.4 release 2024-03-06 20:34:37 +01:00
Matthieu Riegler 7243c704cf fix(core): return a readonly signal on asReadonly. (#54706)
Previous `asReadonly()` returned the signal value and not the signal itself.

Fixes #54704

PR Close #54706
2024-03-06 14:41:12 +01:00
Paul Gschwendtner e5885fa6d4 build: update ng-dev to avoid node-fetch usages (#54715)
See: https://github.com/angular/dev-infra/pull/1829

PR Close #54715
2024-03-06 12:16:38 +00:00
Paul Gschwendtner d4154f9e3c refactor(core): revert listener subscription typeof check (#54650)
For model signals we introduced some sniffing on the return type of a
`.subscribe` invocation- allowing for subscribe to _just_ return a
callback directly to unsubscribe.

This works in practice, but the positive `tCleanup` indices have more
meaning, especially in the context of `DebugElement`. A positive index
indicates a DOM event- so we need to revert this change. This now
surfaced as we made `EventEmitter` return a function + the subscription
via a proxy that ended up `typeof function` --> and broke some tests
where debug element incorrectly invoked non-dom outputs as dom
listeners. We don't need this change with current unsubscribe function
concept.

PR Close #54650
2024-03-06 12:34:39 +01:00
Paul Gschwendtner 2df8584619 refactor(compiler-cli): speed up compiler tests by caching Angular (#54650)
Currently the `makeProgram` utility from `ngtsc/testing` does not use
the test host by default- optimizing for source file caching.

Additionally, the host can be updated to attempt caching of the `.d.ts`
files from `@angular/core`— whether that's fake core, or the real core-
is irrelevant. We are never caching if these changes between tests, so
correctness is guaranteed.

This commit reduces the type check test times form 80s to just 11
seconds, faster than what it was before with `fake_core`. The ngtsc
tests also run significantly faster. From 40s to 30s

PR Close #54650
2024-03-06 12:34:39 +01:00
Paul Gschwendtner 8a8b682d05 test: integration test for output() api (#54650)
Adds an integration test for `output()` and `outputFromObservable()`.
The test verifies the JIT transform as well.

PR Close #54650
2024-03-06 12:34:39 +01:00
Paul Gschwendtner 6b1401a370 test: add compiler ngtsc tests for new outputFromObservable API (#54650)
Adds additional ngtsc compiler tests for the `outputFromObservable` API.

PR Close #54650
2024-03-06 12:34:39 +01:00
Paul Gschwendtner ea03104aa6 test: fix global augmentation leaking into all source files (#54650)
The `inject` global augmentation from upgrade tests, leak into
all source files for IDEs, making it easy to run into issues
when actually trying to deal with `inject` from Angular core for DI.

PR Close #54650
2024-03-06 12:34:39 +01:00
Paul Gschwendtner 400b739874 test: add language-service tests for outputFromObservable() (#54650)
Adds additional language-service tests for `outputFromObservable()`.
Existing tests already verify the behavior for `output()`.

PR Close #54650
2024-03-06 12:34:39 +01:00
Paul Gschwendtner 500a13e77d refactor(core): enforce model() and output() is used in an injection context (#54650)
Technically `model()` and `output()` already need to be defined in an
injection context- because `OutputRef` requires this.

To improve the error messaging, this commit asserts this as part of the
top-level entry functions for `model()` and `output()`. Without this
change, the error would mention the `_createOutputRef` internal
function.

PR Close #54650
2024-03-06 12:34:39 +01:00
Paul Gschwendtner db7962adb2 test: add runtime tests for output() function API (#54650)
Adds runtime acceptance tests for `output()` and
`outputFromObservable()`.

PR Close #54650
2024-03-06 12:34:39 +01:00
Paul Gschwendtner 866271a1c6 refactor(core): EventEmitter implements OutputRef. (#54650)
An `EventEmitter` is a construct owned by Angular that should be
used for outputs as of right now.

As we are introducing the new `OutputRef` interface for the new output
function APIs, we also think `EventEmitter` should implement
`OutputRef`— ensuring all "known" outputs follow the same contract.

This commit ensures `EventEmitter` implements an `OutputRef`

Note: An output ref captures the destroy ref from the current injection
context for clean-up purposes. This is also done for `EventEmitter` in a
backwards compatible way:

- not requiring an injection context. EventEmitter may be used
  elsewhere.
- not cleaning up subscriptions/completing the emitter when the
  directive/component is destroyed. This would be a change in behavior.

Note 2: The dependency on `DestroyRef` causes it to be retained in all
bundling examples because ironically `NgZone` uses `EventEmitter`- not
for outputs. The code is pretty minimal though, so that should be
acceptable.

`EventEmitter` will now always retain `NgZone. This increases the
payload size slightly around 800b for AIO. Note that the other increases
were coming from previous changes. This commit just pushed it over the
threshold.

PR Close #54650
2024-03-06 12:34:39 +01:00
Paul Gschwendtner 30355f6719 refactor(core): model() implements OutputRef (#54650)
A model signal is technically an output, at runtime and conceptually.

This commit re-uses the shared output ref logic and ensures the
interfaces match.

PR Close #54650
2024-03-06 12:34:38 +01:00
Paul Gschwendtner e7ea6c0564 test: add compliance generated output tests for output() (#54650)
This commit adds compliance tests for the new output APIs.

PR Close #54650
2024-03-06 12:34:38 +01:00
Paul Gschwendtner aff65fd1f4 feat(core): introduce outputToObservable interop helper (#54650)
This commit introduces an addition to `output()` and
`outputFromObservable`()` —called `outputToObservable()`.

The helper lives in the RxJS interop package and allows agnostic
programmatic subscriptions to `OutputRef`s by converting the output
to an observable with `.pipe` etc.

The function is ideally used in all places where you subscribe to an
output programmatically. Those outputs in the future, with the new APIs,
may not be actual RxJS constructs, but abstract `OutputRef`'s that
simply expose a `.subscribe` method. The helper allows you to
agnostically convert outputs to RxJS observables that you can safely
interact with.

The observables are also completed automatically, if possible, when the
owning directive/component is destroyed— Something that is not
guaranteed right now.

PR Close #54650
2024-03-06 12:34:38 +01:00
Paul Gschwendtner c809069f21 feat(core): introduce outputFromObservable() interop function (#54650)
Introduces a second API in addition to the new `output()` function.

The new function `outputFromObservable()` can be used to declare outputs
using the new `OutputRef` API and `output()` API, while using a custom
RxJS observable as data source.

This is something that is currently possible in Angular and we would
like to keep possible- even though we never intended to support custom
observables aside from RxJS-based `EventEmitter`.

The interop bridges the gap and allows you to continue using
`Subject`, `ReplaySubject`, `BehaivorSubjct,` - or cold custom
observables for outputs. You can still trigger logic only when
the output is subscribed- unlike with imperative `emit`s of
`EventEmitter` or the new `OutputEmitterRef`.

A notable difference is that you need two class members where you
previously could access the `Subject` directly. This is an intentional
trade-off we've made to ensure that all new outputs implement the
`OutputRef` interface and we are exposing a minimal API surface to
consumers of components that currently access the output
programmatically.

PR Close #54650
2024-03-06 12:34:38 +01:00
Paul Gschwendtner 9b5129259e refactor(compiler-cli): support detecting initializer APIs from different modules (#54650)
This commit allows us to detect initializer APIs like
`outputFromObservable` that are declared in different modules- not
necessarily `@angular/core`.

PR Close #54650
2024-03-06 12:34:38 +01:00
Paul Gschwendtner c687b8f453 feat(core): expose new output() API (#54650)
This commit exposes the new `output()` API with numerous benefits:

- Symmetrical API to `input()`, `model()` etc.
- Fixed types for `EventEmitter.emit`— current `emit` method of
  `EventEmitter` is broken and accepts `undefined` via `emit(value?: T)`
- Removal of RxJS specific concepts from outputs. error channels,
  completion channels etc. We now have a simple consistent
  interface.
- Automatic clean-up of subscribers upon directive/component destory-
  when subscribed programmatically.

```ts
@Directive({..})
export class MyDir {
  nameChange = output<string>();     // OutputEmitterRef<string>
  onClick = output();                // OutputEmitterRef<void>
}
```

Note: RxJS custom observable cases will be handled in future commits via
explicit helpers from the interop.

PR Close #54650
2024-03-06 12:34:38 +01:00
Paul Gschwendtner 9ce627746c refactor(core): create OutputRef runtime construct (#54650)
This commit creates the proposed `OutputRef` interface along
with `OutputEmitterRef`:

- `OutputRef` is the consistent interface for all Angular outputs.
- `OutputEmitterRef` is an extension for emitting values. Like
  `EventEmitter`.
- subscriptions are cleaned up automatically upon directive/component
  destroy.
- emitting is an error when destroyed
- subscribing programmatically is an error when already destroyed.

This commit will also implement the shared output ref runtime construct,
that can be used by `output()`, `outputFromObservable()` and `model()`.

We will manage subscriptions in a simple way, manually, without RxJS.

PR Close #54650
2024-03-06 12:34:38 +01:00
Paul Gschwendtner 2564b45b47 test: replace fake_core with real @angular/core output (#54650)
This commit replaces `fake_core` with the real `@angular/core`
output. See previous commit for reasons.

Overall, this commit:

* Replaces references of `fake_core`
* Fixes tests that were testing Angular compiler detection that _would_
  already be flagged by type-checking of TS directly. We keep these
  tests for now, and add `@ts-ignore` to verify the Angular checks, in
  case type checking is disabled in user applications- but it's worth
  considering to remove these tests. Follow-up question/non-priority.
* Adds `@ts-ignore` to the tests for `defer` 1P because the property is
  marked as `@internal` and now is (correctly) causing failures in the
  compiler test environment.
* Fixes a couple of tests with typos, wrong properties etc that
  previously weren't detected! A good sign.

PR Close #54650
2024-03-06 12:34:38 +01:00
Paul Gschwendtner 5afa4f0ec1 fix(compiler-cli): support ModuleWithProviders literal detection with typeof (#54650)
As part of improving test safety of the compiler, I've noticed that
we have a special pass for detecting external `ModuleWithProviders`
where we detect the module type from an object literal.

This literal is structured like the following: `{ngModule: T}`. The
detection currently takes `T` directly, but in practice it should be
`typeof T` to satisfy the `ModuleWithProviders` type that is accepted
as part of `Component#imports`.

This commit adds support for this, so that we can fix the unit test
in preparation for using the real Angular core types in ngtsc tests.

PR Close #54650
2024-03-06 12:34:38 +01:00
Angular Robot bd60fb1f4e docs: update Angular CLI help [main] (#54712)
Updated Angular CLI help contents.

PR Close #54712
2024-03-06 10:34:11 +01:00
Alan Agius 4842eedd7e fix(docs-infra): do not delete BUILD.bazel in help directory during updates (#54697)
In https://github.com/angular/angular/pull/54591, a `BUILD.bazel` file was created in `aio/content/cli/help/BUILD.bazel`, this however breaks the automatic CLI help pages updates as prior to this change, the `help` directory was being deleted. See: https://github.com/angular/angular/pull/54691/commits/17346e89da2fbddf8274eeadf12bab9c5b8983d8

This commit, updates the process to delete only the JSON files and copying the new files.

PR Close #54697
2024-03-06 10:18:03 +01:00
Jessica Janiuk 755390ace3 docs: add process documentation to CARETAKER.md (#54664)
This adds documentation regarding the latest changes to framework merge tools. It specifically covers the requires: TGP label and separate sync for primitives.

PR Close #54664
2024-03-05 19:11:41 +01:00
Matthieu Riegler d2ec5b6178 docs: fix clipped docs-code block in docs-reference-api-tab (#54621)
PR Close #54621
2024-03-05 18:35:09 +01:00
Matthieu Riegler b5366f20d9 docs: fix tutorial preview size (#54621)
PR Close #54621
2024-03-05 18:35:06 +01:00
Matthieu Riegler 40424fc4b6 docs: fix label on API link. (#54621)
Remove the unecessary double quotes on a @see link.

PR Close #54621
2024-03-05 18:35:04 +01:00
Matthieu Riegler 70996ed8d3 docs(docs-infra): remove unwanted styling on API page. (#54621)
`box-sizing: border-box` prevents overflow caused by borders.

PR Close #54621
2024-03-05 18:35:02 +01:00
Jessica Janiuk 0ecf515798 ci: fix ng-dev build for pr merging (#54707)
This updates ng-dev to the latest hash fixing the merge files query.

PR Close #54707
2024-03-05 18:16:30 +01:00
Dylan Hunn b40f1e5b86 refactor(compiler): Remove deep imports in the language service (#54695)
Previously, the language service relied on deep imports such as `@angular/compiler/render3/...`. This is bad form, because that creates a dependency on the package's internal structure. Additionally, this is not compatible with google3.

In this PR, I replace all the deep imports with shallow imports, in some cases adding the missing symbol to the `compiler.ts` exports.

PR Close #54695
2024-03-05 10:28:45 +01:00
Andrew Kushnir 33a6fab094 fix(core): apply TestBed provider overrides to @defer dependencies (#54667)
This commit updates TestBed logic to take into account situations when dependencies loaded within `@defer` blocks may import NgModules with providers. For such components, we invoke provider override function, which recursively inspects and applies the necessary changes.

PR Close #54667
2024-03-05 09:21:22 +01:00
Paul Gschwendtner 78e69117f0 fix(core): generic inference for signal inputs may break with --strictFunctionTypes (#54652)
This commit fixes that the generic inference for signal inputs may break
with `--strictFunctionTypes`.

We are not using --strictFunctionTypes` in all tests, so function parameters are always
checked bivariantly- while in 1P function parameters are checked contravariantly. This
breaks sub-typing and e.g. `InputSignal<number>` is not a subtype of `InputSignalWithTransform<unknown, number>`.

Root cause is that the input signal captures the equality function that
is exclusively concerned with the `ReadT`. And `ReadT` is never equal, or a
supertype of unknown.

https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBASwHY2FAZgQwMbDgSSTAFcYBlBAcyUwBsB1BGACwBUpMkBndaAWwA8AJWCYAJqwA0celCbBWAPjgBvAFBw4Aei1xWACXxlEXOCzxQIEeNkzEuwAIRmAnmDxhMHPsFRRTXnjYzMDYANbAYnDYECgcAG5eCJwwtC7SAHIA8qxwAEYIALSJcilpAHQacMAAjsR0AFxwABSYTSLiUvntohIAlHAAvMp5VrSiSADcalUA+rNQvaw9ndOa8wDucqjLMtsK0wC+aqCQsIgoaFi4BESkFNR0wkuKVaCoSGKmhCTkVDQMJhsDjcXhQQQdCTSSFKVTHNQxbjwEBNH73f50RgsdicHj8ATEJBhJAQDZIaRIYh8PJoZSDKqU2i0ZyYb53P6PWgCSnU2nTKpaABUM00rDceAA5GiOQDuVSaVBFBKTHASfBWVwMXlxmYIK53HApeyHgCscDcWDBITiaTyar5bSJZVReLTBB0HAwJZ3LAXIbavVaMrAhcYnxPDAENrgM7NHpxYbWk0eQrpHlkw6oANhvkxhNlQhTGq4BqtTqYHqYAmJUm4NaSWS00167bsyM85wnVU4-H3G6PZ5vL40KYJZhg59DeOS4tQxBw5hI9HYz2XQaJS2yQWi9YS1xNY9o7r9ZKU2gnc0AEwzDTZVgAUSaABF7wAFe8ZF8ZXJZDJwAAGhSFFwMByNgMAAGKEuBCCxGKfb-nA6C0JglArqugpaEAA

PR Close #54652
2024-03-04 19:07:39 +01:00
cexbrayat 5e32a775d9 refactor(compiler): cleanup unused code in template builder pipeline (#54654)
This removes some unused code and fixes a few typos across the pipeline code.

PR Close #54654
2024-03-04 18:15:54 +01:00
Jessica Janiuk 6531e4c365 ci: Add primitives configurations for ng-dev tools (#54662)
This adds the configs to enable validators and google sync patterns for primitives sharing.

PR Close #54662
2024-03-04 17:41:17 +01:00
danieljancar 07d5e42dbb docs: revise documentation for @for control flow, 'track $index' performance issues explanation, and confusing 'trackBy' mention (#53806)
PR Close #53806
2024-03-04 11:37:37 +01:00
Pawel Kozlowski 0ddae16aac docs: queries as signals adev guide (#54505)
Add a angular.dev version of queries as signals guide.

PR Close #54505
2024-03-04 11:11:16 +01:00
Andrew Scott 07173fd011 refactor(core): Pending effects should make the application unstable (#53835)
In zone-full applications, this is already true because effects are
scheduled inside a microtask and tracked by ZoneJS. When not using
zones, this should stay consistent on principle and for testability
reasons. A general pattern with zoneless testing will be to update state
and `await` some promise (i.e. `fixture.whenStable`, which will be
linked to `ApplicationRef.isStable`).

PR Close #53835
2024-03-04 10:35:38 +01:00
Matthieu Riegler 0d98972cc6 docs(docs-infra): Update tutorial deps (#54677)
PR Close #54677
2024-03-04 10:03:14 +01:00
Hozefa Mangalorewala 3e703f55e0 docs: fix broken link on the tutorial page (#54669)
PR Close #54669
2024-03-03 13:59:02 +01:00
Andrew Scott 66d78a7dcc refactor(core): ComponentFixture autodetect should detect changes within ApplicationRef.tick (#54354)
The current behavior of `autoDetect` in `ComponentFixture` does not
match production very well. It has several flaws that make it an
insufficient change detection mechanism:

* It runs change detection for the component under test _after_ views
  attached to the `ApplicationRef`. This can cause real behavior
  differences that break in production, because tests can observe view
  refreshes in the incorrect order (for example, a dialog refreshing
  before the component which opened it).
* Because of the above ordering, render hooks registered during change
  detection of the fixture views _will not execute at all_ because
  `ApplicationRef.tick` already happen.
* It does not rerun change detection on the view tree if there are more
  dirty views to refresh after the render hooks complete.
* It effectively hides/swallows errors from change detection inside the
  `onMicrotaskEmpty` subscription by not reporting them to the error
  handler. Instead, this error ends up being unhandled in the
  subscription and rxjs throws these in a `setTimeout`.

All of the above are problematic but this commit _does not_ fix the
final point. Ideally, we can land this in a future change but this
requires additional internal fixes. In the meantime, we have to juggle
special-case handling of the component fixture views within
`ApplicationRef.tick` using some special events to retain current
behavior and avoid errors from the fixture propagating to the `ErrorHandler`.

breaking note for future when isG3 flag condition is removed for v18:
The `ComponentFixture.autoDetect` feature now executes
change detection for the fixture within `ApplicationRef.tick`. This more
closely matches the behavior of how a component would refresh in
production. The order of component refresh in tests may be slightly
affected as a result, especially when dealing with additional components
attached to the application, such as dialogs. Tests sensitive to this
type of change (such as screenshot tests) may need to be updated.

PR Close #54354
2024-02-29 20:53:09 -08:00
Swami b3220795d5 refactor(core): remove unused EffectRef import statement (#53863)
Remove unused, leftover imports.

PR Close #53863
2024-02-29 14:54:50 +01:00
Alex Rickabaugh ffad7b8ea9 fix(core): untrack various core operations (#54614)
One downside of implicit dependency tracking in `effect()`s is that it's easy
to for downstream code to end up running inside the effect context by accident.
For example, if an effect raises an event (e.g. by `next()`ing a `Subject`), the
subscribers to that `Observable` will run inside the effect's reactive context,
and any signals read within the subscriber will end up as dependencies of the
effect. This is why the `untracked` function is useful, to run certain
operations without incidental signal reads ending up tracked.

However, knowing when this is necessary is non-trivial. For example, injecting
a dependency might cause it to be instantiated, which would run the constructor
in the effect context unless the injection operation is untracked.

Therefore, Angular will automatically drop the reactive context within a number
of framework APIs. This commit addresses these use cases:

* creating and destroying views
* creating and destroying DI injectors
* injecting dependencies
* emitting outputs

Fixes #54548

There are likely other APIs which would benefit from this approach, but this
is a start.

PR Close #54614
2024-02-29 11:38:54 +01:00
Matthieu Riegler 9a8a544e78 docs(docs-infra): remove the override for piscina (#54656)
PR Close #54656
2024-02-29 11:07:07 +01:00
Andrew Scott c1c7384e02 feat(router): Add reusable types for router guards (#54580)
This refactor makes it easier to update the return types of guards.
Rather than having to track what types guards can return, which may
change with new features over time, `MaybeAsync<GuardResult>` can be
used instead.

PR Close #54580
2024-02-28 18:09:33 +01:00
Kristiyan Kostadinov fb540e169a feat(core): add migration for invalid two-way bindings (#54630)
As a part of #54154, an old parser behavior came up where two-way bindings were parsed by appending `= $event` to the event side. This was problematic, because it allowed some non-writable expressions to be passed into two-way bindings.

These changes introduce a migration that will change the two-way bindings into two separate input/output bindings that represent the old behavior so that in a future version we can throw a parser error for the invalid expressions.

```ts
// Before
@Component({
  template: `<input [(ngModel)]="a && b"/>`
})
export class MyComp {}

// After
@Component({
  template: `<input [ngModel]="a && b" (ngModelChange)="a && (b = $event)"/>`
})
export class MyComp {}
```

PR Close #54630
2024-02-28 18:06:23 +01:00
Kristiyan Kostadinov ae7dbe42de fix(compiler-cli): unwrap expressions with type parameters in query read property (#54647)
Fixes that a query like `viewChild('locator', {read: ElementRef<HTMLElement>})` would throw because we didn't account for expressions with type parameters.

I've also included support for parenthesized expressions and `as` expressions since it's pretty easy to support them.

Fixes #54645.

PR Close #54647
2024-02-28 18:05:13 +01:00
Kristiyan Kostadinov d7c686537a build: update to the TypeScript 5.4 RC (#54643)
Updates the repor to the release candidate of the TypeScript 5.4.

PR Close #54643
2024-02-28 17:43:17 +01:00
Tommy Gaessler 06ffe9a021 docs: updated setting up Zone.js instructions (#52409)
Updated the "Setting up Zone.js" instructions to the latest convention from
how the Angular CLI configures it.
Include adding zone-flats.ts to the tsconfig.app.json file step.
Added src/ to zone-flag.ts in the code example.

PR Close #52409
2024-02-28 17:35:10 +01:00
Kristiyan Kostadinov c1590e733e docs: fix broken link in AIO (#54649)
Fixes a broken link that is currently breaking the CI.

PR Close #54649
2024-02-28 17:15:06 +01:00
Nikita Barsukov 1519b5bd2f docs: fix broken markdown syntax (#53567)
PR Close #53567
2024-02-28 15:16:14 +01:00
mgechev 2f875d0790 docs: update versioning and deprecation policies (#51423)
Add more details around:
- What we consider a breaking change
- What is a deprecation
- How do we guarantee Angular stays stable
- Update invalid links

PR Close #51423
2024-02-28 14:38:36 +01:00
mgechev 52970e3f23 docs: add updating to v17 guide (#52410)
PR Close #52410
2024-02-28 14:19:45 +01:00
Joey Perrott 2e401c74e7 fix(docs-infra): include CLI reference docs in adev (#54591)
include the reference docs in the adev application

PR Close #54591
2024-02-28 12:48:09 +01:00
Dylan Hunn e92354570d docs: release notes for the v17.2.3 release 2024-02-27 16:28:23 -08:00
Dylan Hunn ccda258bc5 release: cut the v17.3.0-next.1 release 2024-02-27 16:12:02 -08:00
Paul Gschwendtner df0e69b464 build: handle commonjs dependencies when bundling language service (#54429)
Fixes that the language service bundling would throw if a CommonJS dependency is used.

PR Close #54429
2024-02-27 15:24:24 -08:00
Kristiyan Kostadinov 7da459102d refactor(compiler-cli): use semver for version parsing (#54429)
Follow-up to #54423 which uses `semver` to parse the version instead of doing it ourselves.

PR Close #54429
2024-02-27 15:24:23 -08:00
Matthieu Riegler 3d6552cfd8 docs(docs-infra): update angular/build-tooling and angular/docs (#54555)
Fixes #54476, #52603, #52734

PR Close #54555
2024-02-27 15:22:18 -08:00
Sumit Parakh ff40c9f762 fix(core): fix typo in injectors.svg file (#54596)
this commit fixes the unnecessary single quote in injectors.svg file

Closes #54592

PR Close #54596
2024-02-27 15:21:05 -08:00
Kristiyan Kostadinov 331b16efd2 feat(core): add API to inject attributes on the host node (#54604)
Angular has the `@Attribute` decorator that allows for attributes to be injected from the host node, but we don't have an equivalent for the `inject` function. These changes introduce the new `HostAttributeToken` class that can be used to inject attributes similarly to `@Attribute`. It can be used as follows:

```typescript
import {HostAttributeToken, inject} from '@angular/core';

class MyDir {
  someAttr = inject(new HostAttributeToken('some-attr'));
}
```

The new API works similarly to `@Attribute` with one key exception: it will throw a DI error when the attribute doesn't exist, instead of returning `null` like `@Attribute`. We made this change to align its behavior closer to other injection tokens.

PR Close #54604
2024-02-27 15:18:41 -08:00
Joey Perrott 4066e62db6 ci: use angular/team Github team for minimum review set (#54611)
Use the angular/team Github team to define the list of eligible minimum reviewer set so that it can be reused accross the organization

PR Close #54611
2024-02-27 15:17:07 -08:00
Angular Robot 6470e33a6d build: update io_bazel_rules_sass digest to 888dd9c (#54615)
See associated pull request for more information.

PR Close #54615
2024-02-27 14:06:29 -08:00
Joey Perrott 8f0c27ffc3 refactor(docs-infra): apply prettier formatting to adev (#54625)
Apply prettier formatting to adev code

PR Close #54625
2024-02-27 14:04:49 -08:00
Doug Parker 83d8c68690 release: bump Angular DevTools version to 1.0.11 (#54631)
PR Close #54631
2024-02-27 14:02:15 -08:00
Doug Parker dd9f9d7d44 Revert "refactor(devtools): implement iframe support for Angular DevTools' browser code (#53934)" (#54629)
This reverts commit dd3dac9cc9.

PR Close #54629
2024-02-27 14:00:13 -08:00
Doug Parker 133319eba0 Revert "refactor(devtools): implement multiframe support in devtools page (#53934)" (#54629)
This reverts commit ebcdc8dc96.

PR Close #54629
2024-02-27 14:00:12 -08:00
Doug Parker 3e0b3a1ec4 refactor: add --spawn_strategy local to --config debug (#54167)
This seems to be necessary to debug Node tests.

PR Close #54167
2024-02-26 18:36:38 -08:00
Andrew Scott 53820dd896 refactor(core): Internal render hooks trigger view refresh before executing user hooks (#54224)
This commit ensures that any internal render hooks that cause views to
become dirty again first refresh those dirty views before running user
render hooks. This ensures that user render hooks have the most complete
render state possible and stops them from needlessly executing multiple
times. This is important to maintain the goal of the public render
hooks, which is to provide the safest place to place code that depends
on DOM state, especially in ways that may force a browser paint.

PR Close #54224
2024-02-26 18:31:13 -08:00
Andrew Scott 46617ce44e refactor(core): Add helper function for queuing state updates (#54224)
This adds a helper function to defer application state updates to the
first possible "safe" moment. If application-wide change detection
(ApplicationRef.tick) is currently executing when this function is used,
the callback will execute as soon as all views attached to the
`ApplicationRef` have been refreshed. Refreshing the application views
will happen again before `checkNoChanges` executes.

When a change detection is _not_ running, this state update will execute
in the microtask queue.

This function is necessary as a replacement for current
`Promise.resolve().then(() => stateUpdate())` to be zoneless compatible
while ensuring those state updates are synchronized to the DOM before
the browser repaint. Without this, updates done in `Promise.resolve(...)` would
queue another round of change detection in zoneless applications, and
this change detection could happen in the next browser frame, and cause
noticeable flicker for the user.

Additionally, this function provides a way to perform state updates that
will run on the server as well as in the browser.

Last, current applications using `ngZone: 'noop'` may not be
calling `ApplicationRef.tick` at all so this function provides a
mechanism to ensure the state update still happens by racing
a microtask with `afterNextRender` (which might never execute).

PR Close #54224
2024-02-26 18:31:13 -08:00
cexbrayat f578889ca2 fix(compiler-cli): catch function instance properties in interpolated signal diagnostic (#54325)
Currently, the following template compiles without error, even if the signal is not properly called:

```
<div>{{ mySignal.name }}</div>
```

This is because `name` is one of the instance properties of Function (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function#instance_properties).

The interpolated signal diagnostic is now extended to catch such issues.

PR Close #54325
2024-02-26 18:30:05 -08:00
Angular Robot 684290976b build: update scorecard action dependencies (#54407)
See associated pull request for more information.

PR Close #54407
2024-02-26 18:29:36 -08:00
Kristiyan Kostadinov 12dc4d074e fix(compiler-cli): account for as expression in docs extraction (#54414)
Fixes that the extraction for `object-literal-as-enum` didn't account for constants initialized to an `as` expression.

PR Close #54414
2024-02-26 18:29:09 -08:00
Kristiyan Kostadinov 974958913c feat(core): support TypeScript 5.4 (#54414)
Adds support for TypeScript 5.4 to the project.

PR Close #54414
2024-02-26 18:29:09 -08:00
Angular Robot a2a0067aec build: update all non-major dependencies (#54510)
See associated pull request for more information.

PR Close #54510
2024-02-26 18:28:44 -08:00
cexbrayat 1de9e19250 docs: use components in model inputs guide (#54606)
The code example showcases a `@Directive` with a template instead of a `@Component`.

PR Close #54606
2024-02-26 18:28:10 -08:00
Kristiyan Kostadinov f5c566c079 fix(compiler-cli): identify aliased initializer functions (#54609)
Fixes that initializer functions weren't being recognized if they are aliased (e.g. `import {model as alias} from '@angular/core';`).

To do this efficiently, I had to introduce the `ImportedSymbolsTracker` which scans the top-level imports of a file and allows them to be checked quickly, without having to go through the type checker. It will be useful in the future when verifying that that initializer APIs aren't used in unexpected places.

I've also introduced tests specifically for the `tryParseInitializerApiMember` function so that we can test it in isolation instead of going through the various functions that call into it.

PR Close #54609
2024-02-26 18:27:15 -08:00
Joey Perrott 54b5a2f130 ci: correct @jeanmeche to @JeanMeche in pullapprove (#54610)
Correct the casing so that it works as expected.

PR Close #54610
2024-02-26 18:25:08 +00:00
Dylan Hunn 69948e1256 refactor(dev-infra): Import angular LS package in g3 (#54608)
Import `angular/packages/language-service` in g3. We will still need to write BUILD files to get it building.

PR Close #54608
2024-02-26 09:04:33 -08:00
Dylan Hunn d4343b53de Revert "fix(compiler-cli): identify aliased initializer functions (#54480)" (#54595)
This reverts commit f04ecc0cda.

PR Close #54595
2024-02-26 08:36:49 -08:00
Andrew Kushnir dcb9deb363 fix(core): collect providers from NgModules while rendering @defer block (#52881)
Currently, when a `@defer` block contains standalone components that import NgModules with providers, those providers are not available to components declared within the same NgModule. The problem is that the standalone injector is not created for the host component (that hosts this `@defer` block), since dependencies become defer-loaded, thus no information is available at host component creation time.

This commit updates the logic to collect all providers from all NgModules used as a dependency for standalone components used within a `@defer` block. When an instance of a defer block is created, a new environment injector instance with those providers is created.

Resolves #52876.

PR Close #52881
2024-02-23 12:30:05 -08:00
Pawel Kozlowski 0d95ae51fa refactor(core): use performance API for signals (#54521)
This commit adds a standard performance marker that can be viewed in Chrome dev tools and other tooling.
See more info at https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark

PR Close #54521
2024-02-23 12:18:30 -08:00
Kristiyan Kostadinov 4efcc74dd6 docs: add a guide for model inputs (#54514)
Adds a guide for `model()` inputs for angular.io. Will port this over to angular.dev once it's finalized.

PR Close #54514
2024-02-23 11:47:03 -08:00
Felix Geißler a3d5f7a2b3 docs: syntax error in signal input transform example (#54567)
PR Close #54567
2024-02-23 11:46:10 -08:00
loka shafeek 835c3a1c27 docs: Update wildcard route component to PageNotFoundComponent (#54570)
This PR enhances the Angular documentation by replacing the placeholder `<component-name>` with the actual `PageNotFoundComponent` in the wildcard route configuration. This update ensures that the documentation accurately reflects the recommended practice for handling page-not-found scenarios. Additionally, it addresses the issue where HTML entities like `&lt;` were being displayed instead of the desired `<` symbol, resulting in clearer and more readable documentation for users.
PR Close #54570
2024-02-23 11:45:38 -08:00
Kristiyan Kostadinov f04ecc0cda fix(compiler-cli): identify aliased initializer functions (#54480)
Fixes that initializer functions weren't being recognized if they are aliased (e.g. `import {model as alias} from '@angular/core';`).

To do this efficiently, I had to introduce the `ImportedSymbolsTracker` which scans the top-level imports of a file and allows them to be checked quickly, without having to go through the type checker. It will be useful in the future when verifying that that initializer APIs aren't used in unexpected places.

I've also introduced tests specifically for the `tryParseInitializerApiMember` function so that we can test it in isolation instead of going through the various functions that call into it.

PR Close #54480
2024-02-23 11:44:36 -08:00
Lukas Matta 52924c5317 docs: remove mutate function mention (#54569)
PR Close #54569
2024-02-23 11:43:24 -08:00
Matthieu Riegler 35e5ba0ba6 ci: adding Matthieu as approver for ADEV (#54575)
This is to help the team approve changes on the new doc site.

PR Close #54575
2024-02-23 11:42:44 -08:00
Kristiyan Kostadinov c5a7661319 refactor(compiler-cli): changes to get signal diagnostic working internally (#54585)
The diagnostic for signals that haven't been invoked wasn't working internally, because the path to `@angular/core` is different. These changes resolve the issue and do some general cleanup.

PR Close #54585
2024-02-23 11:42:04 -08:00
Kristiyan Kostadinov 71e0c7df69 fix(migrations): resolve infinite loop for a single line element with a long tag name and angle bracket on a new line (#54588)
Fixes an edge case where a single-line elemnt with a long tag name a closing bracket on a new line was putting the control flow migration into an infinite loop.

Fixes #54587.

PR Close #54588
2024-02-23 11:40:27 -08:00
Dylan Hunn 1a6beae8a2 feat(compiler): Enable template pipeline by default. (#54571)
Template pipeline is now the default template compiler.

A pair of source map tests is failing, related to DI in JIT mode; I will fix and re-enable these during the preview period.

PR Close #54571
2024-02-23 11:15:36 -08:00
Matthieu Riegler 812a9729fa docs(docs-infra): revert font-inlining (#54573)
To fix the CI/Build for ADEV.

PR Close #54573
2024-02-23 18:30:04 +00:00
Andrew Scott 3f95829f6d refactor(core): Allow dirty views to be refreshed in a loop internally (#54572)
ApplicationRef.tick has a loop that will refresh views again that have
an updated signal. This change ensures views marked with the `Dirty`
flag are also considered in this loop, but only inside g3 for now
because this may be considered a breaking change and we need to wait for
v18 to land externally.

PR Close #54572
2024-02-23 09:59:11 -08:00
Andrew Scott 707bfc9b32 perf(common): AsyncPipe should not call markForCheck on subscription (#54554)
This commit prevents `AsyncPipe` from calling `markForCheck` when values
are synchronously emit during subscription to an observable. This
prevents subscriptions to `Replay` observables from needlessly walking
up to the root of the view tree during template execution for each
new replay observable in the template.

PR Close #54554
2024-02-23 09:20:02 -08:00
Alex Rickabaugh 8e65bdc848 release: cut the v17.3.0-next.0 release 2024-02-21 18:02:51 -08:00
Alex Rickabaugh 09710295bc docs: release notes for the v17.2.2 release 2024-02-21 17:57:34 -08:00
Matthieu Riegler f5f73fd997 docs(docs-infra): enable webcontainers for Firefox (#54550)
PR Close #54550
2024-02-21 15:27:36 -08:00
Joey Perrott e7b6be5abe build: perform build/serve of adev locally (#54549)
Use no-remote-exec to allow for building and serving to occur locally but still allow remote caching.  Because of the number of
files involved in being passed to and from the RBE server, it is actually a bit faster to perform these actions locally.

PR Close #54549
2024-02-21 15:27:02 -08:00
Jessica Janiuk 42d3ddd9ae fix(migrations): Fix cf migration regular expression to include underscores (#54533)
In rare cases people may use an underscore in their component names, which was not accounted for in the formatting portion of the migration.

fixes: #54532

PR Close #54533
2024-02-21 15:25:05 -08:00
Doug Parker 9ec22244ee docs(devtools): expand release docs (#54525)
This provides some more information on how to release and notably includes commands for zipping extension code and source code, which can otherwise be tricky to get exactly right.

PR Close #54525
2024-02-21 15:24:26 -08:00
Doug Parker e9e5e255e9 release: bump Angular DevTools version to 1.0.10 (#54523)
PR Close #54523
2024-02-21 15:23:36 -08:00
Kristiyan Kostadinov a9f563f043 refactor(compiler-cli): move defer block tests into separate file (#54499)
Splits the tests for `@defer` blocks out into a separate file since the `ngtsc_spec.ts` is getting quite large.

PR Close #54499
2024-02-21 15:22:36 -08:00
Kristiyan Kostadinov badda0c389 fix(compiler-cli): correctly detect deferred dependencies across scoped nodes (#54499)
This is based on an internal issue report.

An earlier change introduced a diagnostic to report cases where a symbol is in the `deferredImports` array, but is used eagerly. The check worked by looking through the deferred blocks in a scope, resolving the scope for each and checking if the element is within the scope. The problem is that resolving the scope won't work across scoped node boundaries. For example, if there's a control flow statement around the block or within the block but around the deferred dependency, it won't be able to resolve the scope since it isn't a direct child, e.g.

```
@if (true) {
  @defer {
   <deferred-dep/>
  }
}
```

To fix this the case where the deferred block is inside a scoped node, I've changed the `R3BoundTarget.deferBlocks` to be a `Map` holding both the deferred block and its corresponding scope. Then to resolve the case where the dependency is within a scoped node inside the deferred block, I've added a depth-first traversal through the scopes within the deferred block.

PR Close #54499
2024-02-21 15:22:36 -08:00
Kristiyan Kostadinov 1d14e527d5 refactor(compiler-cli): add the ability to treat object literals as enums in docs (#54487)
We have a couple of cases now (#53753 and #54414) where we're forced to redefine enums as object literals. These literals aren't rendered in the best way in the docs so these changes introduce a new `object-literal-as-enum` tag that we can use to mark them so they're treated for documentation purposes.

PR Close #54487
2024-02-21 15:21:58 -08:00
Dean Davidson 5a13c18104 docs: add closing tags to code examples (#54485)
There were two minor issues in the code examples that this addresses.
PR Close #54485
2024-02-21 15:20:12 -08:00
Lukas Matta 27603996fa docs: fix typos (#54475)
PR Close #54475
2024-02-21 15:19:39 -08:00
vladboisa 024c14fb69 docs(docs-infra): fix tab shrinking (#54380)
Fix a behavior when block shrinks on Usage notes tab

Fixes #52818

PR Close #54380
2024-02-21 15:19:13 -08:00
cexbrayat efdc50a403 docs: view child static query differences formatting (#54370)
The docs were broken as the first line is the only one to be displayed in the table.

PR Close #54370
2024-02-21 15:18:43 -08:00
Dmitry Ivanitskiy dba3e0b5aa fix(compiler): adding the inert property to the "SCHEMA" array (#53148)
This change allows template binding "inert" attribute with the following syntax: [inert]="isInert"

Fixes #51879

fixup! fix(compiler): adding the inert property to the "SCHEMA" array

revert: "fixup! fix(compiler): adding the inert property to the "SCHEMA" array"

This reverts commit b637b7ce646e8bab2f585339028a84018e8ea982.

This commit is being reverted because the inert property is safe as a boolean attribute

PR Close #53148
2024-02-21 15:13:48 -08:00
Matthieu Riegler 23119c5397 refactor(platform-browser): use performance API for async animations (#53963)
This commit adds a standard performance marker

PR Close #53963
2024-02-21 15:12:04 -08:00
Andrew Scott d3b273ac33 fix(router): Clear internal transition when navigation finalizes (#54261)
This commit fixes a small memory issue in the router where a destroyed
component instance would be retained.

fixes #54241

PR Close #54261
2024-02-21 14:09:52 -08:00
Joey Perrott e9246f745a refactor(docs-infra): correct location of hosted images (#54547)
Properly include hosted images in the generated application

PR Close #54547
2024-02-21 16:52:01 +00:00
Matthieu Riegler 554628e190 docs(docs-infra): Add missing API entries to ADEV (#54530)
* `localize`: `MessageId` & `MessageId`
* `core/global`
*  `upgrade/static` : `downgradeComponent`, `downgradeInjectable`, `getAngularJSGlobal`, `getAngularLib`, `setAngularJSGlobal` & `setAngularLib`

PR Close #54530
2024-02-21 16:41:33 +00:00
Matthieu Riegler d49558d18d docs: fix brokens links (#54507)
PR Close #54507
2024-02-21 16:05:30 +00:00
Matthieu Riegler 0644072354 docs: fix links in ngModule API guide (#54507)
fixes #54506

PR Close #54507
2024-02-21 16:05:30 +00:00
Joey Perrott 7220c89cef fix(docs-infra): enable font inlining for adev (#54524)
Enable font inlining for adev

PR Close #54524
2024-02-21 16:02:00 +00:00
Joey Perrott 6501d9bbe1 build: update to the latest @angular/docs version (#54528)
Update @angular/docs to latest

PR Close #54528
2024-02-21 16:00:35 +00:00
cexbrayat 36afd8902b docs: typos in signal queries guide (#54540)
PR Close #54540
2024-02-21 15:59:00 +00:00
Matthieu Riegler dd413ebc3b docs(docs-infra): fix error page. (#54522)
Display the not found page on 404.

fixes #54506

PR Close #54522
2024-02-21 15:58:01 +00:00
Matthieu Riegler 55fd7b3c85 docs(docs-infra): Add missing api entries (#54517)
This commit adds `common/http/testing` and `platform-browser/animations/async`.

PR Close #54517
2024-02-20 09:50:36 -08:00
Kristiyan Kostadinov 219445cda4 fix(common): image placeholder not removed in OnPush component (#54515)
Fixes that the placeholder wasn't being removed when an optimized image is placed in an `OnPush` component.

Fixes #54478.

PR Close #54515
2024-02-20 09:49:58 -08:00
Pawel Kozlowski 69daa37b65 test(core): more tests for queries as signals (#54508)
A couple of tests that illustrate combination of signal
and decorator queries in once component.

PR Close #54508
2024-02-20 09:49:19 -08:00
JoostK 0c8744c73e fix(compiler-cli): use correct symbol name for default imported symbols in defer blocks (#54495)
This commit addresses a problem with PR #53695 that introduced support for default imports,
where the actual dynamic import used in the defer loading function continued to use the
symbol name, instead of `.default` for the dynamic import. This issue went unnoticed in the
testcase because a proper instance was being generated for the `ɵsetClassMetadataAsync` function,
but not the generated dependency loader function.

Fixes #54491

PR Close #54495
2024-02-20 09:45:32 -08:00
Jamie Couperwhite 960fe156ee docs: fix developer preview link in signal queries (#54492)
PR Close #54492
2024-02-20 09:44:42 -08:00
Alex Castle a14d139a24 docs(common): add new faq entry to NgOptimizedImage docs (#54469)
add new FAQ entry explaining that we're not adding new loaders to the angular repo

PR Close #54469
2024-02-20 09:43:46 -08:00
Andrew Scott a9741e69d2 docs(router): deprecate RouterTestingModule (#54466)
Deprecate `RouterTestingModule` as it is no longer needed or useful and
is not actively maintained.

fixes #54461

PR Close #54466
2024-02-20 09:33:16 -08:00
Ahmed Hakeem fcfef52cb2 docs: enhance Dependency injection description (#54464)
PR Close #54464
2024-02-20 09:29:53 -08:00
Matthieu Riegler 70345b1292 docs: override piscina dependency for webcontainers projects in adev (#54494)
PR Close #54494
2024-02-20 09:21:04 -08:00
Pawel Kozlowski d9a1a7dd07 fix(core): properly execute content queries for root components (#54457)
Prior to this fix an incorrect view instance (a dynamically created component
one instead of the root view) was passed to the content query function. Having
incorrect view instance meant that a component instance could not be found.

This is a pre-existing bug, introduction of signal-based queries just surfaced it.

Fixes #54450

PR Close #54457
2024-02-15 12:21:29 -08:00
Joey Perrott 62be6802d3 build: no longer include the unnecessary --config=aio_local_deps flag (#54465)
With the correction of how local build linker interaction works the `aio_local_deps` flag is
no longer needed.

PR Close #54465
2024-02-15 12:20:40 -08:00
Pawel Kozlowski ee9c272434 docs: add guide for signal queries (#54395)
Adding new guide for the signal-based queries.

PR Close #54395
2024-02-15 12:17:01 -08:00
Fabio Heer d181a36296 docs: correct default application builder for new apps (#54386)
The documentation on angular.dev mentions build-angular:browser as default
application builder. This is not correct. Recent applications are setup
with build-angular:application by default.

PR Close #54386
2024-02-15 10:54:17 -08:00
Joey Perrott 96e9dbee7f ci: automatically deploy to angular.dev on every push to the main branch (#54436)
Automatically deploy adev on each commit to the main branch

PR Close #54436
2024-02-15 10:50:03 -08:00
Joey Perrott 03acdbe94f fix(docs-infra): process mermaid code blocks (#54462)
Render mermaid code blocks as SVGs in adev

PR Close #54462
2024-02-15 10:33:34 -08:00
Dylan Hunn 6c2d4b650b refactor(compiler): Enable Template Pipeline globally in 1P. (#54435)
The switch/index.ts file only affects g3; externally, it is replaced with a Blaze genrule.

PR Close #54435
2024-02-15 09:24:18 -08:00
AleksanderBodurri ebcdc8dc96 refactor(devtools): implement multiframe support in devtools page (#53934)
In the Angular DevTools Chrome DevTools page:

- Angular DevTools is able to ask the background script to list each frame that has been registered on a page.
- Angular Devtools is able to ask the background script to "enable" the connection on a particular frame. This enables the messaging between the content script <-> background script <-> devtools page
- Implements detection of non unique urls on the inspected page

Limitations:
- The `inspectedWindow.eval` API is only able to target frames by frameURL. This means some features that integrate with Chrome DevTools like inspect element and open source will not be available when inspecting frames that do not have a unique url on the page.

PR Close #53934
2024-02-14 17:15:25 -08:00
AleksanderBodurri dd3dac9cc9 refactor(devtools): implement iframe support for Angular DevTools' browser code (#53934)
Modifies the messaging layer of devtools to allow for switching communication between frames on a page. When served as a browser extension.

Design:
- When a page renders, DevTools installs a content script onto it through it's manifest file. The all_frames option is used here to install this script onto every frame in a page.
- When Angular is detected, the content script will install a backend script into it's frame.
- Each content script / backend script pairing is kept track of in the background script. This pairing represents an angular devtools context in a particular frame.
- Angular DevTools is able to ask the background script to list each frame that has been registered on a page.
- Angular Devtools is able to ask the background script to "enable" the connection on a particular frame. This enables the messaging between the content script <-> background script <-> devtools page

Limitations:
- The `inspectedWindow.eval` API is only able to target frames by frameURL. This means some features that integrate with Chrome DevTools like inspect element and open source will not be available when inspecting frames that do not have a unique url on the page.

PR Close #53934
2024-02-14 17:15:25 -08:00
Andrew Kushnir e0d59f71bb Revert "fix(docs-infra): process mermaid code blocks (#54434)" (#54448)
This reverts commit 925c86a76e.
Reason for revert: broken CI after merging to main, see https://github.com/angular/angular/actions/runs/7908845750/job/21588824548.

PR Close #54448
2024-02-14 16:18:57 -08:00
Joey Perrott da7fbb40f0 fix(compiler-cli): detect when the linker is working in unpublished angular and widen supported versions (#54439)
When the linker is running using an unpublished version of angular, locally built, the version will be `0.0.0`.
When encountering this situation, the range that for the linker map support is considered to be `*.*.*` allowing
for the linker to work at build time with packages built with versioned angular.

Most notably this allows for us to properly use the linker in building our documentation site with the locally
built version of angular.

PR Close #54439
2024-02-14 15:43:22 -08:00
Angular Robot 36bd7d3a1d build: update all non-major dependencies (#54406)
See associated pull request for more information.

PR Close #54406
2024-02-14 15:39:36 -08:00
Joey Perrott 2bf0ccc002 docs: remove unnecessary usages of aio in adev (#54445)
Remove usages of aio in adev.

PR Close #54445
2024-02-14 15:38:45 -08:00
Joey Perrott 925c86a76e fix(docs-infra): process mermaid code blocks (#54434)
Render mermaid code blocks as SVGs in adev

PR Close #54434
2024-02-14 15:36:16 -08:00
Joey Perrott aefbe32cad ci: remove feature-request bot (#54442)
Remove feature request bot from usage.

PR Close #54442
2024-02-14 15:33:54 -08:00
Kisters-BS 20c47398b6 docs: fix typo (#54427)
PR Close #54427
2024-02-14 15:29:21 -08:00
Paul Gschwendtner 12d4b8eb47 docs: add guide for signal inputs (#54316)
Adds a guide for signal inputs.

We will port that to `angular.dev` once we finalized this version.

PR Close #54316
2024-02-14 15:22:49 -08:00
Andrew Kushnir ed0d5ec2ec docs: release notes for the v17.2.1 release 2024-02-14 14:57:48 -08:00
Alex Rickabaugh 9ca8c68528 fix(compiler-cli): fix broken version detection condition (#54443)
The version detection condition for signal two-way bindings used an OR
instead of an AND, resulting in every `.0` patch version being considered
as supporting two-way bindings to signals.

This commit fixes the logic and adds additional parentheses to ensure the
meaning of the condition is more clear. Long term, we should switch to
semver version parsing instead.

PR Close #54443
2024-02-14 12:47:02 -08:00
Andrew Kushnir edd10aceb2 docs: release notes for the v17.2.0 release 2024-02-14 11:01:06 -08:00
Kristiyan Kostadinov 981c28c15f refactor(compiler-cli): do not emit signal unwrap calls in versions older than 17.2 (#54423)
In order to allow both signals and non-signals in two-way bindings, we have to pass the expression through `ɵunwrapWritableSignal`. The problem is that the language service uses a bundled compiler that is fairly new, but it may be compiling an older version of Angular that doesn't expose `ɵunwrapWritableSignal` (see https://github.com/angular/vscode-ng-language-service/issues/2001).

These changes add a `_angularCoreVersion` flag to the compiler which the language service can use to pass the parsed Angular version to the compiler which can then decide whether to emit the function.

PR Close #54423
2024-02-13 15:53:42 -08:00
Matthieu Riegler 74b5a51226 fix(http): Use string body to generate transfer cache key. (#54379)
This is particularly usefull for GraphQL queries where the string body might be the only discriminator.

Fixes #54377

PR Close #54379
2024-02-13 11:53:20 -08:00
Joey Perrott a33f09c026 fix(docs-infra): don't include prerender flag based on fast/full build in adev (#54400)
The serve command for architect does not support the `--prerender` flag

PR Close #54400
2024-02-13 11:52:39 -08:00
Lukas Matta 4789685e83 docs: fix typo (#54403)
PR Close #54403
2024-02-13 11:51:54 -08:00
JiaLiPassion 5b767d6e01 release: cut the zone.js-0.14.4 release (#54409)
PR Close #54409
2024-02-13 11:42:07 -08:00
Kristiyan Kostadinov 79001a7e30 build: update node (#54399)
Updates the repo to a newer version of Node to fix errors in the integration tests.

PR Close #54399
2024-02-12 15:36:19 -08:00
Kristiyan Kostadinov 383e093e6a fix(core): show placeholder block on the server with immediate trigger (#54394)
Currently all triggers are set up to show the placeholder block on the server, except for `on immediate` which is basically a noop. These changes update `on immediate` to match the rest of the triggers.

Fixes #54385.

PR Close #54394
2024-02-12 11:02:38 -08:00
Kristiyan Kostadinov 0b955b867c test(language-service): add tests for model inputs (#54387)
Updates the language service tests to cover `model()` inputs.

PR Close #54387
2024-02-12 11:01:53 -08:00
Kristiyan Kostadinov 6897b76399 refactor(compiler-cli): split input and model tests (#54387)
Splits up the tests for `input()` and `model()` into separate files.

PR Close #54387
2024-02-12 11:01:53 -08:00
Kristiyan Kostadinov b9ba136c8e refactor(compiler-cli): add diagnostic tests for models (#54387)
Sets up type checking diagnostic tests for model() inputs.

PR Close #54387
2024-02-12 11:01:52 -08:00
Kristiyan Kostadinov be4620c8d0 test(core): add type tests for ɵunwrapWritableSignal (#54387)
Getting the typing for `ɵunwrapWritableSignal` just right was tricky so these changes add some tests to ensure that we don't regress.

Also reworks the type tester a bit to make it easier to find where to add new test files.

PR Close #54387
2024-02-12 11:01:52 -08:00
Kristiyan Kostadinov 58666e905d refactor(core): reuse input signal node for models (#54387)
Reworks the model so that it reuses `INPUT_SIGNAL_NODE` instead of implementing its own.

PR Close #54387
2024-02-12 11:01:52 -08:00
Kristiyan Kostadinov 4a7ca50328 refactor(core): avoid wrapper around subscribe return value (#54387)
Reworks `ModelSignal.subscribe` so it doesn't have to wrap its value to look like a subscription.

PR Close #54387
2024-02-12 11:01:52 -08:00
arturovt 1c990cdb29 fix(zone.js): patch form-associated custom element callbacks (#50686)
This commit updates the implementation of the `customElements` patch and also
patches FACE callbacks (`formAssociatedCallback`, `formDisabledCallback`, `formResetCallback`
and `formStateRestoreCallback`). This now allows invoking those callbacks in the same zone
where the custom element has been defined.

PR Close #50686
2024-02-12 08:50:55 -08:00
Payam Valadkhan 629a222201 refactor(compiler-cli): expose a helper to check if a diagnostic is related to local compilation (#54366)
Such helper is needed in 1P in order to be able to add extra google3 specific instruction to local compilation errors.

PR Close #54366
2024-02-12 08:49:03 -08:00
Payam Valadkhan 27886cccce refactor(compiler-cli): use a more generic error for unsupported expressions in local compilation mode (#54366)
A new error code `LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION` is added for this purpose, replacing a narrow one.

PR Close #54366
2024-02-12 08:49:03 -08:00
Pawel Kozlowski ff62244c86 fix(core): return the same children query results if there are no changes (#54392)
Assure that the same readonly array corresponding to the children query results
is returned for cases where a query is marked as dirty but there were no actual
changes to the content of the results array (this can happen if a view is added
and removed thus marking queries as dirty but not influencing final results).

Fixes #54376

PR Close #54392
2024-02-12 08:48:29 -08:00
Joey Perrott 9bc386e3f5 refactor(docs-infra): create fast mode (#54364)
Creates a "fast mode" for building the adev site, currently only disabling prerender during fast build.
This is intended to be used for local development.

PR Close #54364
2024-02-09 10:59:06 -08:00
JoostK abf637165b fix(core): do not crash for signal query that does not have any matches (#54353)
The newly introduced signal queries would error if no match exists, due to an
invalid read within the query internals.

This commit addresses the crash by allowing there to be no matches.

PR Close #54353
2024-02-09 14:59:51 +00:00
Hakeem 5890f05faf docs(docs-infra): change deprecated modules' headers' style in the hover state (#54337)
PR Close #54337
2024-02-09 14:58:55 +00:00
Joey Perrott fbaf989aa1 fix(docs-infra): include manually defined api reference docs in adev (#54356)
Include the manual defined api reference docs in adev

PR Close #54356
2024-02-09 14:58:28 +00:00
Angular Robot 6b345133e3 build: update cross-repo angular dependencies (#54186)
See associated pull request for more information.

PR Close #54186
2024-02-09 14:57:46 +00:00
Paul Gschwendtner 6196a36eee docs: release notes for the v17.2.0-rc.1 release 2024-02-09 12:01:19 +01:00
Kristiyan Kostadinov dab5fc30ee fix(core): expose model signal subcribe for type checking purposes (#54357)
The `@internal` in the comment above `ModelSignal.subscribe` ended up marking the method as internal even though it wasn't meant to be.

PR Close #54357
2024-02-09 09:58:55 +00:00
Kristiyan Kostadinov 153fc61d45 build: reuse fake core in type checking tests (#54344)
Currently we have two fake copies of `@angular/core` in the compiler tests which can be out of sync and cause inconsistent tests. These changes reuse a single copy instead.

PR Close #54344
2024-02-08 19:21:47 +00:00
Matthieu Riegler 35c617c2ac refactor(devtools): show tooltip for hydration icon on directive forest (#54326)
The MatTooltip was missing after migrating to standalone

PR Close #54326
2024-02-08 19:18:37 +00:00
Joey Perrott b857aafcb9 refactor: migrate router to prettier formatting (#54318)
Migrate formatting to prettier for router from clang-format

PR Close #54318
2024-02-08 19:17:14 +00:00
Jessica Janiuk d02fcb1ab4 docs: release notes for the v17.2.0-rc.0 release 2024-02-08 10:43:03 -08:00
Jessica Janiuk 00746d800f release: bump the next branch to v17.3.0-next.0 2024-02-08 10:43:03 -08:00
Jessica Janiuk c47bf63ccd docs: release notes for the v17.1.3 release 2024-02-08 10:20:12 -08:00
cexbrayat 8dea3b5888 test: tidy up signal signal input/query/model signature tests (#54334)
This updates some tests to use the public imports from `@angular/core` now that they are available,
and cleans up useless imports and inaccurate names.

PR Close #54334
2024-02-08 16:49:15 +00:00
Andrew Scott 898a532aef fix(core): Fix possible infinite loop with markForCheck by partially reverting #54074 (#54329)
In some situations, calling `markForCheck` can result in an infinite
loop in seemingly valid scenarios. When a transplanted view is inserted
before its declaration, it gets refreshed in the retry loop of
`detectChanges`. At this point, the `Dirty` flag has been cleared from
all parents. Calling `markForCheck` marks the insertion tree up to the
root `Dirty`. If the declaration is checked again as a result (i.e.
because it has default change detection) and is reachable because its
parent was marked `Dirty`, this can cause an infinite loop. The
declaration is refreshed again, so the insertion is marked for refresh
(again). We enter an infinite loop if the insertion tree always calls
`markForCheck` for some reason (i.e. `{{createReplayObservable() | async}}`).

While the case above does fall into an infinite loop, it also truly is a
problem in the application. While it's not an infinite synchronous loop,
the declaration and insertion are infinitely dirty and will be refreshed
on every change detection round.

Usually `markForCheck` does not have this problem because the `Dirty`
flag is not cleared until the very end of change detection. However, if
the view did not already have the `Dirty` flag set, it is never cleared
because we never entered view refresh. One solution to this problem
could be to clear the `Dirty` flag even after skipping view refresh but
traversing to children.

PR Close #54329
2024-02-08 16:45:20 +00:00
Kristiyan Kostadinov adfc3f0f95 refactor(core): temporarily mark subscribe methods as deprecated (#54342)
The `subscribe` methods on `ModelSignal` and `OutputEmitter` were marked as `@internal` which will break when the TCB needs to reference them. These changes make them `@deprecated` temporarily so we can address the properly later.

PR Close #54342
2024-02-08 16:33:41 +00:00
cexbrayat 38b01a3554 fix(compiler-cli): interpolatedSignalNotInvoked diagnostic for model signals (#54338)
The new `model()` signal introduces a `ModelSignal` type that needs to be handled by the interpolatedSignalNotInvoked diagnostic to catch issues like:

```
<div>{{ myModel }}</div>
```

PR Close #54338
2024-02-08 16:28:20 +00:00
ascorbic 03c3b3eb79 feat(common): add Netlify image loader (#54311)
Add an image loader for Netlify Image CDN. It is slightly different in implementation from existing loaders, because it allows absolute URLs

Fixes #54303

PR Close #54311
2024-02-08 16:17:57 +00:00
Kristiyan Kostadinov 9c2bad9e5e refactor(compiler-cli): avoid naming conflict with built-in global variable (#54333)
The import of `module` can conflict with the native global variable called `module` and can break some internal tests. These switch to only importing the function we need.

PR Close #54333
2024-02-08 14:59:54 +00:00
Kristiyan Kostadinov 44f65f2853 refactor(compiler-cli): work around internal test failure (#54327)
Fixes an internal test failure due to `FatalDiagnosticError` extending the native `Error`.

PR Close #54327
2024-02-08 14:59:24 +00:00
Pawel Kozlowski ca239e8b62 refactor(core): share refresh logic for cd and signal queries (#54322)
Introducing a tiny utility method to remove some code duplication
between the change change detection and signal based queries.

PR Close #54322
2024-02-07 22:22:06 +00:00
Ben Hong a3e51d99a8 docs: enable version picker (#54161)
PR Close #54161
2024-02-07 22:21:05 +00:00
Paul Gschwendtner 38c0084ed2 test: verify signal-based queries in CLI integration test (#54314)
Adds usages of signal-based queries into the signal integration test to
verify queries can be used in production, and testing environments as
expected (i.e. the transform works as expected).

PR Close #54314
2024-02-07 18:56:04 +00:00
Paul Gschwendtner a08863e7e0 refactor(compiler-cli): ensure FatalDiagnosticError extends Error (#54309)
This helps with the Angular CLI currently swallowing fatal diagnostic
errors in ways that are extremely difficult to debug due to workers
executing Angular compiler logic.

The worker logic, via piscina, is currently not forwarding such Angular
errors because those don't extend `Error.`

https://github.com/piscinajs/piscina/blob/a7042ea27d129f3cad75c422f5aa92f0663854ee/src/worker.ts#L175

Even with access to these errors by manually forwarding errors, via
patching of the Angular CLI, there is no stack trace due to us not using
`Error` as base class for fatal diagnostic errors. This commit improves
this for future debugging and also better reporting of such errors to
our users- if we would accidentally leak one.

PR Close #54309
2024-02-07 16:39:21 +00:00
Paul Gschwendtner 8e237a0161 fix(compiler-cli): properly catch fatal diagnostics in type checking (#54309)
An identical addition to: 760b1f3d0b.

This commit expands the `try/catch`-es:

- to properly NOT throw and just convert the diagnostic.
- to be in place for all top-level instances. Notably, this logic cannot
  reside in the template type checker directly as otherwise we would
  risk multiple duplicate diagnostics.

PR Close #54309
2024-02-07 16:39:20 +00:00
Kristiyan Kostadinov e921e108e1 refactor(core): correctly distinguish getter functions from writable signals (#54252)
Fixes that `ɵunwrapWritableSignal` inferring getter functions as not matching the interface of `WritableSignal` instead of preserving them.

PR Close #54252
2024-02-07 16:36:15 +00:00
Kristiyan Kostadinov a4a76c3a38 refactor(core): throw if required model is changed via update too early (#54252)
Adds an assertion that will throw if `ModelSignal.update` is accessed before an initial value is set.

PR Close #54252
2024-02-07 16:36:14 +00:00
Kristiyan Kostadinov ac9c54487e refactor(core): assert writable signal in two-way property instruction (#54252)
Asserts that the value is a `WritableSignal`, rather than a `Signal`, in the `twoWayProperty` instruction.

PR Close #54252
2024-02-07 16:36:14 +00:00
Kristiyan Kostadinov 243b94c6e1 refactor(compiler-cli): fix regression in two-way bindings to inputs with different getter/setter types (#54252)
In a previous commit the TCB was changed to cast the assignment to an input in order to widen its type to allow `WritableSignal`. This ended up breaking existing inputs whose setter has a wider type than its getter. These changes switch to unwrapping the value on the binding side.

PR Close #54252
2024-02-07 16:36:13 +00:00
Kristiyan Kostadinov 551c5791f8 refactor(core): address PR feedback (#54252)
Addresses the feedback from #54252.

PR Close #54252
2024-02-07 16:36:12 +00:00
Kristiyan Kostadinov a17f6cb2d0 refactor(compiler-cli): rework TCB for two-way bindings (#54252)
Reworks the TCB for two-way bindings to make them simpler and to avoid regressions for two-way bindings to generic inputs. The new TCB looks as follows:

```
var _t1: Dir;
var _t2 = _t1.input;
(_t1 as typeof _t2 | WritableSignal<typeof _t2>) = expression;
```

PR Close #54252
2024-02-07 16:36:11 +00:00
Kristiyan Kostadinov 372e1ffd25 refactor(compiler-cli): account for model inputs in language service (#54252)
Updates the code that resolves a node from the TCB to an input in order to fix the language service.

PR Close #54252
2024-02-07 16:36:10 +00:00
Kristiyan Kostadinov 702ab28b4c feat(core): add support for model inputs (#54252)
Adds support for model inputs in the framework. `model()` returns a writable signal that implicitly defines a input/output pair that can be used either in two-way bindings to keep two values in sync or by binding individually to the input and output. When the value of the `model` changes, it will emit an event with the current value.

Furthermore, these changes expand two-way bindings to accept `WritableSignal`. This will make it easier to transition existing code to signals in a backwards-compatible way.

Example:

```ts
@Directive({
  selector: 'counter',
  standalone: true,
  host: {
    '(click)': 'increment()',
  }
})
export class Counter {
  value = model(0);

  increment(): void {
    this.value.update(current => current + 1);
  }
}

@Component({
  template: `<counter [(value)]="count"/> The current count is: {{count()}}`,
})
class App {
  count = signal(0);
}
```

PR Close #54252
2024-02-07 16:36:09 +00:00
Kristiyan Kostadinov d006aa33bf refactor(compiler-cli): add tests for model inputs (#54252)
Adds tests in the compiler to verify the compiled output and template type checking behavior of model inputs.

PR Close #54252
2024-02-07 16:36:08 +00:00
Kristiyan Kostadinov 67b977ea97 refactor(compiler-cli): allow writable signals in two-way bindings (#54252)
Updates the TCB generation logic to allow for `WritableSignal` to be assigned in two-way bindings.

PR Close #54252
2024-02-07 16:36:07 +00:00
Kristiyan Kostadinov 8aac3c45b9 test(core): add runtime acceptance tests for model inputs (#54252)
Sets up the runtime tests for model inputs.

PR Close #54252
2024-02-07 16:36:06 +00:00
Kristiyan Kostadinov 0ea4d7086d refactor(compiler-cli): recognize model fields (#54252)
Adds the logic that recognizes fields initialized to model as an input/output pair.

PR Close #54252
2024-02-07 16:36:05 +00:00
Kristiyan Kostadinov 3faf3e23d5 refactor(core): implement two-way instructions (#54252)
Adds the implementations of the `twoWayProperty` and `twoWayListener` instructions.

PR Close #54252
2024-02-07 16:36:04 +00:00
Kristiyan Kostadinov 06fa029132 refactor(compiler-cli): add jit transform for model inputs (#54252)
Adds a JIT transform that marks `model` fields as `@Input` and `@Output`.

PR Close #54252
2024-02-07 16:36:03 +00:00
Kristiyan Kostadinov ab0c0cb832 refactor(compiler-cli): add function to identify model fields (#54252)
Adds a function to the compiler to help us identify fields initialized to a `model`.

PR Close #54252
2024-02-07 16:36:02 +00:00
Kristiyan Kostadinov 3e0a20d8fe refactor(core): add model implementation (#54252)
Adds the implementation of the `model` primitive that represents a two-way binding signal-based binding.

PR Close #54252
2024-02-07 16:36:01 +00:00
Paul Gschwendtner c023e8d58f refactor(core): improve IDE completion of read option for signal queries (#54280)
This commit improves IDE completion of the `read` option for
signal-based queries.

Currently, TS only matches the first overload when starting out with
defining a query. TS doesn't build up the combination of possible
options from the second overload- so in practice users will only see
IDE completions for the `descendants` option.

This is not a problem for view queries as the only option is `read`, so
TS will always match the overload with the `read` option.

```
class X {
  query = contentChild('', {^^ <--
    here we should completion for `read` an `descendants`
}
```

PR Close #54280
2024-02-07 16:35:14 +00:00
cexbrayat 1fb0da2668 build: simplify husky setup (#54315)
husky v9 simplified its setup, see `How to migrate` in https://github.com/typicode/husky/releases/tag/v9.0.1

PR Close #54315
2024-02-07 16:34:13 +00:00
Jessica Janiuk 0dfbde917c Revert "fix(router): Clear internal transition when navigation finalizes (#54261)" (#54317)
This reverts commit 6681292823.

PR Close #54317
2024-02-07 15:46:38 +00:00
Payam Valadkhan f39cb06418 fix(compiler-cli): show specific error for unresolved @Directive.exportAs in local compilation mode (#54230)
Currently the error is a generic error "exportAs must be a string ...". This commit makes the error more specific to local compilation and adds some action items.

PR Close #54230
2024-02-06 21:33:29 +00:00
Payam Valadkhan f3851b5945 fix(compiler-cli): show specific error for unresolved @HostBinding's argument in local compilation mode (#54230)
Currently the error is a generic error "selector must be a string ...". This commit makes the error more specific to local compilation and adds some action items.

PR Close #54230
2024-02-06 21:33:29 +00:00
Payam Valadkhan 39ddd884e8 fix(compiler-cli): show specific error for unresolved @HostListener's event name in local compilation mode (#54230)
Currently the error is a generic error "selector must be a string ...". This commit makes the error more specific to local compilation and adds some action items.

PR Close #54230
2024-02-06 21:33:29 +00:00
Payam Valadkhan 5d633240fd fix(compiler-cli): show the correct message for the error LOCAL_COMPILATION_UNRESOLVED_CONST when an unresolved symbol used for @Component.styles (#54230)
Currently the correct error message is shown only if @Component.styles is an array with some unresolved element. This change supports the new case of string type for the @Component.styles field.

PR Close #54230
2024-02-06 21:33:29 +00:00
Payam Valadkhan 6c8b09468a fix(compiler-cli): highlight the unresolved element in the @Component.styles array for the error LOCAL_COMPILATION_UNRESOLVED_CONST (#54230)
Currently the whole array is highlighted.

PR Close #54230
2024-02-06 21:33:29 +00:00
Payam Valadkhan acc98a17d9 refactor(compiler-cli): add a helper to generate error LOCAL_COMPILATION_UNRESOLVED_CONST in common scenarios (#54230)
A helper `validateLocalCompilationUnresolvedConst` is added to encapsulate a common pattern which leads to the error `LOCAL_COMPILATION_UNRESOLVED_CONST`.

PR Close #54230
2024-02-06 21:33:29 +00:00
Payam Valadkhan a3de5ba865 refactor(compiler-cli): remove the trailing error message for LOCAL_COMPILATION_UNRESOLVED_CONST (#54230)
The trailing error message comes from tracing the chain of DymaicValue which leads to a mostly useless error that highlights the same symbol as the original message and emits the error message "Unknown reference". This error message is removed in the favour of the original message which suffices.

PR Close #54230
2024-02-06 21:33:29 +00:00
Payam Valadkhan df74ed94e2 refactor(compiler-cli): upgrade error codes and messages for unresolved symbol errors in local compilation mode (#54230)
A single error code is created to unify the common error pattern in local compilation mode where an imported const cannot be resolved, but needs to be resolved. This mainly happens for Angular decorator fields such as @Component.template.

The error messages are also upgraded to be more centered around this unifying theme.

PR Close #54230
2024-02-06 21:33:29 +00:00
Angular Robot b5368eb9a6 build: update dependency marked to v12 (#54296)
See associated pull request for more information.

PR Close #54296
2024-02-06 21:13:49 +00:00
Angular Robot b96c2fec68 build: update dependency jsdom to v24 (#54291)
See associated pull request for more information.

PR Close #54291
2024-02-06 21:10:29 +00:00
Joey Perrott 8efa7cddf7 docs: remove v17 banner from adev (#54287)
PR Close #54287
2024-02-06 21:06:24 +00:00
Alejandro Cuba Ruiz faf3b45d48 docs: add alejandrocuba.jpg file to images/bios/ (#53842)
PR Close #53842
2024-02-06 20:34:01 +00:00
Alejandro Cuba Ruiz f189dbe47a docs: add alejandrocuba to GDE resources (#53842)
PR Close #53842
2024-02-06 20:34:01 +00:00
Andrew Scott 6681292823 fix(router): Clear internal transition when navigation finalizes (#54261)
This commit fixes a small memory issue in the router where a destroyed
component instance would be retained.

fixes #54241

PR Close #54261
2024-02-06 20:32:34 +00:00
Angular Robot c8a973e3b7 build: update dependency husky to v9 (#54289)
See associated pull request for more information.

PR Close #54289
2024-02-06 19:34:46 +00:00
Pawel Kozlowski 43de097704 test(core): enable signal queries tests with authoring (#54283)
Use signal queries tests with the authoring functions and without
decorators.

PR Close #54283
2024-02-06 19:31:58 +00:00
Pawel Kozlowski e95ef2cbc6 feat(core): expose queries as signals (#54283)
This commit exposes authoring functions for queries as signals
thus making those generally available.

PR Close #54283
2024-02-06 19:31:58 +00:00
Angular Robot 0d4e983c24 build: update dependency @types/jasmine to v5 (#54288)
See associated pull request for more information.

PR Close #54288
2024-02-06 19:30:33 +00:00
Angular Robot 297e73c83b build: update dependency jasmine-core to v5 (#54290)
See associated pull request for more information.

PR Close #54290
2024-02-06 19:30:07 +00:00
Joey Perrott 4d29174585 refactor: address prototype polution concern with better typing (#54286)
Update typing to show that a number is being used as index rather than any random string

PR Close #54286
2024-02-06 18:38:47 +00:00
Angular Robot 4287ca8b50 build: update dependency @octokit/graphql to v7 (#53554)
See associated pull request for more information.

PR Close #53554
2024-02-06 18:24:04 +00:00
Angular Robot eeafdb6cf3 build: update dependency firebase-tools to v13 (#54234)
See associated pull request for more information.

PR Close #54234
2024-02-06 18:11:41 +00:00
Angular Robot e9eba6b257 build: update dependency eslint-plugin-jsdoc to v48 (#54202)
See associated pull request for more information.

PR Close #54202
2024-02-06 18:11:12 +00:00
Angular Robot c512987774 build: update babel dependencies (#53222)
See associated pull request for more information.

PR Close #53222
2024-02-06 18:10:40 +00:00
Angular Robot e94942255a build: update all non-major dependencies (#53220)
See associated pull request for more information.

PR Close #53220
2024-02-06 18:10:11 +00:00
Angular Robot 2d3fc31c83 docs: update Angular CLI help [main] (#54276)
Updated Angular CLI help contents.

PR Close #54276
2024-02-06 18:09:46 +00:00
Joey Perrott 0763fba97f build: update to latest @angular/docs (#54282)
Update to the latest version of angular docs from dev-infra

PR Close #54282
2024-02-06 17:54:43 +00:00
ilir.beqiri 6ef60c0a1a docs: replace event word with property for binding properties link (#54281)
Replace the "event" word with the correct one "property" at the helpful text on event binding section

PR Close #54281
2024-02-06 17:45:11 +00:00
Paul Gschwendtner bfbb30618b fix(compiler-cli): do not error due to multiple components named equally (#54273)
Currently, when two components are named `TestComponent`, and both would
use e.g. control flow. Templates would be generated by the compiler and
those would conflict at runtime because the names for the template
functions are not ensured to be unique.

This seems like a more general problem that could be tackled in the
future in the template pipeline by always using the `ConstantPool`, but
for now, we should be good already, given us ensuring the `baseName`'s are
always unique.

PR Close #54273
2024-02-06 17:33:23 +00:00
arturovt 19fae76bad fix(zone.js): patch fs.realpath.native as macrotask (#54208)
This commit updates the implementation of the zone.js `fs` patch to
restore the implementation of `realpath.native` and patches it as a macrotask,
along with other functions of the `fs` package. This is the only nested function
that must be patched.

Closes: #45546

PR Close #54208
2024-02-06 16:04:40 +00:00
Paul Gschwendtner f8c02b69b9 refactor(compiler-cli): restrict read option values for signal-based queries (#54257)
The `read` option for queries can rely on lexical variables inside the
class. These constructs are fine from a technical perspective in
TypeScript, but in practice, when the component/directive definition is
being created, the read value is extracted into the definition,
**outside** of the class. This breaks `this` references.

To fix this, we are restricting the `read` option to literal values.
Similar to `descendants`. Literal references are in practice constructs
like:

 - `read: bla.X`
 - `read: X`

 where `bla` or `X` is never a `ThisKeywoord`- hence fixing the issue
 and also simplifying the patterns for easier single file compilation.

PR Close #54257
2024-02-06 16:04:10 +00:00
Paul Gschwendtner 902481b6ec refactor(compiler-cli): add JIT transform for signal-based queries (#54257)
This commit adds a JIT transform for signal-based queries, so that
queries are working as expected in JIT environments like `ng test` where
decorator metadata is needed as a prerequisite for the component
definition creation.

This is similar to the JIT transforms for signal inputs etc.

PR Close #54257
2024-02-06 16:04:10 +00:00
Paul Gschwendtner 351426853d refactor(compiler-cli): extract common JIT transform helper into transform API (#54257)
Extracts common JIT transform helper into the transform API, so that
those helpers can be re-used for output, model, queries and inputs.

PR Close #54257
2024-02-06 16:04:10 +00:00
Paul Gschwendtner 1d077fca10 refactor(compiler-cli): expose query function detection logic for JIT transform (#54257)
This commit exposes the query function detection logic so that it can
be used in the JIT transform later on.

PR Close #54257
2024-02-06 16:04:10 +00:00
Paul Gschwendtner 4851453735 ci: add debug information for failing firebase deploy (#54275)
Adding debug information for failing firebase deploy, hoping
to yield information about the missing resource. The next
multi-site seems to be failing, but is available.

PR Close #54275
2024-02-06 15:23:13 +00:00
Pawel Kozlowski 99bfbabe50 refactor(core): break circular dependencies in preparation for queries as signals (#54103)
Break circular dependencies by using type imports and code moves.

PR Close #54103
2024-02-06 15:04:36 +00:00
Pawel Kozlowski 84d1fa7c56 refactor(core): pull compileNgModuleFactory out of application_ref (#54103)
The compileNgModuleFactory dont need to be in the application_ref file (in fact
the whole logic has little to do with ApplicationRef and it is not even called
from the application_ref). Performing this move to avoid circular dependencies
when the new query as signals authoring functions are exported.

PR Close #54103
2024-02-06 15:04:36 +00:00
Pawel Kozlowski 3a2ce9e0a2 refactor(core): add error code for required query results (#54103)
This commit introduces a dedicated error code for queries that require
results but none are available.

PR Close #54103
2024-02-06 15:04:36 +00:00
Pawel Kozlowski 20008a6b56 refactor(core): rework runtime implementation to simplify and fix issues (#54103)
This commit changes the approach to the reactive node representing query
results: instead of creating a custom node type we can use a computed -
the main change to get there is representing dirty change notification as
a signal (a counter updated every time a query changes its dirty status).

This change is dictated by simplification (we can avoid creation of a custom
signal type) as well as fixes to the multiple issues not covered by the
initial implementation:
- assuring referential stability of results (ex.: the same array instance
  returned from child queries until results change);
- per-view results collection to avoid a situation where accessing query
  results during view creation would return partial / inconsistent results;
- proper refresh of query results for both live and non-connected consumers.

All the above cases are covered by the additional tests in this commit.

PR Close #54103
2024-02-06 15:04:36 +00:00
Pawel Kozlowski 1aa63c158b refactor(core): enable content query as signal tests (#54103)
This commit adds tests for content queries and fixes the arguments
order in the contentQuerySignal instruction, thus fixing a bug
discovered while adding tests.

PR Close #54103
2024-02-06 15:04:36 +00:00
Pawel Kozlowski 26b11b5b0e test(core): convert query-as-signals test to the compiled ones (#54103)
This commits converts the hand-written tests into their usual,
compiled form. We can perform this change now since the compiler
bits of the queries-as-signal story landed.

PR Close #54103
2024-02-06 15:04:36 +00:00
Jessica Janiuk e46c08170f Revert "fix(compiler-cli): consider the case of duplicate Angular decorators in local compilation diagnostics (#54139)" (#54264)
This reverts commit 4b1d948b36.

PR Close #54264
2024-02-05 18:18:47 +00:00
Jessica Janiuk bd43aa39a8 Revert "fix(compiler-cli): allow custom/duplicate decorators for @Injectable classes in local compilation mode (#54139)" (#54264)
This reverts commit a592904c69.

PR Close #54264
2024-02-05 18:18:47 +00:00
Jessica Janiuk a2af706855 Revert "fix(compiler-cli): forbid custom/duplicate decorator when option forbidOrphanComponents is set (#54139)" (#54264)
This reverts commit 96bcf4fb12.

PR Close #54264
2024-02-05 18:18:47 +00:00
Jason Warner d339941a0d docs: add Jason Warner to GDE resources (#54237)
PR Close #54237
2024-02-05 16:40:57 +00:00
Andrew Kushnir 1090570781 refactor(core): avoid reusing argument name as a local const (#54239)
This refactoring renames a local variable to make sure we do not reuse an argument name, which can lead to confusion and bugs.

PR Close #54239
2024-02-05 15:15:17 +00:00
Andrew Kushnir 90fb623614 refactor(core): create pending task while defer block loading is in progress (#54239)
This commit updates the logic of defer blocks to create an internal pending task to indicate that an application is not yet stable. This change would be helpful for zoneless applications.

PR Close #54239
2024-02-05 15:15:17 +00:00
Matthieu Riegler f5e5543732 docs: remove an outdated comment. (#54243)
Note: We still expect `ngOnChanges` to not be supported in future signal components.

PR Close #54243
2024-02-05 15:09:40 +00:00
Paul Gschwendtner 8ac4f7d4ef refactor: support multiple acceptance spec files with JIT transforms (#54253)
Updates the acceptance authoring test compiler targets to support
multiple spec files. This will be useful for output, model, inputs
and queries.

PR Close #54253
2024-02-05 15:09:00 +00:00
Paul Gschwendtner 6cb47a7c9d test: verify output() in signals integration test (#54217)
Adds `output()` to the signal inputs integration test to verify
full integration with the Angular CLI. In the future we may
consider renaming the test to something less specific to signal inputs,
but for now this serves the purpose and `output()` is a closely related
part to signal-based inputs.

it doesn't warrant creating another new integration test, as those are
quite expensive to maintain and run.

PR Close #54217
2024-02-05 15:08:35 +00:00
Paul Gschwendtner efcec0a290 refactor(core): improve type safety for listener instruction (#54217)
The `listener` instruction currently always assumes RxJS subscribables,
and verifies this via `isSubscribable`. The type narrowing is not
ignored and the type remains `any` given the `ngDevMode` check.

This commit improves type safety, and actually switches to a dedicated
interface for "output subscribable" values. This is needed because
`Subscribable` from `RxJS` is typed to expect an observer in object
literal form- which is not correct and doesn't apply to `EventEmitter`
and matches the form of `.subscribe` we are using in the `listener`
instruction.

PR Close #54217
2024-02-05 15:08:35 +00:00
Paul Gschwendtner 02fdd8d6ee test: add tests to verify language-service supports output() function (#54217)
Adds unit tests to verify that the language service supports
the `output()` function with completions, and definition jumping.

PR Close #54217
2024-02-05 15:08:35 +00:00
Paul Gschwendtner ee635f9aa6 test: add language-service test for type definition of signal inputs (#54217)
Adds an extra unit test for the language-service to verify that type
definitions for signal-based inputs can be resolved.

PR Close #54217
2024-02-05 15:08:35 +00:00
Paul Gschwendtner b285b1402c refactor(compiler-cli): introduce JIT transform for new output() initializer API (#54217)
Similar to `input()`, initializer-based `output()`'s need to be
transformed in JIT to be annotated with an `@Output()` decorator.

This is necessary so that Angular can statically collect all defined
outputs without instantiating the class (which would not be possible
upon directive definition computation).

This commit introduces a transform next to the input transform that
automatically runs with the Angular CLI and `ng test`.

PR Close #54217
2024-02-05 15:08:35 +00:00
Paul Gschwendtner 55040fb80b test: add type check diagnostic tests for output() API (#54217)
Adds type check diagnostic tests for the `output()` API. This
is necessary because we are maintaining a separate emitter
for `output()` as with the current design (still discussed - but this is
a starting foundation).

Note: `OutputEmitter` currently does not publicly expose `.subscribe`,
while the testing infrastructure exposes it for now. That is because we
are still discussing this before making changes in the TCB to account
for the case where `.subscribe` might be `@internal` ultimately.

PR Close #54217
2024-02-05 15:08:35 +00:00
Paul Gschwendtner 0e9e401ca1 test: generalize type check scenario testing helpers (#54217)
Generalizes the type check table scenario testing infrastructure
so that it can also be used for testing outputs in a table-scheme
without a lot of TS code repetition.

PR Close #54217
2024-02-05 15:08:34 +00:00
Paul Gschwendtner aa4157cc54 test: add ngtsc compiler test for output() (#54217)
Adds an ngtsc diagnostic and compilation output test for `output()`. The
test will verify certain recognition restrictions and ensures that
diagnostics are raised, in addition to proper full compilation output
being generated (aside from the compliance tests verifying output more
closely).

PR Close #54217
2024-02-05 15:08:34 +00:00
Paul Gschwendtner 65de61ba0d test: add compliance output tests for output() (#54217)
Adds compliance output tests for `output()` to verify that
we are emitting proper full compilation output, as well as proper
partial compilation output that can be linked to match the full output.

PR Close #54217
2024-02-05 15:08:34 +00:00
Paul Gschwendtner c05e1042b4 refactor(core): introduce output() signature and runtime code (#54217)
This commit introduces the `output()` function and corresponding
runtime code.

In practice, `output()` will defer to `EventEmitter` as outlined in the
RFC, but we are considering limiting the type to a minimal version that
is not coupled with RxJS, less complex, and also has better type safety
around emitting of values.

E.g. currently `EventEmitter.emit` can always be called without
any value, even though the output may be typed to always pass around
values of type `T`. This could cause subtle and confusing bugs.

PR Close #54217
2024-02-05 15:08:34 +00:00
Paul Gschwendtner f7da77b90d refactor(compiler-cli): detect output() function (#54217)
As we are introducing the new `output()` function as an inituive
alternative to `@Output()` that matches with signal-based inputs,
this commit prepares the compiler to detect such initializer-based
outputs.

PR Close #54217
2024-02-05 15:08:34 +00:00
Payam Valadkhan 96bcf4fb12 fix(compiler-cli): forbid custom/duplicate decorator when option forbidOrphanComponents is set (#54139)
The deps tracker which is responsible to track orphan components does not work for classes mutated by custom decorator. Some work needed to make this happen (tracked in b/320536434). As a result, with option `forbidOrphanComponents` being true the deps tracker will falsely report any component as orphan if it or its NgModule have custom/duplicate decorators. So it is unsafe to use this option in the presence of custom/duplicate decorator and we disable it until it is made compatible. Note that applying custom/duplicate decorators to `@Injectable` classes is ok since these classes never make it into the deps tracker. So we excempt them.

PR Close #54139
2024-02-05 15:07:40 +00:00
Payam Valadkhan a592904c69 fix(compiler-cli): allow custom/duplicate decorators for @Injectable classes in local compilation mode (#54139)
Custom/duplicate decorators break the deps tracker in local mode. But deps tracker only deals with non-injectable classes. So applying custom/duplicate decorators to `@Injectable` only classes does not disturb deps tracker and local compilation in general. There are also ~ 100 such cases in g3 which cannot be cleaned up.

PR Close #54139
2024-02-05 15:07:40 +00:00
Payam Valadkhan 4b1d948b36 fix(compiler-cli): consider the case of duplicate Angular decorators in local compilation diagnostics (#54139)
For cases like this:

```
@Component({...})
@Component({...})
export class SomeComp {
}
```

The `DecoratorHandler.detect` apparantly matches only one of the `@Component` decorator, leaving the other undetected which will be transformed by TS decorator helper and that breaks local compilation runtimes. But the error message only mentioned "custom" decorator, while in this case it is a "duplicate Angular" decorator. The respective error message is updated thus.

PR Close #54139
2024-02-05 15:07:40 +00:00
László Czöndör 3b1926acdb docs: fix typo in inject-based DI tutorial (#54245)
PR Close #54245
2024-02-05 15:06:11 +00:00
Nigro Simone 350081d445 refactor(docs): fix typo (#54247)
PR Close #54247
2024-02-05 15:05:36 +00:00
Angular Robot 2ab536ee3e docs: update Angular CLI help [main] (#54223)
Updated Angular CLI help contents.

PR Close #54223
2024-02-02 22:01:16 +00:00
Dylan Hunn f600f0fb27 refactor(compiler): Show an error when a property binding duplicates an i18n attribute (#54063)
Consider the following very quirky Angular template, which has both an i18n attribute binding and a property binding to `in`:
```
<cmp [in]="foo" in="bar" i18n-in />
```

What would you expect the above template to do? `TemplateDefinitionBuilder` will emit the following Ivy instructions:
```
// Element constant attributes
consts: () => {
    __i18nMsg__('bar', [], {}, {})
    return [["in", i18n_0, __AttributeMarker.I18n__, "in"]];
}
// ...
function MyComponent_Template(rf, ctx) {
    if (rf & 1) {
        // Create mode
        i0.ɵɵelement(0, "cmp", 0);
    }
}
```

This makes some sense -- we create a single element, and attach an i18n message to the `in` attribute. But is this actually correct? Notice that the property binding is completely missing!

Indeed, Template Pipeline actually produces this code:
```
// Element constant attributes
consts: () => {
    __i18nMsg__('bar', [], {}, {})
    return [["in", i18n_0, __AttributeMarker.I18n__, "in"]];
}
// ...
function MyComponent_Template(rf, ctx) {
    if (rf & 1) {
        // Create mode
        i0.ɵɵelement(0, "cmp", 0);
    } else if (rf & 2) {
        // Update mode
        i0.ɵɵproperty("in", ctx.foo);
    }
}
```

Aha! There's the property binding! Arguably, this is a bug in `TemplateDefinitionBuilder`, but after some discussion on Slack, we have decided to ban this practice in a future Angular version.

For now, we allow Template Pipeline to have slightly different output, but print an error to warn the user of the issue.

PR Close #54063
2024-02-02 20:52:39 +00:00
Dylan Hunn 8d230e1259 refactor(compiler): Fix a source maps i18n test for Template Pipeline (#54063)
TemplateDefinitionBuilder and Template Pipeline choose different const array orders, which is fine. Update the tests to reflect that.

PR Close #54063
2024-02-02 20:52:39 +00:00
Andrew Scott 74aa8a3888 test(core): ExpressionChanged... error does not happen with signals (#54206)
This test ensures that the `ExpressionChanged...` error does not happen
when signals are updated in a view that is attached to `ApplicationRef`
but was already checked. This was fixed in 432afd1ef4
which actually consequently fixes it for regular `markForCheck` as well.

PR Close #54206
2024-02-02 14:51:46 +00:00
Kristiyan Kostadinov fc5fe3e8e9 build: rework signals acceptance tests build setup (#54213)
* Renames the `input_signals` directory to `signals` so it can be reused for other tests.
* Reworks the build file to allow multiple test files.

PR Close #54213
2024-02-02 14:51:18 +00:00
mooyil bdf6927125 docs: remove outdated info about ng serve (#53890)
PR Close #53890
2024-02-01 23:00:18 +00:00
Thabo 32d0742348 docs: fix typo in router.md (#54194)
Correct spelling mistake

PR Close #54194
2024-02-01 22:31:48 +00:00
Andrew Scott 3cf612c857 fix(core): update imports to be compatible with rxjs 6 (#54193)
Peer dependency range allows for rxjs 6. We cannot use features only
available in rxjs 7 unless that changes.

fixes #54192

PR Close #54193
2024-02-01 20:48:19 +00:00
Samuel Marks 908baecf1e [aio/src/styles/custom-themes/{dark,light}-theme.scss] Change theme definitions to resolve warning "Angular Material themes should be created from a map" (#53717)
PR Close #53717
2024-02-01 20:18:42 +00:00
Lars Gyrup Brink Nielsen 0e150c4ae9 docs: correct TypeScript version range for 17.0.x (#53213)
PR Close #53213
2024-02-01 20:07:32 +00:00
Mateusz Daniluk de777afbc5 refactor: standardize doctype declaration to <!DOCTYPE html> (#51052)
This commit standardizes the doctype declaration across all HTML files in the project to use `<!DOCTYPE html>`

PR Close #51052
2024-02-01 19:29:46 +00:00
Matthieu Riegler 7b2b0f40e2 refactor(core): Guard assertion with ngDevMode (#53764)
`assertDefined` is always guarded elsewhere

PR Close #53764
2024-02-01 19:28:08 +00:00
Matthieu Riegler bc81440b25 docs(docs-infra): Remove the edit button from AIO (#54204)
As a move to reduce PRs toward AIO we drop the edit button and recommend users to use ADEV instead and make suggestions there.

PR Close #54204
2024-02-01 18:54:55 +00:00
Jessica Janiuk 5d98a023bc ci: Add framework team to adev approvers (#54082)
This adds the entire framework team to the adev approvers list.

PR Close #54082
2024-02-01 17:44:59 +00:00
Angular Robot 36a9bf3d6a build: update actions/checkout action to v4 (#54183)
See associated pull request for more information.

PR Close #54183
2024-02-01 16:02:47 +00:00
Paul Gschwendtner d74ee6e343 refactor(compiler-cli): group initializer-API based transforms into single transform (#54200)
Instead of maintaining individual transforms for `input`, `output`,
`model` etc. we are grouping them directly and the first one matching,
will execute.

This reduces needed traversal through AST and also makes it a little
more clean to write new initializer API metadata transforms.

Note: The Angular JIT transform is now also moving from `tooling.ts`
directly into `/transformers` for more local placement of transformer
logic.

PR Close #54200
2024-02-01 15:58:50 +00:00
Kristiyan Kostadinov d89d5230a7 refactor(compiler-cli): allow signal input transform to be reused (#54200)
Splits up the signal input transform so that it can be reused for other signal-based properties.

PR Close #54200
2024-02-01 15:58:50 +00:00
Kristiyan Kostadinov 50b22a4260 refactor(core): move input signals into own directory (#54200)
Moves the signal input code into its own directory to avoid too many files in the `authoring` root once model inputs are introduced.

PR Close #54200
2024-02-01 15:58:50 +00:00
Kristiyan Kostadinov 95dcf5fafa fix(compiler-cli): handle default imports in defer blocks (#53695)
Fixes that `@defer` blocks weren't recognizing default imports and generating the proper code for them. Default symbols need to be accessed through the `default` property in the `import` statement, rather than by their name.

PR Close #53695
2024-02-01 15:58:21 +00:00
Ezéchiel Amen AGBLA ebbacb9d45 docs: more readable standalone importing component example (#54196)
PR Close #54196
2024-02-01 15:57:51 +00:00
Kristiyan Kostadinov 3b892e98b0 refactor(compiler): update ordering in template pipeline (#54154)
Updates the instruction ordering logic in the template pipeline.

PR Close #54154
2024-02-01 14:39:32 +00:00
Kristiyan Kostadinov ec8e8ab5d5 refactor(compiler): maintain order between two-way and one-way properties (#54154)
One of the earlier commits separated one-way and two-way bindings which ended up breaking some internal targets, because it changed the assignment order. These changes bring back the old order.

PR Close #54154
2024-02-01 14:39:32 +00:00
Kristiyan Kostadinov cbe6e1ffcf refactor(compiler): allow some invalid expressions in two-way bindings that previously worked by accident (#54154)
In one of the earlier commits, the logic that appends `=$event` before parsing two-way bindings was removed and some validation was added to prevent unassignable expressions from being used. This ended up being problematic, because previously the parser was incorrectly allowing some invalid expressions which users came to depend on. For example, it transformed `[(value)]="a && a.b"` to `a && (a.b = $event)`.

These changes add some special cases for the common breakages that came up during the TGP.

PR Close #54154
2024-02-01 14:39:32 +00:00
Kristiyan Kostadinov cbdfc88b24 refactor(compiler): implement new two-way listener shape in pipeline (#54154)
Implements the new shape of two-way listener instructions in the template pipeline.

PR Close #54154
2024-02-01 14:39:32 +00:00
Kristiyan Kostadinov 4babc47b31 refactor(compiler): update two-way listener emit in definition builder (#54154)
Updates the template definition builder to emit the new format for the listener side of two-way bindings.

```js
// Before
listener("ngModelChange", function($event) {
  return ctx.name = $event;
});

// After
ɵɵtwoWayListener("ngModelChange", function($event) {
  ɵɵtwoWayBindingSet(ctx.name, $event) || (ctx.name = $event);
  return $event;
});
```

PR Close #54154
2024-02-01 14:39:32 +00:00
Kristiyan Kostadinov a436e2d5ea refactor(compiler): preserve expression in two-way listeners (#54154)
Currently the listener side two-way listeners are parsed by appending `=$event` to the raw expression. This is problematic, because:
1. It can interfere with other expressions (see #37809).
2. It can lead to confusing error messages because users will see code that they didn't write.
3. It doesn't allow us to further manipulate the expression.

These changes remove the logic that appends `=$event` to resolve the issue. There's also some new logic that checks the expression after it has been parsed to ensure that the result is an assignable expression.

Subsequent commits will update the code that emits the expression to add back the `$event` assignment where it's needed.

PR Close #54154
2024-02-01 14:39:32 +00:00
Kristiyan Kostadinov e7a75d3ec2 refactor(core): introduce two-way listener instructions (#54154)
Adds the following new instructions:
* `twoWayBindingSet` - used to assign values inside of the listener side of a two-way binding. Currently a noop, but will come into play later.
* `twoWayListener` - used to bind a two-way listener. Currently calls directly into `listener`, but it may be useful in the future.

PR Close #54154
2024-02-01 14:39:32 +00:00
Kristiyan Kostadinov a22d765cca refactor(compiler): update access of members in expression parser (#54154)
Currently all the members of `_ParseAST` are public, even though they're all used only within the class. This change marks them as private so that it's explicit which ones are intended to be used outside the class.

PR Close #54154
2024-02-01 14:39:32 +00:00
Kristiyan Kostadinov ea7d1b363f refactor(compiler): implement two-way property instruction (#54154)
Reworks the compiler so that it generates a `twoWayProperty` instruction, instead of `property`, for the property side of a two-way binding. Currently the new instruction passes through to `property`, but it'll have some two-way-binding-specific logic in subsequent PRs.

PR Close #54154
2024-02-01 14:39:32 +00:00
Joey Perrott 70d0fb088e refactor(docs-infra): migrate to using docs- prefix for class names rather than adev- for shared pieces (#54188)
Updates to later version of shared docs with prefix renamed.

PR Close #54188
2024-01-31 21:49:23 +00:00
Andrew Scott 432afd1ef4 fix(core): afterRender hooks should allow updating state (#54074)
It was always the intent to have `afterRender` hooks allow updating
state, as long as those state updates specifically mark views for
(re)check. This commit delivers that behavior. Developers can now use
`afterRender` hooks to perform further updates within the same change
detection cycle rather than needing to defer this work to another round
(i.e. `queueMicrotask(() => <<updateState>>)`). This is an important
change to support migrating from the `queueMicrotask`-style deferred
updates, which are not entirely compatible with zoneless or event `NgZone` run
coalescing.

When using a microtask to update state after a render, it
doesn't work with coalescing because the render may not have happened
yet (coalescing and zoneless use `requestAnimationFrame` while the
default for `NgZone` is effectively a microtask-based change detection
scheduler). Second, when using a `microtask` _during_ change detection to defer
updates to the next cycle, this can cause updates to be split across
multiple frames with run coalescing and with zoneless (again, because of
`requestAnimationFrame`/`macrotask` change detection scheduling).

PR Close #54074
2024-01-31 20:19:06 +00:00
Andrew Scott 33e5abd4f9 refactor(core): only run checkNoChanges once per tick (#54074)
This change updates the `checkNoChanges` pass to only run once after
both view refresh and `afterRender` hooks execute rather than both
before and after the hooks. The original motivation was to specifically
ensure that the application was in a "clean state" before running the
`afterRender` hooks and ensure that `afterRender` hooks don't "fix"
`ExpressionChanged...` errors. This, however, adds to the complexity and
cost of running change detection in dev mode. Instead, the
`checkNoChanges` pass runs once we have done all render-related work and
want to ensure that the application state has been synced to the DOM
(without additional changes).

PR Close #54074
2024-01-31 20:19:06 +00:00
Andrew Scott ecaf7ceae0 refactor(core): Do not run afterRender hooks if there is an error (#54074)
Errors during change detection are terminal and we do not generally
attempt to continue processing or recover after one occurs. This helps clean
up the `tick` implementation with respect to running `afterRender` hooks.

PR Close #54074
2024-01-31 20:19:06 +00:00
Angular Robot 989d496708 build: update cross-repo angular dependencies (#54178)
See associated pull request for more information.

PR Close #54178
2024-01-31 20:13:06 +00:00
Angular Robot 0a67085289 build: update actions/cache action to v4 (#54179)
See associated pull request for more information.

PR Close #54179
2024-01-31 19:45:54 +00:00
Jessica Janiuk 2d20c4a25b release: cut the v17.2.0-next.1 release 2024-01-31 11:29:36 -08:00
Jessica Janiuk 0465a4c5d0 docs: release notes for the v17.1.2 release 2024-01-31 11:07:39 -08:00
Ivan Zlatanov 4f7edaa478 refactor(router): RouterLink read urlTree only once (#53817)
In RouterLink, urlTree is created every time we access it, so when used we should read it only once.

PR Close #53817
2024-01-31 17:37:12 +00:00
Angular Robot 441a23cb8b build: update actions/cache digest to e12d46a (#54176)
See associated pull request for more information.

PR Close #54176
2024-01-31 17:36:28 +00:00
Angular Robot 4b11e0c15d build: update actions/checkout digest to f43a0e5 (#54177)
See associated pull request for more information.

PR Close #54177
2024-01-31 17:35:59 +00:00
Angular Robot f5ede2ab63 build: update slackapi/slack-github-action digest to 2a8087d (#52000)
See associated pull request for more information.

PR Close #52000
2024-01-31 16:47:31 +00:00
narendherraj 318a181d8e docs: fix link missing to lazy loading module (#54113)
author narendherraj <narendherraj@gmail.com> 1706354106 +0530
committer narendherraj <narendherraj@gmail.com> 1706718969 +0530

docs: fix link missing to lazy loading module

docs: fix link missing to lazy loading module

docs: fix link missing lazy loading module updated

PR Close #54113
2024-01-31 16:45:51 +00:00
Angular Robot 1a918b397e build: update io_bazel_rules_sass digest to d970cb5 (#52388)
See associated pull request for more information.

PR Close #52388
2024-01-31 16:45:07 +00:00
Matthieu Riegler 122213d37d fix(common): The date pipe should return ISO format for week and week-year as intended in the unit test. (#53879)
ISO 8601 defines
* Monday as the first day of the week.
* week 01 is the week with the first Thursday

Therefore:
Sunday Dec 31st 2023 is the last day of the last week of the year : W52 2023.

PR Close #53879
2024-01-31 16:41:10 +00:00
Alejandro a297012839 docs(docs-infra): add tab titles to home, playground and tutorial (#53026)
PR Close #53026
2024-01-31 16:30:49 +00:00
Paweł Kubiak 2e2e8aad9b test(docs-infra): unit tests in the reference pages (#53529)
Implementation of additional unit tests for `Reference` pages in `adev`.

PR Close #53529
2024-01-31 16:13:31 +00:00
Jared Bada 34feb4f32d docs(docs-infra): @input getter setter syntax change (#51023)
PR Close #51023
2024-01-31 16:04:04 +00:00
kabrunko-dev b02cf14525 fix(docs-infra): sort api reference items (#54116)
Sort correctly items from angular.dev api reference secondary navigation menu

PR Close #54116
2024-01-31 15:44:23 +00:00
Elias b9aa25ed23 docs: Fix minor grammar mistake (#54094)
PR Close #54094
2024-01-31 15:34:26 +00:00
vatsa03 d8f417bf10 docs(core): fix example sections (#54121)
PR Close #54121
2024-01-31 15:22:30 +00:00
Matthieu Riegler 4a44f73288 docs: Update docs about equality. (#54158)
Since v17, `ngSwitch` uses a strict equality.

Fixes #54156

PR Close #54158
2024-01-31 15:07:52 +00:00
arturovt 260d3ed0d9 fix(zone.js): patch Response methods returned by fetch (#50653)
This commit updates the implementation of the `fetch` patch and additionally
patches `Response` methods which return promises. These are `arrayBuffer`, `blob`,
`formData`, `json` and `text`. This fixes the issue when zone becomes stable too early
before all of the `fetch` tasks complete. Given the following code:
```ts
appRef.isStable.subscribe(console.log);
fetch(...).then(response => response.json()).then(console.log);
```
The `isStable` observer would log `false, true, false, true`. This was happening because
`json()` was returning a native promise (and not a `ZoneAwarePromise`). But calling `then`
on the native promise returns a `ZoneAwarePromise` which notifies Angular about the task
being scheduled and forces to re-calculate the `isStable` state.

Issue: #50327

PR Close #50653
2024-01-31 14:57:25 +00:00
arturovt f87f058a69 fix(zone.js): add __Zone_ignore_on_properties to ZoneGlobalConfigurations (#50737)
This commit updates the signature of the `ZoneGlobalConfigurations` interface and adds
missing `__Zone_ignore_on_properties` property, which may be setup to ignore specific `on`
properties from being patched.

PR Close #50737
2024-01-31 14:56:57 +00:00
Matthieu Riegler d6e4931c68 refactor(router): remove duplicate helper methods (#53762)
`isNavigationCancelingError` & `isRedirectingNavigationCancelingError` had duplicate implementations. This commit also cleans-up those functions.

PR Close #53762
2024-01-31 14:56:24 +00:00
Matthieu Riegler e67b9a46f6 refactor(forms): Provide RadioControlRegistry in root. (#54130)
The `RadioControlRegistry` was only provided in a module, providedIn: 'root' fixes that issue.

Fixes #54117

Co-authored-by: sr5434 <118690585+sr5434@users.noreply.github.com>

PR Close #54130
2024-01-31 14:55:56 +00:00
ahmadhakeem18 6ec2f07f5d docs: focus on the respective card of the current active line while scrolling (#53733)
make the active cards have the focus while scrolling like their
respective lines in the scroll service

PR Close #53733
2024-01-30 21:27:55 +00:00
Joey Perrott c4b880a025 refactor: migrate docs, examples, private, service worker and upgrade to prettier formatting (#54163)
Migrate formatting to prettier for docs, examples, private, service worker and upgrade from clang-format

PR Close #54163
2024-01-30 20:08:40 +00:00
Matthieu Riegler b560e02cdf refactor(devtools): Add hydration informations (#53910)
This commit adds hydration informations to the devtools.
* List of hydrated/hydrated components
* Shows hydration overlays
* Shows hydration errors for NG0500, 501 & 502

PR Close #53910
2024-01-30 20:03:14 +00:00
Mahdi Lazraq 274a489bb5 docs: fix path to housing location css file in lesson 03 (#54106)
PR Close #54106
2024-01-30 17:50:11 +00:00
Joey Perrott 0460a9dfaf refactor: migrate common to prettier formatting (#54150)
Migrate formatting to prettier for common from clang-format

PR Close #54150
2024-01-30 16:08:07 +00:00
kabrunko-dev f3567bbc26 refactor(common): simplify i18n plural and select pipe metadata (#53939)
Remove pure property from pipe decorator

PR Close #53939
2024-01-30 15:06:24 +00:00
kabrunko-dev 3c881acc5d refactor(common): simplify date pipe metadata (#53939)
Remove pure property from date pipe decorator

PR Close #53939
2024-01-30 15:06:24 +00:00
Payam Valadkhan 64fa5715c6 fix(compiler-cli): generating extra imports in local compilation mode when cycle is introduced (#53543)
At the moment the extra import generation in local compilation mode fails if these extra imports produce a cycle. To handle this, the cycle handling strategy is updated for local compilation, and following the behaviour in the full compilation mode, the compiler does not generate extra import if it leads to cycle and instead leave things to the runtime.

PR Close #53543
2024-01-30 15:05:43 +00:00
Payam Valadkhan 7e861c640e feat(compiler-cli): generate extra imports for component local dependencies in local mode (#53543)
With option `generateExtraImportsInLocalMode` set, in local mode the compiler generates extra imports for each component local dependencies. Here local dependencies means all component's dependencies within the same compilation unit.

To achieve this, the compiler performs a "local version" of its regular static analysis to find each component's deps, and these deps are used to generate extra side effect imports.

PR Close #53543
2024-01-30 15:05:43 +00:00
Payam Valadkhan f6e9dbbe73 refactor(compiler-cli): run resolve phase fully for components in local mode when generateExtraImportsInLocalMode is set (#53543)
In this commit the resolve method for components is run fully when the option `generateExtraImportsInLocalMode` is set. This is because we need local component depedencies in order to generate extra imports causing by them. This requires cutting some resolve phase logics that are unnecessary in local mode, such as diagnostics.

PR Close #53543
2024-01-30 15:05:43 +00:00
Payam Valadkhan 6a136d1ab3 refactor(compiler-cli): run register phase in local compilation mode (#53543)
When option `generateExtraImportsInLocalMode` is set, we need to compute component local depednecies in order to generate extra imports related to them. At the same time running the register phase in general is harmless in local compilation. So we run it anyway.

PR Close #53543
2024-01-30 15:05:43 +00:00
Payam Valadkhan 3263df23f2 feat(compiler-cli): generate global imports in local compilation mode (#53543)
With option `generateExtraImportsInLocalMode` set in local compilation mode, the compiler generates extra side effect imports using this rule: any external module from which an identifier is imported into an NgModule will be added as side effect import to every file in the compilation unit. To illustrate this better assume the compilation unit has source files `a.ts` and `b.ts`, and:

```
// a.ts
import {SomeExternalStuff} from 'path/to/some_where';
import {SomeExternalStuff2} from 'path/to/some_where2';

...

@NgModule({imports: [SomeExternalStuff]})

```

then the extra import `import "path/to/some_where"` will be added to both `a.js` and `b.js`. Note that this is not the case for `import "path/to/some_where2"` though, since the symbol `SomeExternalStuff2` is not imported into any NgModule.

The math behind this mechanism is, in local compilation mode we cannot resolve component external dependencies fully. For example if a component in `a.ts` uses an external component defined in an external file `some_external_comp.ts` then we can generate the import to this file in `a.js`. Instead, we want to generate an import to a file that "gurantees" that `a.js` is placed after `some_external_comp.js` in the bundle. Now since the component in  `some_external_comp.ts` is used in `a.ts`, then there must be a chain of imports starting from the NgModule that declares the component in `a.ts` to the component in `some_external_comp.ts`. This chain means some file in the same compilation unit as `a.ts` should import some external NgModule which includes `some_external_comp.ts` in its transitive closure and import it to some NgModule. So by adding this import to `a.js` we ensure that the bundling will have the right order.

PR Close #53543
2024-01-30 15:05:43 +00:00
Payam Valadkhan 5feed80523 refactor(bazel): make option generateExtraImportsInLocalMode configurable (#53543)
This is to allow testing this option using bazel

PR Close #53543
2024-01-30 15:05:42 +00:00
Payam Valadkhan 8c36f2d6f1 refactor(compiler-cli): ability to generate side effect imports (#53543)
As the first step,  the import manager's `generateSideEffectImport` method is implemented to enable it to store info for side effect imports. Next, the helper `addImports` is modified to be able to generate correct statement for side effect imports.

These changes will be tested in the subsequent commits when these tools are used to generate an actual extra import for the generated file.

PR Close #53543
2024-01-30 15:05:42 +00:00
Payam Valadkhan fc55de1416 refactor(compiler-cli): incorporate LocalCompilationExtraImportsTracker in the compilation workflow (#53543)
This commit includes a skeleton of how the tool `LocalCompilationExtraImportsTracker` is used in the overall compilation workflow end-to-end.

First of all, a new option `generateExtraImportsInLocalMode` is added, whose presence will make `LocalCompilationExtraImportsTracker` part of the compilation process. When this option is set an instance of `LocalCompilationExtraImportsTracker` is created within the NgCompiler. Then it is passed to the Ivy transformer and plumbed all the way down and the extra imports registered in it are added to the `ImportManager` instances before the imports are added from `ImportManager` to the generated file. This required adding a new method `generateSideEffectImport` to the `ImportManager`, which is an empty method and will be implemented in the subsequent commits.

This commit expected to make no change in the compilation behavior as the methods are not implemented yet.

PR Close #53543
2024-01-30 15:05:42 +00:00
Payam Valadkhan ac3c484bb1 refactor(compiler-cli): add API for extra import tracker (#53543)
The tracker is responsible for registering the extra imports during the analysis and resolve compiler phases, and later to be used by the transformer to get a list of extra imports to be generated for each source file.

This commit only contains the API, and the actual implementation for each method will be done in subsequent commits where an application of that method is available and so tests can be written for the implementation.

PR Close #53543
2024-01-30 15:05:42 +00:00
Andrew Scott 15c48113c2 refactor(router): Update integration tests to cover navigation and history API (#53799)
This commit updates the router integration tests to cover both the
classic History and the new Navigation API. There is more work to be
done here, but this commit works to prove the efficacy of the
`FakeNavigation` implementation.

PR Close #53799
2024-01-30 15:04:02 +00:00
Dylan Hunn 7b4d275f49 fix(compiler): Fix the template pipeline option (#54148)
The `useTemplatePipeline` option was not properly threaded through the component handler.

PR Close #54148
2024-01-29 21:12:32 +00:00
Andrew Scott 3ca34e606d refactor(core): Update ComponentFixture behavior when using zoneless scheduler (#54024)
When the zoneless scheduler is provided, we want to update the behavior
of `ComponentFixture` to address common issues and painpoints in testing.
Developers should never have to call `detectChanges` on a fixture
manually. Instead of calling `detectChanges` after performing an
action that updates state and requies a template refresh, developers
should wait for change detection to run because the update needs to also have
notified the scheduler. If this was not the case, the component would
not work correctly in the application. Calling `detectChanges` to force
an update could hide real bugs.

This commit also updates the zoneless tests to uses `ComponentFixture`
instead of manually attaching to the `ApplicationRef` and rewriting a
lot of the helpers (`getDebugNode`, `isStable` as a value, `whenStable` as a
Promise).

PR Close #54024
2024-01-29 20:21:47 +00:00
Mark Thompson 098543f1d8 docs: Update component-overview.md (#52282)
Refined the text a bit
PR Close #52282
2024-01-29 19:30:59 +00:00
Renan Ferro e86a13674f docs: add new component imports documentation structure (#52282)
PR Close #52282
2024-01-29 19:30:59 +00:00
Jesse Zomer c55018724a docs: fix shareReplay refcount default (#54145)
according to the official rxjs docs the refcount default is false. See https://rxjs.dev/api/operators/shareReplay

Co-authored-by: Andrew Scott <atscott01@gmail.com>

PR Close #54145
2024-01-29 19:30:33 +00:00
therealdennis08 9571287299 docs: correct grammar error on start page (#53993)
Fixed grammatical error

PR Close #53993
2024-01-29 16:41:29 +00:00
Alex Castle f5c520b836 feat(common): add placeholder to NgOptimizedImage (#53783)
Add a automatic placeholder implementation supporting loader-based and data URL placeholders

PR Close #53783
2024-01-29 16:00:38 +00:00
Ido Strauss f3a2b49f82 docs: update TypeScript version support details for Angular v15 and v16 (#54131)
Clarify the range of TypeScript versions supported in Angular v15 and v16 upgrade guides. The previous documentation's phrasing led to potential misunderstandings, as it suggested broader compatibility than actually supported. This change prevents errors by explicitly stating the maximum TypeScript version for each Angular version, ensuring developers have clear guidance during upgrades.

PR Close #54131
2024-01-29 15:57:01 +00:00
Swami 45288f7815 docs: update input/output guide links (#54135)
PR Close #54135
2024-01-29 15:43:05 +00:00
Kristiyan Kostadinov 28ad6fc4ad fix(migrations): error in standalone migration when non-array value is used as declarations in TestBed (#54122)
Adds some logic to skip over `TestBed.configureTestingModule` calls where the `declarations` aren't initialized to an array. We can't migrate these cases, because test migrations don't have access to the Angular compiler. Previously the migration would throw a runtime error.

PR Close #54122
2024-01-29 15:40:05 +00:00
Santosh Yadav d9a84705c9 docs: add link for control flow migration (#53375)
PR Close #53375
2024-01-29 15:39:05 +00:00
Dwouglas Mhagnum c213a4e15a InMemoryBackendConfigArgs.passThruUnknownUrl: fix tsdoc (#52273)
PR Close #52273
2024-01-26 20:39:38 +00:00
Matt Ezell aef7b2c74e docs: Corrected link for defer related blocks (#52704)
PR Close #52704
2024-01-26 20:38:36 +00:00
Muhammad Ahsan Ayaz 52e8f364ed docs(changelog): release notes, fix the typos etc (#52628)
fixed the typos in a few places
added a missing backtick
removed an unnecessary bullet point

PR Close #52628
2024-01-26 20:38:05 +00:00
Wojciech b0632bd703 docs: Update update-to-version-16.md (#51857)
Fix example for required inputs that leads to TS2564 error - property has no initializer

PR Close #51857
2024-01-26 19:13:24 +00:00
Matthieu Riegler 7800a3c9f5 refactor(core): remove InjectionToken descriptions in optimized builds. (#53747)
We started guarding the `InjectionToken` descriptions with `ngDevMode`. Let's generalize that accross the FW.

PR Close #53747
2024-01-26 19:12:41 +00:00
Payam Valadkhan 0970129e20 fix(compiler-cli): show proper error for custom decorators in local compilation mode (#53983)
At the moment local compilation mode does not support custom decorators, and it leads to unhandled errors. In this change a compile time diagnostic is produced in local mode for custom decorators. This is a temporary solution since there are few custom decorators are in use in g3. Custom decorators will be eventually supported in local mode.

PR Close #53983
2024-01-26 19:11:34 +00:00
Paul Gschwendtner 23eeea5bd7 ci: adding devversion to reviewers for compiler/core (#54053)
I've been working on framework parts and compiler since pre-Ivy, and
helped with Ivy, runtime and compiler. Adding myself as a reviewer to
ease future work and to help with review load.

PR Close #54053
2024-01-26 19:10:56 +00:00
Paul Gschwendtner fcea8c1c5d feat(docs-infra): show overloads of methods in API overview (#54053)
This enables us to show overloads of methods in the API overview. This
is useful for e.g. showing the various signatures of the signal input
function, or for signal-based queris.

There seems to be some issues with the length of the `InputFunction`
overloads. There is some line wrapping that doesn't make it _super_
readable but this is an unrelated problem to this change, but rather
a question of UI / API representation in the angular.io site.

PR Close #54053
2024-01-26 19:10:56 +00:00
Paul Gschwendtner 8ba4db2627 refactor(core): avoid clang-format obfuscating InputFunction.required (#54053)
clang-format seems to have problems with the call signature for
`input.required`. This commit works around the formatting issues that
obfuscate the signature. Users will actually see similar output when
they are looking for the `input` function definition of `@angular/core`.

PR Close #54053
2024-01-26 19:10:56 +00:00
Paul Gschwendtner fe4343cf13 refactor(compiler): extract call and construct signatures of interfaces (#54053)
This adds initial support for extracting and rendering call and construct
signatures of classes, like within the new `InputFunction` for signal
inputs.

For now, signatures are a rare occasion and represented as class member
entries. In the future we might consider exposing this via its own entry
type, and field on the class/interface entry.

PR Close #54053
2024-01-26 19:10:56 +00:00
Paul Gschwendtner 58b8a232d6 fix(compiler-cli): support jumping to definitions of signal-based inputs (#54053)
This fixes the definitions for signal-based inputs in the language
service and type checking symbol builder.

Signal inputs emit a slightly different output. The output works well
for comppletion and was designed to affect language service minimally.
Turns out there is a small adjustment needed for the definition symbols.

PR Close #54053
2024-01-26 19:10:56 +00:00
Paul Gschwendtner b78042f3a5 refactor(core): separate InputSignal and InputSignalWithTransform (#54053)
This commit separates `InputSignal` for input signals with transforms.
The reason being that most of the time, signal inputs are not using
transforms and the generics are rather confusing.

Especially for users with inferred types displayed in their IDEs, the
input signal types are seemingly complex, even if no transform is used.

For this reason, we are introducing a new type called
`InputSignalWithTransform`. This type will be used for inputs with
transforms, while non-transform inputs just use `InputSignal`.

A notable fact is that `InputSignal` extends `InputSignalWithTransform`,
with the "identity transform". i.e. there is no transform. This allows
us to share the code for input signals. In practice, we don't expect
users to pass around `InputSignal`'s anyway.

PR Close #54053
2024-01-26 19:10:56 +00:00
Matthieu Riegler d38238e478 docs: remove mention of providedIn module. This feature has been deprecated. (#54072)
PR Close #54072
2024-01-26 19:09:28 +00:00
fhoekstra 16fbe85702 docs(router): fix variable reference in text (#54099)
PR Close #54099
2024-01-26 19:02:42 +00:00
iliasaddab 4105ab51a5 docs: update i18n-common-merge.md (#52400)
correct spelling

PR Close #52400
2024-01-26 17:38:09 +00:00
Matthieu Riegler 1a2b5691e1 docs: add 2 new diagnostics created recently. (#52329)
PR Close #52329
2024-01-26 17:28:01 +00:00
Matthieu Riegler 8a1f1c075a refactor(platform-browser): remove non necessary factories (#52439)
Let's keep the code a simple as necessary

PR Close #52439
2024-01-26 17:26:51 +00:00
Matthieu Riegler 983968dc68 refactor(platform-browser): remove the depency on window for the AngularProfiler. (#52440)
`performance` and `console` are both available on NodeJS, we can replace `window` with `globalThis`.

PR Close #52440
2024-01-26 17:24:40 +00:00
Matthieu Riegler 89ab1c18a1 refactor(common): Use Nullish coalescing assignment when possible. (#53931)
Inspired by #53923, lets simplify code when possible.

PR Close #53931
2024-01-26 16:58:36 +00:00
Angular Robot 6946316350 docs: update events (#53654)
Generated `events.json` with the latest events retrieved from the Firebase DB.

Closes #53229

PR Close #53654
2024-01-26 16:58:07 +00:00
Shuaib hasan akib 271755d0e4 docs(docs-infra): cleanup repeated scss from typography (#51579)
PR Close #51579
2024-01-26 16:03:43 +00:00
Sylvain DEDIEU 1c49160129 docs(docs-infra): add if cases in templates to avoid internal marked parameters or methods to appear in the documentation (#52020)
Fix case of not wanted internal properties displayed in the documentation by adding if blocks in the concerned templates. So if the option is marked as internal the template won't create an entry in the documentation table for the concerned property of method

Fixes #52018

PR Close #52020
2024-01-26 15:47:15 +00:00
Chellappan 989394db90 refactor(forms): Specify Provider type for DEFAULT_VALUE_ACCESSOR (#54029)
Change from `any` to `Provider` type for enhanced type safety and clarity

PR Close #54029
2024-01-26 15:46:31 +00:00
Ezéchiel Amen AGBLA 768b927f9a docs: remove link (#54090)
PR Close #54090
2024-01-26 15:46:00 +00:00
cexbrayat 037b79b72e fix(core): change defer block fixture default behavior to playthrough (#54088)
This is a followup to #53956

The default behavior needs to be changed in `TestBedCompiler` as well to have an effect.

PR Close #54088
2024-01-26 15:44:40 +00:00
Magda98 c3b0095965 docs(docs-infra): move comma in Angular Language Service section (#53759)
PR Close #53759
2024-01-25 23:48:56 +00:00
jivanf b9547a98f6 docs: Use correct service name in hierarchical dependency injection guide (#53723)
This commit replaces `TitleService` with `TiresService` in the specialized providers scenario described in the guide.
PR Close #53723
2024-01-25 23:47:01 +00:00
Antoine PARIZE 863c12aa89 docs: testing-components-basics.md and components-basics.md links to css selector documentation are dead (#53586)
docs: testing-components-basics.md and components-basics.md links to css selector documentation are dead

As MDN's documentation link to the "css selector" topic is dead, this commit makes the angular documentation use the new valid link.

PR Close #53586
2024-01-25 23:34:03 +00:00
oliv37 c634405a52 docs: fix add builder from package (#53154)
PR Close #53154
2024-01-25 23:31:01 +00:00
pBouillon 89abbaac7f docs: fix reference to forwardRef in ForwardRefFn JSdoc (#53556)
PR Close #53556
2024-01-25 23:16:46 +00:00
lsst25 fa0f44da7e docs(docs-infra): close tag in the example of Composing Components tutorial (#52923)
PR Close #52923
2024-01-25 23:04:47 +00:00
Ross MacPhee 2a4d8aa070 docs: fix nonsensical injection provider docs (#53456)
PR Close #53456
2024-01-25 23:02:46 +00:00
nickolashkraus f034d29023 docs: With >>> with (#53472)
PR Close #53472
2024-01-25 22:58:34 +00:00
Srinath Vayalpati 3db755d411 docs: fix router api url link (#53398)
PR Close #53398
2024-01-25 22:58:09 +00:00
Andrea Canciani ecbb47b208 refactor: fix a number of typos throughout the codebase (#52826)
Fix several typos, mostly in the `adev` site.

PR Close #52826
2024-01-25 22:54:59 +00:00
Sai Kumar Kola dfc6c8d0c7 fix: cta clickability issue in adev homepage. (#52905)
PR Close #52905
2024-01-25 22:48:47 +00:00
Aditya Kumar c9c22fa059 docs: Fix open link in new tab (#53647)
Signed-off-by: Aditya Kumar <aditya.kumar60@infosys.com>

PR Close #53647
2024-01-25 22:40:50 +00:00
louay.meskini 96bee52b28 docs: Fix links for NgZone (#53667)
PR Close #53667
2024-01-25 22:38:51 +00:00
jase 4bb1c8fe58 docs: fix http handler usage on interceptor example (#53772)
PR Close #53772
2024-01-25 22:38:18 +00:00
Trung Vo 3e2cd83e65 docs: add Trung Vo to GDE resources (#53599)
PR Close #53599
2024-01-25 22:29:26 +00:00
Aditya Kumar ec526ca77a docs: Fix router api url link on tutorial page (#53416)
Signed-off-by: Aditya Kumar <aditya.kumar60@infosys.com>

PR Close #53416
2024-01-25 22:27:11 +00:00
Ezéchiel Amen AGBLA 9f18227f3a docs: bad redirection in core Injector page for providers and injection token links (#52775)
PR Close #52775
2024-01-25 21:34:35 +00:00
Gleb28 001c30defd docs: removed repeated words "when" (#53828)
Fixes #53827

PR Close #53828
2024-01-25 21:31:33 +00:00
Sylvain DEDIEU 9bb1884304 docs: change the file of the provideHttpClient standalone example to match cli generated project (#52806)
The "Providing HttpClient through dependency injection" documentation now shows that in case of a standalone boostraped app, the provideHttpClient is to include in the app.config.ts file.

Also updated the http setup server communication example to align the new doc (adev) with the old one (aio).

PR Close #52806
2024-01-25 21:24:58 +00:00
Sasidharan SD c8d1b11cec docs: fix invalid file replacement configuration (#52802)
PR Close #52802
2024-01-25 21:22:44 +00:00
Aditya Kumar d404fe87e8 docs: Fix minor grammatical fixes in the documentations (#53418)
Signed-off-by: Aditya Kumar <aditya.kumar60@infosys.com>

PR Close #53418
2024-01-25 21:21:59 +00:00
Nelson Gutierrez ef8c68bd22 docs: add correct language for syntax highlighting on new docs (#52712)
PR Close #52712
2024-01-25 21:19:29 +00:00
Nelson Gutierrez 8c65376324 docs: add correct syntax highlighting type in event binding documentation (#52712)
PR Close #52712
2024-01-25 21:19:29 +00:00
ilir.beqiri 35ec260029 docs: fix type at change detection with pipes section (#53940)
Fix a typo of word 'heroes' at docs guide for change detection with pure pipes

PR Close #53940
2024-01-25 20:46:18 +00:00
Kristiyan Kostadinov c637dfa092 refactor(core): signals toString improvements (#54079)
Follow-up to #54002 that:
* Remove the `toString` implementation from the `primitives`.
* Guards the `toString` with `ngDevMode` and prints out the value.

PR Close #54079
2024-01-25 20:45:02 +00:00
Jessica Janiuk a6dad59536 ci: update adev approvers list (#54081)
This temporarily updates the adev approvers list before we decide how we will handle adev content reviews going forward.

PR Close #54081
2024-01-25 20:40:08 +00:00
Ben Hong d5c0743380 ci: add ben to reviewers for adev files (#54078)
For ADEV changes going forward, Ben will be helping the team to review all PRs associated with this project.

PR Close #54078
2024-01-25 20:18:51 +00:00
Angular Robot 58d4abcb22 docs: update Angular CLI help [main] (#54075)
Updated Angular CLI help contents.

PR Close #54075
2024-01-25 18:03:27 +00:00
vladboisa 8da67ae217 docs: fix & update MDN Shadow API link examples (#54040)
PR Close #54040
2024-01-25 18:02:58 +00:00
Ben Hong c4853e952d docs: add documentation and script for local docs dev environment (#54038)
PR Close #54038
2024-01-25 18:02:27 +00:00
d-codez fab1590731 docs: correct grammar in event handling documentation (#54009)
PR Close #54009
2024-01-25 18:01:50 +00:00
Kristiyan Kostadinov 656bc282e3 fix(core): add toString implementation to signals (#54002)
Since signals are function, currently stringifying them reveals the implementation of the function. This can lead to confusion since it contains internal implementation details. These changes add static `toString` function to address the issue.

**Note:** it's tempting to have `toString` output the actual value of the signal, but that would encourage users not to call the function which will be problematic in the long run. That's why these changes are using a static string instead.

PR Close #54002
2024-01-25 17:11:30 +00:00
arturovt 75aeae42b7 fix(animations): cleanup DOM elements when root view is removed with async animations (#53033)
Currently, when using `provideAnimationsAsync`, Angular uses `AnimationRenderer`
as the renderer. When the root view is removed, the `AnimationRenderer` defers the actual
work to the `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine`
doesn't actually remove the DOM node, but just calls `markElementAsRemoved()`.

The actual DOM node is not removed until `TransitionAnimationEngine` "flushes".

Unfortunately, though, that "flush" will never happen, since the root view is being
destroyed and there will be no more flushes.

This commit adds `flush()` call when the root view is being destroyed.

PR Close #53033
2024-01-25 16:32:57 +00:00
Kristiyan Kostadinov 93188cb439 refactor(compiler): distinguish two-way bindings in the AST (#54065)
During the template parsing stage two-way bindings are split up into a property and event binding. All the downstream code treats these binding the same as their one-way equivalents. For some future work we'll have to distinguish between the two so these changes update the `BoundElementProperty.type` and `ParsedEvent.type` to include a `TwoWay` type. All existing call-sites have been updated to treat `TwoWay` the same as `Property`/`Regular`, but more specialized logic will be added in the future.

PR Close #54065
2024-01-25 16:31:57 +00:00
Dylan Hunn c3bb00a2eb refactor(compiler): Fix defer deps fn duplicate names in Template Pipeline (#54060)
Previously, defer deps fns names were only prefixed with the component name, meaning that distinct deps fns in the same component would produce a name collision. Now, we take into account the entire template function name when naming inner deps fns.

PR Close #54060
2024-01-25 16:31:01 +00:00
Diego Julião bd9c2c5b3f docs: remove ngx-deploy-npm from deployers table (#53999)
PR Close #53999
2024-01-25 16:07:40 +00:00
Pawel Kozlowski c04312860b refactor(core): introduce instructions for view queries as signals (#54017)
This commit adds new instructions to support view queries as signals.

PR Close #54017
2024-01-24 18:39:51 -05:00
Pawel Kozlowski 3e67b271ad refactor(core): introduce onDirty notification on QueryList (#54017)
This refactoring expands the QueryList such that we can add onDirty
callback to be invoked when a given query gets marked as dirty during
view insertion / removal. This mechanism is needed for signal-based
queries.

PR Close #54017
2024-01-24 18:39:51 -05:00
Pawel Kozlowski 73fec9ddbf refactor(core): extract more query logic from instructions (#54017)
This is a refactor commit that moves more query construction / refresh
logic from the body of instructions into dedicated functions. This is
in preparation for the signal-based query instructions.

PR Close #54017
2024-01-24 18:39:51 -05:00
Andrew Scott 308d83c312 refactor(core): race rAF and setTimeout in zoneless scheduler (#54023)
Update zoneless scheduler to run change detection after the first of
either `requestAnimationFrame` or `setTimeout` callbacks execute.

PR Close #54023
2024-01-24 18:39:15 -05:00
Jan Olaf Krems c7df61fbc2 refactor(core): Allow mutation instead of reassignment of ngDevMode (#53862)
In some bundling scenarios, there may be local references to `ngDevMode` that need to be kept in sync with the global variable. This becomes hard to impossible if the global is reassigned. This allows setting the global to an empty object instead of `true` and preserve identity during `initNgDevMode`.
PR Close #53862
2024-01-24 18:38:50 -05:00
Andrew Scott eddf5dae5e fix(compiler): Update type check block to fix control flow source mappings (#53980)
The source mappings and types for various pieces of the control flow
were not quite right and prevented the language service from providing
accurate information.

fixes https://github.com/angular/vscode-ng-language-service/issues/1988

PR Close #53980
2024-01-24 18:37:58 -05:00
Dylan Hunn 47e6e84101 feat(compiler): Add a TSConfig option useTemplatePipeline (#54057)
The Template Pipeline is a brand new backend for the Angular compiler, replacing `TemplateDefinitionBuilder`. It generates the Ivy instructions corresponding to an input template (or host binding). The Template Pipeline has an all-new design based on an intermediate representation compiled over many phases, which will allow us to experiment with compiler changes more easily in the future.

With this commit, the template pipeline can now be enabled in any project via the `useTemplatePipeline` TSConfig option. However, it is still disabled by default.

PR Close #54057
2024-01-24 18:36:23 -05:00
Dylan Hunn 0f5f45c0fa refactor(compiler): Support externally provided defer deps fns (#54043)
In #53591, Andrew added local compliation support for defer blocks. However, this requires the ability to emit pre-generated static defer deps functions. We now also support that feature in Template Pipeline.

PR Close #54043
2024-01-24 18:35:24 -05:00
Alex Rickabaugh fad1354d50 release: cut the v17.2.0-next.0 release 2024-01-24 13:00:51 -08:00
nikvarma 9e10af45c5 docs: typo Chat to chart fix (#53892)
PR Close #53892
2024-01-24 21:23:51 +01:00
Pawel Kozlowski a2a0b33c13 docs: release notes for the v17.1.1 release (#54056)
PR Close #54056
2024-01-24 20:35:15 +01:00
Paul Gschwendtner 77516450c8 refactor(compiler): support JIT for signal-based queries (#54019)
Similar to signal-based inputs, we support signal-based queries in JIT
by expecting a decorator to be added. This is a consequence of the
design, given that JIT requires query declaration information before
the class is initialized- but ironically there is no way to collect this
information without instantiating the class.

A JIT transform in the Angular CLI will automatically generate these
decorators for testing.

PR Close #54019
2024-01-24 16:13:31 +01:00
Paul Gschwendtner 17a47c4c54 refactor(compiler-cli): additional diagnostics for signal-based queries (#54019)
This commit introduces three additional diagnostics for queries:

- If a query (either using decorator or signal-based) is declared on a
  static class member, a diagnostic is raised.
- If a signal-based query is mixed with a query decorator, a diagnostic
  is raised. Similar to signal inputs.
- If a singal-based query is also declared in the directive/component
  class decorator metadata, a diagnostic is raised.

PR Close #54019
2024-01-24 16:13:31 +01:00
Paul Gschwendtner a7017a0471 refactor(core): improve safety of input/query initializer API detection (#54019)
Due to some refactorings, we were only checking the function name
and whether it originates from an import. We should also verify the
module. This seems like logic we lost in the refactorings.

PR Close #54019
2024-01-24 16:13:31 +01:00
Paul Gschwendtner 3b6f636edf refactor(compiler-cli): collapse multiple query advance statements (#54019)
Collapses multiple sibling query advance statements into single
query advance invocations. This will help reducing generated code
for directives/components with many queries.

PR Close #54019
2024-01-24 16:13:31 +01:00
Paul Gschwendtner 998af3276f refactor(compiler-cli): move more query generation logic to dedicated file (#54019)
Without any modifications, this commit moves more of the the query
generation logic into its dedicated file.

PR Close #54019
2024-01-24 16:13:31 +01:00
Max 09f94234ee docs: fix typo in Custom directives section (#54044)
There was a grammatically incorrect sentence in the What is Angular page, Custom directives section. This change makes it more correct.
PR Close #54044
2024-01-24 15:32:22 +01:00
Paul Gschwendtner 25f91e38b2 build: ensure zone.js typing test is hermetic (#54048)
Currently the ZoneJS typing tests executes outside of Bazel, as a legacy
artifact of the monorepo merging (as it seems - not ideal at all).

Looks like this test relies on its own node modules, that were NOT
locked using a yarn lock file. This commit adds one, and specifically
locks it to a `@types/node` version that does not include the most
recent patch release (which seemingly introduced a breaking change)
that causes issues with TypeScript's lib checking.

Whenever we perform lock file maintenance in the future, we have the
following options:

- Consider disabling lib checking via `skipLibCheck` for this test. This
  may be acceptable.
- Continue locking the node version,
- Waiting for chokidar to comply with the new signature
- Waiting for the breaking change to be rolled back.

Culprit change:
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/68300

PR Close #54048
2024-01-24 14:57:05 +01:00
Andrew Scott bc85551bfc fix(router): revert commit that replaced last helper with native Array.at(-1) (#54021)
While `Array.at` is technically supported in all browsers we officially
support, the change was needlessly breaking without any real benefit.

PR Close #54021
2024-01-24 10:54:52 +01:00
Andrew Kushnir aeaec8629c refactor(compiler-cli): rephrase an error message related to @defer and local compilation (#54030)
This commit updates the error message to cover cases when imported symbols have eager references inside of a file.

PR Close #54030
2024-01-24 10:08:50 +01:00
9306 changed files with 371397 additions and 579057 deletions
+1 -3
View File
@@ -5,9 +5,6 @@
.git
node_modules
dist
aio/node_modules
aio/tools/examples/shared/node_modules
aio/tools/examples/shared/example-scaffold
# All integration test node_modules folders
integration/animations/node_modules
@@ -17,6 +14,7 @@ integration/cli-hello-world-ivy-i18n/node_modules
integration/cli-hello-world-lazy/node_modules
integration/cli-hello-world-mocha/node_modules
integration/cli-signal-inputs/node_modules
integration/platform-server-hydration/node_modules
integration/defer/node_modules
integration/dynamic-compiler/node_modules
integration/forms/node_modules
+10 -26
View File
@@ -1,5 +1,5 @@
# Enable debugging tests with --config=debug
test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results
test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results --spawn_strategy=local
# Do not attempt to de-flake locally.
# On CI we might set this to `3` to run with deflaking.
@@ -56,31 +56,16 @@ build --enable_runfiles
build:release --workspace_status_command="yarn -s ng-dev release build-env-stamp --mode=release"
build:release --stamp
# Building AIO against local Angular deps requires stamping
# versions in Angular packages due to CLI version checks.
build:aio_local_deps --stamp
build:aio_local_deps --workspace_status_command="yarn -s --cwd aio local-workspace-status"
# Snapshots should also be stamped with version control information.
build:snapshot-build --workspace_status_command="yarn -s ng-dev release build-env-stamp --mode=snapshot"
build:snapshot-build --stamp
##########################################################
# AIO architect build configuration #
# See aio/angular.json for available configurations. #
# To build with a partiular configuration: #
# bazel build //aio:build --aio_build_config=<config> #
# Default config is `stable``. #
##########################################################
build --flag_alias=aio_build_config=//aio:flag_aio_build_config
####################################
# AIO first party dep substitution #
# Turn on with #
# --config=aio_local_deps #
####################################
build:aio_local_deps --//aio:flag_aio_local_deps
# Angular DevTools for Firefox releases *cannot* be stamped and `--config snapshot-build-firefox` is a no-op.
# This is because Mozilla requires add-on source code to be uploaded and then they manually reproduce the build.
# If we stamp the build based on Git information such as the current commit, then reproducing the build would require
# uploading the entire `.git` directory. We already must upload the entire monorepo, and uploading `.git` as well
# exceeds the max source file size. To address this, we just *don't* stamp Firefox builds of Angular DevTools.
build:snapshot-build-firefox --nostamp
###############################
# Output #
@@ -118,10 +103,6 @@ common:remote --jobs=200
build:remote --google_default_credentials
# Limit the number of test jobs for on an AIO local deps build. The example tests running
# concurrently pushes the circleci executor RAM usage to its limits.
test:aio_local_deps --jobs=24
# Force remote exeuctions to consider the entire run as linux
build:remote --cpu=k8
build:remote --host_cpu=k8
@@ -177,6 +158,9 @@ test:saucelabs --flaky_test_attempts=1
# --ng_perf will ask the Ivy compiler to produce performance results for each build.
build --flag_alias=ng_perf=//packages/compiler-cli:ng_perf
# --adev_fast will run adev build/serve in a faster mode, skipping things like prerendering
# for local development.
build --flag_alias=fast_adev=//adev:fast_build_mode
####################################################
# User bazel configuration
+1 -1
View File
@@ -44,7 +44,7 @@ function setSecretVar() {
# Create a function to set an environment variable, when called.
#
# Use this function for creating setter for public environment variables that require expensive or
# time-consuming computaions and may not be needed. When needed, you can call this function to set
# time-consuming computations and may not be needed. When needed, you can call this function to set
# the environment variable (which will be available through `$BASH_ENV` from that point onwards).
#
# Arguments:
-1
View File
@@ -16,7 +16,6 @@ echo "source $envHelpersPath;" >> $BASH_ENV;
####################################################################################################
setPublicVar CI "$CI"
setPublicVar PROJECT_ROOT "$projectDir";
setPublicVar CI_AIO_MIN_PWA_SCORE "95";
# This is the branch being built; e.g. `pull/12345` for PR builds.
setPublicVar CI_BRANCH "$CIRCLE_BRANCH";
setPublicVar CI_BUILD_URL "$CIRCLE_BUILD_URL";
+1 -6
View File
@@ -6,11 +6,6 @@
"postCreateCommand": "yarn install",
"extensions": [
"devondcarew.bazel-code",
"gkalpak.aio-docs-utils",
"ms-vscode.vscode-typescript-tslint-plugin",
"xaver.clang-format",
// The following extensions are useful when working on angular.io (i.e. inside the `aio/` directory).
//"angular.ng-template",
//"dbaeumer.vscode-eslint",
"ms-vscode.vscode-typescript-tslint-plugin"
],
}
+1 -1
View File
@@ -1,4 +1,4 @@
name: 'Docs or angular.io Bug Report'
name: 'Docs or angular.dev Bug Report'
description: Report an issue in Angular's documentation or angular.io application
body:
@@ -0,0 +1,18 @@
load("//tools:defaults.bzl", "esbuild_checked_in")
exports_files([
"tsconfig.json",
])
esbuild_checked_in(
name = "main",
entry_point = "//.github/actions/deploy-docs-site/lib:main.ts",
external = [
"undici",
],
platform = "node",
target = "node14",
deps = [
"//.github/actions/deploy-docs-site/lib",
],
)
@@ -0,0 +1,19 @@
name: 'Deploy angular.dev site'
description: 'Automatically deploy and set up redirects for angular.dev'
author: 'Angular'
inputs:
serviceKey:
description: 'The service key used for firebase deployments.'
required: true
githubReleaseTrainReadToken:
description: 'GitHub access token for reading release trains without rate limits.'
required: true
configPath:
description: 'The path to the firebase config file.'
required: true
distDir:
description: 'The path to the firebase dist directory.'
required: true
runs:
using: 'node20'
main: 'main.js'
@@ -0,0 +1,23 @@
load("//tools:defaults.bzl", "ts_library")
package(default_visibility = ["//.github/actions/deploy-docs-site:__subpackages__"])
exports_files([
"main.ts",
])
ts_library(
name = "lib",
srcs = glob(
["*.ts"],
),
#tsconfig = "//.github/actions/deploy-docs-site:tsconfig.json",
deps = [
"@npm//@actions/core",
"@npm//@actions/github",
"@npm//@angular/ng-dev",
"@npm//@types/node",
"@npm//@types/tmp",
"@npm//tmp",
],
)
@@ -0,0 +1,20 @@
import {fileSync} from 'tmp';
import {writeSync} from 'fs';
import {getInput, setSecret} from '@actions/core';
let credentialFilePath: undefined | string;
export function getCredentialFilePath(): string {
if (credentialFilePath === undefined) {
const tmpFile = fileSync({postfix: '.json'});
writeSync(tmpFile.fd, getInput('serviceKey', {required: true}));
setSecret(tmpFile.name);
credentialFilePath = tmpFile.name;
}
return credentialFilePath;
}
/** Github access token. Used for querying the active release trains. */
export const githubReleaseTrainReadToken: string = getInput('githubReleaseTrainReadToken', {
required: true,
});
@@ -0,0 +1,116 @@
import {cp, mkdtemp, readFile, rm, writeFile} from 'fs/promises';
import {Deployment} from './deployments';
import {join} from 'path';
import {tmpdir} from 'os';
import {spawnSync} from 'child_process';
import {getCredentialFilePath} from './credential';
export async function deployToFirebase(
deployment: Deployment,
configPath: string,
distDirPath: string,
) {
if (deployment.destination == undefined) {
console.log(`No deployment necessary for docs created from: ${deployment.branch}`);
return;
}
console.log('Preparing for deployment to firebase...');
const tmpDeployDir = await mkdtemp(join(tmpdir(), 'deploy-directory'));
const deployConfigPath = join(tmpDeployDir, 'firebase.json');
const config = JSON.parse(await readFile(configPath, {encoding: 'utf-8'})) as {
hosting: {public: string};
};
config['hosting']['public'] = './dist';
await writeFile(deployConfigPath, JSON.stringify(config, null, 2));
await cp(distDirPath, join(tmpDeployDir, 'dist'), {recursive: true});
spawnSync(`chmod 777 -R ${tmpDeployDir}`, {encoding: 'utf-8', shell: true});
firebase(
`target:clear --config ${deployConfigPath} --project angular-dev-site hosting angular-docs`,
tmpDeployDir,
);
firebase(
`target:apply --config ${deployConfigPath} --project angular-dev-site hosting angular-docs ${deployment.destination}`,
tmpDeployDir,
);
firebase(
`deploy --config ${deployConfigPath} --project angular-dev-site --only hosting --non-interactive`,
tmpDeployDir,
);
firebase(
`target:clear --config ${deployConfigPath} --project angular-dev-site hosting angular-docs`,
tmpDeployDir,
);
await rm(tmpDeployDir, {recursive: true});
}
export async function setupRedirect(deployment: Deployment) {
if (deployment.redirect === undefined) {
console.log(`No redirect necessary for docs created from: ${deployment.branch}`);
return;
}
console.log('Preparing to set up redirect on firebase...');
const redirectConfig = JSON.stringify(
{
hosting: {
target: 'angular-docs',
redirects: [
{
type: 302,
regex: '^(.*)$',
destination: `${deployment.redirect.to}:1`,
},
],
},
},
null,
2,
);
const tmpRedirectDir = await mkdtemp(join(tmpdir(), 'redirect-directory'));
const redirectConfigPath = join(tmpRedirectDir, 'firebase.json');
await writeFile(redirectConfigPath, redirectConfig);
spawnSync(`chmod 777 -R ${tmpRedirectDir}`, {encoding: 'utf-8', shell: true});
firebase(
`target:clear --config ${redirectConfigPath} --project angular-dev-site hosting angular-docs`,
tmpRedirectDir,
);
firebase(
`target:apply --config ${redirectConfigPath} --project angular-dev-site hosting angular-docs ${deployment.redirect.from}`,
tmpRedirectDir,
);
firebase(
`deploy --config ${redirectConfigPath} --project angular-dev-site --only hosting --non-interactive`,
tmpRedirectDir,
);
firebase(
`target:clear --config ${redirectConfigPath} --project angular-dev-site hosting angular-docs`,
tmpRedirectDir,
);
await rm(tmpRedirectDir, {recursive: true});
}
function firebase(cmd: string, cwd?: string) {
spawnSync('npx', `-y firebase-tools@latest ${cmd}`.split(' '), {
cwd,
encoding: 'utf-8',
shell: true,
stdio: 'inherit',
env: {
...process.env,
GOOGLE_APPLICATION_CREDENTIALS: getCredentialFilePath(),
},
});
}
@@ -0,0 +1,67 @@
import {fetchLongTermSupportBranchesFromNpm, ActiveReleaseTrains} from '@angular/ng-dev';
import {ReleaseConfig} from '@angular/ng-dev';
import {AuthenticatedGitClient} from '@angular/ng-dev';
export interface Deployment {
branch: string;
redirect?: {
from: string;
to: string;
};
destination?: string;
}
export type Deployments = Map<string, Deployment>;
export async function getDeployments(): Promise<Deployments> {
const {github} = await AuthenticatedGitClient.get();
const releaseTrains = await ActiveReleaseTrains.fetch({
api: github,
name: 'angular',
owner: 'angular',
nextBranchName: 'main',
});
const ltsBranches = await fetchLongTermSupportBranchesFromNpm({
representativeNpmPackage: '@angular/core',
} as ReleaseConfig);
const docSites = new Map<string, Deployment>();
[...ltsBranches.active, ...ltsBranches.inactive].forEach((branch) => {
docSites.set(branch.name, {
branch: branch.name,
destination: `v${branch.version.major}-angular-dev`,
});
});
docSites.set(releaseTrains.latest.branchName, {
branch: releaseTrains.latest.branchName,
redirect: {
from: `v${releaseTrains.latest.version.major}-angular-dev`,
to: 'https://angular.dev',
},
destination: 'angular-dev-site',
});
if (releaseTrains.releaseCandidate) {
docSites.set(releaseTrains.next.branchName, {
branch: releaseTrains.next.branchName,
});
docSites.set(releaseTrains.releaseCandidate.branchName, {
branch: releaseTrains.releaseCandidate.branchName,
destination: 'next-angular-dev',
redirect: {
from: `v${releaseTrains.releaseCandidate.version.major}-angular-dev`,
to: 'https://next.angular.dev',
},
});
} else {
docSites.set(releaseTrains.next.branchName, {
branch: releaseTrains.next.branchName,
destination: 'next-angular-dev',
});
}
return docSites;
}
@@ -0,0 +1,75 @@
import {getInput, setFailed} from '@actions/core';
import {context} from '@actions/github';
import {deployToFirebase, setupRedirect} from './deploy';
import {getDeployments} from './deployments';
import {AuthenticatedGitClient, GithubConfig, setConfig} from '@angular/ng-dev';
import {githubReleaseTrainReadToken} from './credential';
const refMatcher = /refs\/heads\/(.*)/;
async function deployDocs() {
setConfig({
github: <GithubConfig>{
mainBranchName: 'main',
name: 'angular',
owner: 'angular',
},
});
AuthenticatedGitClient.configure(githubReleaseTrainReadToken);
if (context.eventName !== 'push') {
throw Error();
}
const matchedRef = context.ref.match(refMatcher);
if (matchedRef === null) {
throw Error();
}
const currentBranch = matchedRef[1];
const configPath = getInput('configPath');
const distDir = getInput('distDir');
const deployment = (await getDeployments()).get(currentBranch);
if (deployment === undefined) {
console.log(`Current branch (${currentBranch}) does not deploy a documentation site.`);
console.log(`Exiting...`);
process.exit(0);
}
console.log('Doc site deployment information');
console.log('');
console.log('Current Branch:');
console.log(` ${deployment.branch}`);
console.log('');
console.log('Firebase Site:');
if (deployment.destination === undefined) {
console.log(' No deployment of a documenation site is necessary');
} else {
console.log(` Deploying to: ${deployment.destination}`);
}
console.log('');
console.log('Redirect Configuration:');
if (deployment.redirect === undefined) {
console.log(' No redirects are necessary');
} else {
console.log(` From: ${deployment.redirect.from}`);
console.log(` To: ${deployment.redirect.to}`);
}
await deployToFirebase(deployment, configPath, distDir);
await setupRedirect(deployment);
}
// Only run if the action is executed in a repository with is in the Angular org. This is in place
// to prevent the action from actually running in a fork of a repository with this action set up.
if (context.repo.owner === 'angular') {
deployDocs().catch((e: Error) => {
setFailed(e.message);
console.error(e);
});
} else {
console.warn(
'The action was skipped as this action is only meant to run in repos belonging to the Angular organization.',
);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,3 @@
{
"type": "module"
}
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "Node16",
"target": "es2020",
"lib": ["es2021", "dom"],
"experimentalDecorators": true,
"strict": true,
"outDir": "../../../dist/tsc-non-bazel-out",
"skipLibCheck": true,
"noImplicitOverride": true,
// TODO(ESM): Remove this when Bazel also uses the Node resolution.
"esModuleInterop": true,
"noImplicitReturns": true,
"jsx": "react",
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment"
},
"exclude": []
}
+1 -1
View File
@@ -4,7 +4,7 @@ description: 'Installs the dependencies using Yarn'
runs:
using: 'composite'
steps:
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
with:
path: |
./node_modules/
+5 -5
View File
@@ -21,16 +21,16 @@ jobs:
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'adev: preview'))
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Build adev to ensure it continues to work
run: yarn bazel build --config=aio_local_deps //adev:build
- uses: angular/dev-infra/github-actions/previews/pack-and-upload-artifact@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
run: yarn bazel build //adev:build --config=release
- uses: angular/dev-infra/github-actions/previews/pack-and-upload-artifact@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
workflow-artifact-name: 'adev-preview'
pull-number: '${{github.event.pull_request.number}}'
+2 -2
View File
@@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
token: '${{secrets.GITHUB_TOKEN}}'
@@ -40,7 +40,7 @@ jobs:
npx -y firebase-tools@latest target:clear --config adev/firebase.json --project ${{env.PREVIEW_PROJECT}} hosting angular-docs
npx -y firebase-tools@latest target:apply --config adev/firebase.json --project ${{env.PREVIEW_PROJECT}} hosting angular-docs ${{env.PREVIEW_SITE}}
- uses: angular/dev-infra/github-actions/previews/upload-artifacts-to-firebase@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- uses: angular/dev-infra/github-actions/previews/upload-artifacts-to-firebase@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
github-token: '${{secrets.GITHUB_TOKEN}}'
workflow-artifact-name: 'adev-preview'
-42
View File
@@ -1,42 +0,0 @@
# This workflow builds the AIO previews for pull requests when a certain label is applied.
# The actual deployment happens as part of a dedicated second workflow to avoid security
# issues where the building would otherwise occur in an authorized context where secrets
# could be leaked. More details can be found here:
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/.
name: Build AIO app for preview deployment
on:
pull_request:
types: [synchronize, labeled]
permissions: read-all
jobs:
aio-build:
runs-on: ubuntu-latest
# We only want to build and deploy the AIO app if the `aio: preview` label has been
# added, or if the label is already applied and new changes have been made in the PR.
if: |
(github.event.action == 'labeled' && github.event.label.name == 'aio: preview') ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'aio: preview'))
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/yarn-install
- uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
with:
bazelrc: ./.bazelrc.user
# Build the web package. Note: We run Bazel from a low-resource Github action container,
# so we manually need to instruct Bazel to run more actions concurrently as by default
# the number of concurrent actions is determined based on the host resources.
- run: bazel build //aio:build --jobs=32 --announce_rc --verbose_failures
- uses: angular/dev-infra/github-actions/previews/pack-and-upload-artifact@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
with:
workflow-artifact-name: 'aio'
pull-number: '${{github.event.pull_request.number}}'
artifact-build-revision: '${{github.event.pull_request.head.sha}}'
deploy-directory: './dist/bin/aio/build'
-44
View File
@@ -1,44 +0,0 @@
# This workflow runs whenever the AIO build workflow has completed. Deployment happens
# as part of a dedicated second workflow to avoid security issues where the building would
# otherwise occur in an authorized context where secrets could be leaked.
#
# More details can be found here:
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/.
name: Deploying AIO preview to Firebase
on:
workflow_run:
workflows: ['Build AIO app for preview deployment']
types: [completed]
permissions:
# Needed in order to be able to comment on the pull request.
pull-requests: write
env:
PREVIEW_PROJECT: ng-dev-previews
PREVIEW_SITE: ng-dev-previews-fw
jobs:
aio-deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Configure Firebase deploy target
working-directory: aio/
run: |
# We can use `npx` as the Firebase deploy actions uses it too.
npx -y firebase-tools@latest target:clear --project ${{env.PREVIEW_PROJECT}} hosting aio
npx -y firebase-tools@latest target:apply --project ${{env.PREVIEW_PROJECT}} hosting aio ${{env.PREVIEW_SITE}}
- uses: angular/dev-infra/github-actions/previews/upload-artifacts-to-firebase@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
with:
github-token: '${{secrets.GITHUB_TOKEN}}'
workflow-artifact-name: 'aio'
firebase-config-dir: './aio/'
firebase-public-dir: './aio/dist'
firebase-project-id: '${{env.PREVIEW_PROJECT}}'
firebase-service-key: '${{secrets.FIREBASE_PREVIEW_SERVICE_TOKEN}}'
@@ -13,9 +13,9 @@ jobs:
assistant_to_the_branch_manager:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- uses: angular/dev-infra/github-actions/branch-manager@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- uses: angular/dev-infra/github-actions/branch-manager@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}
+4 -4
View File
@@ -19,7 +19,7 @@ jobs:
exit: true
# Indicate that the benchmark command was received.
- uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3
- uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4
with:
comment-id: ${{github.event.comment.id}}
token: '${{secrets.BENCHMARK_POST_RESULTS_GITHUB_TOKEN}}'
@@ -28,7 +28,7 @@ jobs:
- uses: alessbell/pull-request-comment-branch@aad01d65d6982b8eacabed5e9a684cd8ceb98da6 # v1.1
id: comment-branch
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# Specify repository as the PR branch might be from a fork.
repository: ${{steps.comment-branch.outputs.head_owner}}/${{steps.comment-branch.outputs.head_repo}}
@@ -38,7 +38,7 @@ jobs:
- uses: ./.github/actions/yarn-install
- uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
bazelrc: ./.bazelrc.user
@@ -53,7 +53,7 @@ jobs:
id: benchmark
name: Running benchmark
- uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3
- uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4
with:
issue-number: ${{github.event.issue.number}}
token: '${{secrets.BENCHMARK_POST_RESULTS_GITHUB_TOKEN}}'
-64
View File
@@ -1,64 +0,0 @@
name: CI
on:
pull_request_target:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
permissions: {}
defaults:
run:
shell: bash
jobs:
saucelabs:
runs-on: ubuntu-latest-4core
env:
SAUCE_TUNNEL_IDENTIFIER: angular-framework-${{ github.run_number }}
SAUCE_USERNAME: ${{ vars.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
with:
cache-node-modules: true
# Checking out the pull request commit is intended here as we need to run the changed code tests.
ref: ${{ github.event.pull_request.head.sha }}
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- name: Starting Saucelabs tunnel service
run: ./tools/saucelabs/sauce-service.sh run &
# Build test fixtures for a test that rely on Bazel-generated fixtures. Note that disabling
# specific tests which are reliant on such generated fixtures is not an option as SystemJS
# in the Saucelabs legacy job always fetches referenced files, even if the imports would be
# guarded by an check to skip in the Saucelabs legacy job. We should be good running such
# test in all supported browsers on Saucelabs anyway until this job can be removed.
- name: Preparing Bazel-generated fixtures required in legacy tests
run: |
yarn bazel build //packages/core/test:downleveled_es5_fixture //packages/common/locales
# Needed for the ES5 downlevel reflector test in `packages/core/test/reflection`.
mkdir -p dist/legacy-test-out/core/test/reflection/
cp dist/bin/packages/core/test/reflection/es5_downleveled_inheritance_fixture.js \
dist/legacy-test-out/core/test/reflection/es5_downleveled_inheritance_fixture.js
# Locale files are needed for i18n tests running within Saucelabs. These are added
# directly as sources so that the TypeScript compilation of `/packages/tsconfig.json`
# can succeed. Note that the base locale and currencies files are checked-in, so
# we do not need to re-generate those through Bazel.
mkdir -p packages/common/locales/extra
cp dist/bin/packages/common/locales/*.ts packages/common/locales
cp dist/bin/packages/common/locales/extra/*.ts packages/common/locales/extra
- name: Build bundle of tests to run on Saucelabs
run: node tools/legacy-saucelabs/build-saucelabs-test-bundle.mjs
- name: Wait and confirm Saucelabs tunnel has connected
run: ./tools/saucelabs/sauce-service.sh ready-wait
timeout-minutes: 3
- name: Running tests on Saucelabs.
run: KARMA_WEB_TEST_MODE=SL_REQUIRED yarn karma start ./karma-js.conf.js --single-run
- name: Stop Saucelabs tunnel service
run: ./tools/saucelabs/sauce-service.sh stop
+51 -134
View File
@@ -5,8 +5,6 @@ on:
branches:
- main
- '[0-9]+.[0-9]+.x'
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -23,20 +21,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
node-module-directories: |
./node_modules
./aio/node_modules
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Install node modules in aio
run: yarn install --frozen-lockfile --cwd aio
- name: Check code lint
run: yarn -s tslint
- name: Check code lint in aio
run: yarn -s --cwd aio lint
- name: Check for circular dependencies
run: yarn -s ts-circular-deps:check
- name: Validate pull approve configuration
@@ -45,28 +36,18 @@ jobs:
run: yarn -s ng-dev ngbot verify
- name: Confirm code builds with typescript as expected
run: yarn -s check-tooling-setup
- name: Check commit message
# Commit message validation is only done on pull requests as its too late to validate once
# it has been merged.
if: github.event_name == 'pull_request'
run: yarn ng-dev commit-message validate-range ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
- name: Check code format
# Code formatting checks are only done on pull requests as its too late to validate once
# it has been merged.
if: github.event_name == 'pull_request'
run: yarn ng-dev format changed --check ${{ github.event.pull_request.base.sha }}
devtools:
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Run unit tests
@@ -78,132 +59,47 @@ jobs:
runs-on: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel Remote Caching
uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile --network-timeout 100000
- name: Run CI tests for framework
run: yarn test:ci
aio:
runs-on: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
with:
cache-node-modules: true
node-module-directories: |
./aio/node_modules
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- name: Install node modules for aio
run: yarn install --cwd aio --frozen-lockfile
- name: Run AIO tests with upstream packages
run: yarn --cwd aio test:ci
- name: Check generated bundle sizes
run: yarn --cwd aio payload-size
adev:
runs-on:
labels: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Build adev to ensure it continues to work
run: yarn bazel test --config=aio_local_deps //adev:test
aio-local:
runs-on:
labels: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
with:
cache-node-modules: true
node-module-directories: |
./aio/node_modules
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- name: Install node modules
run: yarn install --cwd aio --frozen-lockfile
- name: Run AIO tests with local packages
run: yarn --cwd aio test-local:ci
- name: Check generated bundle sizes
run: yarn --cwd aio payload-size aio-local
aio-deploy:
needs: [aio]
if: needs.aio.result == 'success' && github.event_name == 'push'
runs-on:
labels: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
with:
cache-node-modules: true
node-module-directories: |
./aio/node_modules
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- name: Install node modules for aio
run: yarn install --cwd aio --frozen-lockfile
- name: Set the stable branch environment variable
id: latest_version
run: |
echo "CI_STABLE_BRANCH=$(npm info @angular/core dist-tags.latest | sed -r 's/^\s*([0-9]+\.[0-9]+)\.[0-9]+.*$/\1.x/')" >> $GITHUB_OUTPUT
echo "CI_BRANCH=$(echo ${{ github.event.ref }} | cut -d '/' -f 3)" >> $GITHUB_OUTPUT
- name: Deploy aio to production
env:
CI_AIO_MIN_PWA_SCORE: '95'
CI_COMMIT: ${{ github.event.after }}
CI_REPO_NAME: 'angular'
CI_PULL_REQUEST: 'false'
CI_REPO_OWNER: 'angular'
CI_BUILD_URL: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
CI_STABLE_BRANCH: ${{ steps.latest_version.outputs.CI_STABLE_BRANCH }}
CI_BRANCH: ${{ steps.latest_version.outputs.CI_BRANCH }}
CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN: ${{ secrets.AIO_DEPLOY_TOKEN }}
CI_SECRET_PAYLOAD_FIREBASE_TOKEN: ${{ secrets.AIO_PAYLOAD_TOKEN }}
run: yarn --cwd aio deploy-production
- name: Notify about failed deployment
if: ${{ failure() }}
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v=v1.24.0
with:
channel-id: 'C07DT5M6V,CKV1F72BG'
slack-message: 'Deploy to aio job failed for ${{ github.base_ref }} branch failed on build ${{ github.event.after }}: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
env:
SLACK_BOT_TOKEN: ${{ secrets.ANGULAR_ROBOT_SLACK_TOKEN }}
- name: Build adev in fast mode to ensure it continues to work
run: yarn bazel build //adev:build --fast_adev --config=release
- name: Run tests
run: yarn bazel test //adev:test
publish-snapshots:
if: github.event_name == 'push'
runs-on:
labels: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile
- run: echo "https://${{secrets.SNAPSHOT_BUILDS_GITHUB_TOKEN}}:@github.com" > ${HOME}/.git_credentials
@@ -215,7 +111,7 @@ jobs:
labels: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
node-module-directories: |
@@ -223,9 +119,9 @@ jobs:
./packages/zone.js/node_modules
./packages/zone.js/test/typings/node_modules
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile
- run: |
@@ -235,9 +131,11 @@ jobs:
//packages/zone.js/test/closure:closure_js \
- run: |
rm -Rf packages/zone.js/build
rm -Rf packages/zone.js/test/extra/*.umd.js
mkdir -p packages/zone.js/build/
mkdir -p packages/zone.js/build/test/
mkdir -p packages/zone.js/test/
cp dist/bin/packages/zone.js/bundles/zone.umd.js packages/zone.js/build/zone.umd.js
cp dist/bin/packages/zone.js/npm_package/bundles/zone-mix.umd.js ./packages/zone.js/test/extra/
@@ -255,31 +153,50 @@ jobs:
- run: yarn --cwd packages/zone.js/test/typings test
bazel-saucelabs:
# TODO: Replace legacy job with Bazel saucelabs job.
if: github.event_name == 'push'
runs-on: ubuntu-latest-4core
env:
JOBS: 2
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
# Checking out the pull request commit is intended here as we need to run the changed code tests.
ref: ${{ github.event.pull_request.head.sha }}
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel Remote Caching
uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Saucelabs Variables
uses: angular/dev-infra/github-actions/saucelabs@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Set up Sauce Tunnel Daemon
run: yarn bazel run //tools/saucelabs-daemon/background-service -- $JOBS &
env:
SAUCE_TUNNEL_IDENTIFIER: angular-framework-${{ github.run_number }}
SAUCE_USERNAME: ${{ vars.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
- name: Run all saucelabs bazel tests
run: |
TESTS=$(./node_modules/.bin/bazelisk query --output label '(kind(karma_web_test, ...) intersect attr("tags", "saucelabs", ...)) except attr("tags", "fixme-saucelabs", ...)')
yarn bazel test --config=saucelabs --jobs=$JOBS ${TESTS}
adev-deploy:
needs: [adev]
if: needs.adev.result == 'success'
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Build adev to ensure it continues to work
run: yarn bazel build //adev:build --config=release
- name: Deploy to firebase
uses: ./.github/actions/deploy-docs-site
with:
serviceKey: ${{ secrets.ANGULAR_DEV_SITE_DEPLOY }}
githubReleaseTrainReadToken: ${{ secrets.DOCS_DEPLOY_GITHUB_RELEASE_TRAIN_TOKEN }}
configPath: 'adev/firebase.json'
distDir: 'dist/bin/adev/build/browser'
+4 -4
View File
@@ -12,14 +12,14 @@ jobs:
labels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: angular/dev-infra/github-actions/commit-message-based-labels@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: angular/dev-infra/github-actions/commit-message-based-labels@11bd341a82719997a59039363f716bea76b88459
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}
post_approval_changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: angular/dev-infra/github-actions/post-approval-changes@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: angular/dev-infra/github-actions/post-approval-changes@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}
-19
View File
@@ -1,19 +0,0 @@
name: Feature request triage bot
on:
schedule:
# Run at 14:00 every day
- cron: '0 14 * * *'
# Declare default permissions as read only.
permissions:
contents: read
jobs:
feature_triage:
if: github.repository == 'angular/angular'
runs-on: ubuntu-latest
steps:
- uses: angular/dev-infra/github-actions/feature-request@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}
+2 -2
View File
@@ -13,8 +13,8 @@ jobs:
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: angular/dev-infra/github-actions/google-internal-tests@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: angular/dev-infra/github-actions/google-internal-tests@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
run-tests-guide-url: http://go/angular-g3sync-start
github-token: ${{ secrets.GITHUB_TOKEN }}
+1 -1
View File
@@ -9,6 +9,6 @@ jobs:
status:
runs-on: ubuntu-latest
steps:
- uses: angular/dev-infra/github-actions/unified-status-check@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- uses: angular/dev-infra/github-actions/unified-status-check@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}
-55
View File
@@ -1,55 +0,0 @@
name: Monitoring
on:
schedule:
# Run at 10:00AM every day.
- cron: '0 10 * * *'
permissions: {}
defaults:
run:
shell: bash
jobs:
check_aio:
runs-on: ubuntu-latest
env:
MINIMUM_PWA_SCORE: 95
strategy:
fail-fast: false
matrix:
version: ['https://next.angular.io/', 'https://angular.io/']
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
with:
cache-node-modules: true
node-module-directories: |
./aio/node_modules
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
- name: Install node modules in aio
run: yarn install --frozen-lockfile --cwd aio
- name: Run basic e2e and deployment config tests.
run: yarn --cwd aio test-production-url --test_env=TARGET_URL="${{ matrix.version }}"
- name: Run PWA-score tests.
run: yarn --cwd aio test-pwa-score "${{ matrix.version }}" "${{ env.MINIMUM_PWA_SCORE }}"
- name: Run a11y tests.
run: yarn --cwd aio test-a11y-score "${{ matrix.version }}"
check_contributor_links:
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
with:
cache-node-modules: true
node-module-directories: |
./aio/node_modules
- name: Install node modules in aio
run: yarn install --frozen-lockfile --cwd aio
- name: Check website provided in contributors.json file
run: node aio/scripts/test-external-urls.js
+208
View File
@@ -0,0 +1,208 @@
name: Pull Request
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
defaults:
run:
shell: bash
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Check code lint
run: yarn -s tslint
- name: Check for circular dependencies
run: yarn -s ts-circular-deps:check
- name: Validate pull approve configuration
run: yarn -s ng-dev pullapprove verify
- name: Validate angular robot configuration
run: yarn -s ng-dev ngbot verify
- name: Confirm code builds with typescript as expected
run: yarn -s check-tooling-setup
- name: Check commit message
run: yarn ng-dev commit-message validate-range ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
- name: Check code format
run: yarn ng-dev format changed --check ${{ github.event.pull_request.base.sha }}
- name: Check Package Licenses
uses: angular/dev-infra/github-actions/linting/licenses@515b575bd6650a12353b6039b618cdb808280ad7
devtools:
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Run unit tests
run: yarn devtools:test
- name: Test build
run: yarn devtools:build:chrome
test:
runs-on: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel Remote Caching
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile --network-timeout 100000
- name: Run CI tests for framework
run: yarn test:ci
artifacts:
needs: [test]
if: needs.test.result == 'success'
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel Remote Caching
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile --network-timeout 100000
- name: Run CI tests for framework
run: yarn tsx ./scripts/build/build-packages-dist.mts
- name: Archive build artifacts
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: pr-artifacts-${{ github.event.number }}
path: dist/packages-dist/
adev:
runs-on:
labels: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Build adev in fast mode to ensure it continues to work
run: yarn bazel build //adev:build --fast_adev --config=release
- name: Run tests
run: yarn bazel test //adev:test
zone-js:
runs-on:
labels: ubuntu-latest-4core
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
node-module-directories: |
./node_modules
./packages/zone.js/node_modules
./packages/zone.js/test/typings/node_modules
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Bazel RBE
uses: angular/dev-infra/github-actions/bazel/configure-remote@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Install node modules
run: yarn install --frozen-lockfile
- run: |
yarn bazel build \
//packages/zone.js/bundles:zone.umd.js \
//packages/zone.js:npm_package \
//packages/zone.js/test/closure:closure_js \
- run: |
rm -Rf packages/zone.js/build
rm -Rf packages/zone.js/test/extra/*.umd.js
mkdir -p packages/zone.js/build/
mkdir -p packages/zone.js/build/test/
cp dist/bin/packages/zone.js/bundles/zone.umd.js packages/zone.js/build/zone.umd.js
cp dist/bin/packages/zone.js/npm_package/bundles/zone-mix.umd.js ./packages/zone.js/test/extra/
cp dist/bin/packages/zone.js/npm_package/bundles/zone-patch-electron.umd.js ./packages/zone.js/test/extra/
cp dist/bin/packages/zone.js/test/closure/zone.closure.mjs ./packages/zone.js/build/test/zone.closure.mjs
# Install
- run: yarn --cwd packages/zone.js install --frozen-lockfile --non-interactive
# Run zone.js tools tests
- run: yarn --cwd packages/zone.js promisefinallytest
- run: yarn --cwd packages/zone.js jest:test
- run: yarn --cwd packages/zone.js jest:nodetest
- run: yarn --cwd packages/zone.js electrontest
- run: yarn --cwd packages/zone.js/test/typings install --frozen-lockfile --non-interactive
- run: yarn --cwd packages/zone.js/test/typings test
saucelabs:
runs-on: ubuntu-latest-4core
env:
SAUCE_TUNNEL_IDENTIFIER: angular-framework-${{ github.run_number }}
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
cache-node-modules: true
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Setup Saucelabs Variables
uses: angular/dev-infra/github-actions/saucelabs@03b8a7dffd1205e061f0bee949024ebefc2a6592
- name: Starting Saucelabs tunnel service
run: ./tools/saucelabs/sauce-service.sh run &
# Build test fixtures for a test that rely on Bazel-generated fixtures. Note that disabling
# specific tests which are reliant on such generated fixtures is not an option as SystemJS
# in the Saucelabs legacy job always fetches referenced files, even if the imports would be
# guarded by an check to skip in the Saucelabs legacy job. We should be good running such
# test in all supported browsers on Saucelabs anyway until this job can be removed.
- name: Preparing Bazel-generated fixtures required in legacy tests
run: |
yarn bazel build //packages/core/test:downleveled_es5_fixture //packages/common/locales
# Needed for the ES5 downlevel reflector test in `packages/core/test/reflection`.
mkdir -p dist/legacy-test-out/core/test/reflection/
cp dist/bin/packages/core/test/reflection/es5_downleveled_inheritance_fixture.js \
dist/legacy-test-out/core/test/reflection/es5_downleveled_inheritance_fixture.js
# Locale files are needed for i18n tests running within Saucelabs. These are added
# directly as sources so that the TypeScript compilation of `/packages/tsconfig.json`
# can succeed. Note that the base locale and currencies files are checked-in, so
# we do not need to re-generate those through Bazel.
mkdir -p packages/common/locales/extra
cp dist/bin/packages/common/locales/*.ts packages/common/locales
cp dist/bin/packages/common/locales/extra/*.ts packages/common/locales/extra
- name: Build bundle of tests to run on Saucelabs
run: node tools/legacy-saucelabs/build-saucelabs-test-bundle.mjs
- name: Wait and confirm Saucelabs tunnel has connected
run: ./tools/saucelabs/sauce-service.sh ready-wait
timeout-minutes: 3
- name: Running tests on Saucelabs.
run: KARMA_WEB_TEST_MODE=SL_REQUIRED yarn karma start ./karma-js.conf.js --single-run
- name: Stop Saucelabs tunnel service
run: ./tools/saucelabs/sauce-service.sh stop
+4 -4
View File
@@ -25,12 +25,12 @@ jobs:
steps:
- name: 'Checkout code'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- name: 'Run analysis'
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
with:
results_file: results.sarif
results_format: sarif
@@ -39,7 +39,7 @@ jobs:
# Upload the results as artifacts.
- name: 'Upload artifact'
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: SARIF file
path: results.sarif
@@ -47,6 +47,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: 'Upload to code-scanning'
uses: github/codeql-action/upload-sarif@b374143c1149a9115d881581d29b8390bbcbb59c # v3.22.11
uses: github/codeql-action/upload-sarif@2d790406f505036ef40ecba973cc774a50395aac # v3.25.13
with:
sarif_file: results.sarif
+4 -4
View File
@@ -1,4 +1,4 @@
name: Update AIO Angular CLI help
name: Update ADEV Angular CLI help
on:
workflow_dispatch:
@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# Setting `persist-credentials: false` prevents the github-action account from being the
# account that is attempted to be used for authentication, instead the remote is set to
@@ -28,11 +28,11 @@ jobs:
# This is needed as otherwise the PR creation will fail with `shallow update not allowed` when the forked branch is not in sync.
fetch-depth: 0
- name: Generate CLI help
run: node aio/scripts/update-cli-help/index.mjs
run: node adev/scripts/update-cli-help/index.mjs
env:
ANGULAR_CLI_BUILDS_READONLY_GITHUB_TOKEN: ${{ secrets.ANGULAR_CLI_BUILDS_READONLY_GITHUB_TOKEN }}
- name: Create a PR (if necessary)
uses: angular/dev-infra/github-actions/create-pr-for-changes@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
uses: angular/dev-infra/github-actions/create-pr-for-changes@03b8a7dffd1205e061f0bee949024ebefc2a6592
with:
branch-prefix: update-cli-help
pr-title: 'docs: update Angular CLI help [${{github.ref_name}}]'
-48
View File
@@ -1,48 +0,0 @@
# Update the `events.json` file that powers the [AIO events page](https://angular.io/events) (if
# necessary) and create a pull request.
#
# For more details on the overall process, see
# [aio/scripts/generate-events/README.md](../../aio/scripts/generate-events/README.md).
name: Update AIO events
on:
workflow_dispatch:
inputs: {}
schedule:
# Run every day at 15:00.
- cron: '0 15 * * *'
# Declare default permissions as read only.
permissions:
contents: read
jobs:
update_events:
name: Update `events.json` (if necessary)
if: github.repository == 'angular/angular'
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
# Setting `persist-credentials: false` prevents the github-action account from being the
# account that is attempted to be used for authentication, instead the remote is set to
# an authenticated URL.
persist-credentials: false
# This is needed as otherwise the PR creation will fail with `shallow update not allowed` when the forked branch is not in sync.
fetch-depth: 0
- name: Generate `events.json`
run: node aio/scripts/generate-events/index.mjs --ignore-invalid-dates
- name: Create a PR (if necessary)
uses: angular/dev-infra/github-actions/create-pr-for-changes@ae9155d1083fd8390e98bfe09a5ccf89f0375b52
with:
branch-prefix: docs-update-events
pr-title: 'docs: update events'
pr-description: |
Generated `events.json` with the latest events retrieved from the Firebase DB.
pr-labels: |
action: review
area: docs
target: patch
angular-robot-token: ${{ secrets.ANGULAR_ROBOT_ACCESS_TOKEN }}
+5 -2
View File
@@ -56,8 +56,11 @@ baseline.json
# Husky
.husky/_
aio/content/examples/.DS_Store
# Ignore cache created with the Angular CLI.
.angular/
.angular/
# Ignore AIO files, useful when changing branches
aio/node_modules
aio/out-tsc
-3
View File
@@ -1,6 +1,3 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"
set +e
yarn -s ng-dev commit-message pre-commit-validate --file $1 2>/dev/null
+1 -4
View File
@@ -1,11 +1,8 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"
set +e
yarn -s ng-dev format staged 2>/dev/null
if [ $? -ne 0 ]; then
echo "WARNING: failed to run file formatting (ng-dev format staged)"
fi
exit 0;
-3
View File
@@ -1,6 +1,3 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"
set +e
yarn -s ng-dev commit-message restore-commit-message-draft $1 $2 2>/dev/null
+7 -35
View File
@@ -7,52 +7,24 @@ export const format: FormatConfig = {
'prettier': {
'matchers': [
'**/*.{yaml,yml}',
'devtools/**/*.{js,ts}',
'tools/**/*.{js,ts}',
'modules/**/*.{js,ts}',
'scripts/**/*.{js,ts}',
'packages/animations/**/*.{js,ts}',
'packages/bazel/**/*.{js,ts}',
'packages/benchpress/**/*.{js,ts}',
'packages/elements/**/*.{js,ts}',
'packages/misc/**/*.{js,ts}',
],
},
'clang-format': {
'matchers': [
'**/*.{js,ts}',
// TODO: burn down format failures and remove aio and integration exceptions.
'!aio/**',
'!integration/**',
// Do not format d.ts files as they are generated
'!**/*.d.ts',
// Both third_party and .yarn are directories containing copied code which should
// not be modified.
'!third_party/**',
'!.yarn/**',
// Do not format d.ts files as they are generated
'!**/*.d.ts',
// Do not format generated ng-dev script
'!dev-infra/ng-dev.js',
'!dev-infra/build-worker.js',
// Do not format compliance test-cases since they must match generated code
'!packages/compiler-cli/test/compliance/test_cases/**/*.js',
// Do not format the locale files which are checked-in for Google3, but generated using
// the `generate-locales-tool` from `packages/common/locales`.
'!packages/core/src/i18n/locale_en.ts',
'!packages/common/locales/closure-locale.ts',
'!packages/common/src/i18n/currencies.ts',
// Temporarily disable formatting for adev
'!adev/**',
// Test cases contain non valid code.
'!packages/compiler-cli/test/compliance/test_cases/**/*.{js,ts}',
// Migrated to prettier
'!devtools/**/*.{js,ts}',
'!tools/**/*.{js,ts}',
'!modules/**/*.{js,ts}',
'!scripts/**/*.{js,ts}',
'!packages/animations/**/*.{js,ts}',
'!packages/bazel/**/*.{js,ts}',
'!packages/benchpress/**/*.{js,ts}',
'!packages/elements/**/*.{js,ts}',
'!packages/misc/**/*.{js,ts}',
// Ignore generated javascript file(s)
'!.github/actions/deploy-docs-site/main.js',
],
},
'buildifier': true,
+8 -2
View File
@@ -1,5 +1,12 @@
{
"syncedFilePatterns": ["LICENSE", "modules/benchmarks/**", "packages/**"],
"syncedFilePatterns": [
"LICENSE",
"modules/benchmarks/**",
"packages/**"
],
"separateFilePatterns": [
"packages/core/primitives/**"
],
"alwaysExternalFilePatterns": [
"packages/*",
"packages/bazel/*",
@@ -22,7 +29,6 @@
"packages/docs/**",
"packages/elements/schematics/**",
"packages/examples/**",
"packages/language-service/**",
"packages/localize/**",
"packages/private/**",
"packages/service-worker/**",
+5
View File
@@ -17,4 +17,9 @@ export const pullRequest: PullRequestConfig = {
// the `bazel` package is not considered part of the public API so that features
// can land in patch branches.
targetLabelExemptScopes: ['dev-infra', 'docs-infra', 'bazel'],
// enables specific validations during the pull request merge process
validators: {
assertEnforceTested: true,
assertIsolatedSeparateFiles: true,
},
};
+1 -1
View File
@@ -28,7 +28,7 @@ export const release: ReleaseConfig = {
return performNpmReleaseBuild();
},
releaseNotes: {
hiddenScopes: ['aio', 'bazel', 'dev-infra', 'docs-infra', 'zone.js', 'devtools'],
hiddenScopes: ['bazel', 'dev-infra', 'docs-infra', 'zone.js', 'devtools'],
},
releasePrLabels: ['area: build & ci', 'action: merge', 'PullApprove: disable'],
};
+1 -1
View File
@@ -1 +1 @@
18.13.0
18.20.0
+3 -2
View File
@@ -1,9 +1,10 @@
{
"printWidth": 100,
"tabWidth": 2,
"tabs": false,
"useTabs": false,
"embeddedLanguageFormatting": "off",
"singleQuote": true,
"semicolon": true,
"semi": true,
"quoteProps": "preserve",
"bracketSpacing": false
}
+96 -585
View File
@@ -121,26 +121,13 @@ groups:
contains_any_globs(files, [
'packages/animations/**/{*,.*}',
'packages/platform-browser/animations/**/{*,.*}',
'aio/content/guide/animations.md',
'aio/content/guide/add-an-animation.md',
'aio/content/guide/animate-state-style.md',
'aio/content/guide/animation-api-summary.md',
'aio/content/guide/understanding-angular-animation.md',
'aio/content/examples/animations/**/{*,.*}',
'aio/content/images/guide/animations/**/{*,.*}',
'aio/content/guide/complex-animation-sequences.md',
'aio/content/guide/reusable-animations.md',
'aio/content/guide/route-animations.md',
'aio/content/guide/transition-and-triggers.md',
'aio/content/guide/animations-attach-to-html-template.md',
'aio/content/guide/animation-transition-timing.md'
])
reviewers:
users:
- alxhub
- crisbeto
- ~jelbourn
- jessicajaniuk
- thePunderWoman
# =========================================================
# Framework: Compiler
@@ -152,13 +139,7 @@ groups:
contains_any_globs(files, [
'packages/compiler/**/{*,.*}',
'packages/examples/compiler/**/{*,.*}',
'aio/content/examples/angular-compiler-options/**/{*,.*}',
'packages/compiler-cli/**/{*,.*}',
'aio/content/guide/angular-compiler-options.md',
'aio/content/guide/aot-compiler.md',
'aio/content/guide/aot-metadata-errors.md',
'aio/content/guide/template-typecheck.md',
'aio/content/extended-diagnostics/*.md'
])
reviewers:
users:
@@ -166,8 +147,9 @@ groups:
- AndrewKushnir
- atscott
- crisbeto
- JoostK
- devversion
- dylhunn
- JoostK
# =========================================================
# Framework: Migrations
@@ -182,7 +164,7 @@ groups:
- crisbeto
- devversion
- dylhunn
- jessicajaniuk
- thePunderWoman
- AndrewKushnir
# =========================================================
@@ -192,159 +174,13 @@ groups:
<<: *defaults
conditions:
- >
contains_any_globs(files.exclude("packages/core/schematics/*"), [
contains_any_globs(files.exclude("packages/core/schematics/*").exclude('packages/core/primitives/*'), [
'packages/core/**/{*,.*}',
'packages/examples/core/**/{*,.*}',
'packages/platform-browser/**/{*,.*}',
'packages/examples/platform-browser/**/{*,.*}',
'packages/platform-browser-dynamic/**/{*,.*}',
'packages/docs/**/{*,.*}',
'aio/content/guide/accessibility.md',
'aio/content/examples/accessibility/**/{*,.*}',
'aio/content/guide/architecture-components.md',
'aio/content/guide/architecture-modules.md',
'aio/content/guide/architecture-next-steps.md',
'aio/content/guide/architecture-services.md',
'aio/content/guide/architecture.md',
'aio/content/examples/architecture/**/{*,.*}',
'aio/content/guide/rxjs-interop.md',
'aio/content/images/guide/architecture/**/{*,.*}',
'aio/content/guide/attribute-directives.md',
'aio/content/examples/attribute-directives/**/{*,.*}',
'aio/content/images/guide/attribute-directives/**/{*,.*}',
'aio/content/guide/bootstrapping.md',
'aio/content/examples/bootstrapping/**/{*,.*}',
'aio/content/guide/change-detection.md',
'aio/content/guide/change-detection-zone-pollution.md',
'aio/content/guide/change-detection-slow-computations.md',
'aio/content/guide/change-detection-skipping-subtrees.md',
'aio/content/images/guide/change-detection/**/{*,.*}',
'aio/content/guide/class-binding.md',
'aio/content/guide/cheatsheet.md',
'aio/content/guide/component-interaction.md',
'aio/content/examples/component-interaction/**/{*,.*}',
'aio/content/images/guide/component-interaction/**/{*,.*}',
'aio/content/guide/component-overview.md',
'aio/content/errors/*.md',
'aio/content/examples/errors/**/{*,.*}',
'aio/content/examples/component-overview/**/{*,.*}',
'aio/content/guide/component-styles.md',
'aio/content/guide/developer-guide-overview.md',
'aio/content/guide/view-encapsulation.md',
'aio/content/examples/component-styles/**/{*,.*}',
'aio/content/examples/content-projection/**/{*,.*}',
'aio/content/guide/content-projection.md',
'aio/content/guide/creating-injectable-service.md',
'aio/content/guide/dependency-injection-overview.md',
'aio/content/guide/dependency-injection.md',
'aio/content/examples/dependency-injection/**/{*,.*}',
'aio/content/images/guide/dependency-injection/**/{*,.*}',
'aio/content/guide/dependency-injection-in-action.md',
'aio/content/examples/dependency-injection-in-action/**/{*,.*}',
'aio/content/images/guide/dependency-injection-in-action/**/{*,.*}',
'aio/content/guide/dependency-injection-navtree.md',
'aio/content/guide/dependency-injection-providers.md',
'aio/content/guide/dependency-injection-context.md',
'aio/content/guide/lightweight-injection-tokens.md',
'aio/content/guide/displaying-data.md',
'aio/content/examples/displaying-data/**/{*,.*}',
'aio/content/images/guide/displaying-data/**/{*,.*}',
'aio/content/guide/dynamic-component-loader.md',
'aio/content/examples/dynamic-component-loader/**/{*,.*}',
'aio/content/images/guide/dynamic-component-loader/**/{*,.*}',
'aio/content/guide/example-apps-list.md',
'aio/content/guide/feature-modules.md',
'aio/content/examples/feature-modules/**/{*,.*}',
'aio/content/images/guide/feature-modules/**/{*,.*}',
'aio/content/guide/frequent-ngmodules.md',
'aio/content/images/guide/frequent-ngmodules/**/{*,.*}',
'aio/content/guide/hierarchical-dependency-injection.md',
'aio/content/examples/hierarchical-dependency-injection/**/{*,.*}',
'aio/content/guide/image-directive.md',
'aio/content/guide/image-directive-setup.md',
'aio/content/examples/providers-viewproviders/**/{*,.*}',
'aio/content/examples/resolution-modifiers/**/{*,.*}',
'aio/content/guide/lazy-loading-ngmodules.md',
'aio/content/examples/lazy-loading-ngmodules/**/{*,.*}',
'aio/content/images/guide/lazy-loading-ngmodules/**/{*,.*}',
'aio/content/guide/lifecycle-hooks.md',
'aio/content/examples/lifecycle-hooks/**/{*,.*}',
'aio/content/images/guide/lifecycle-hooks/**/{*,.*}',
'aio/content/examples/ngcontainer/**/{*,.*}',
'aio/content/guide/ngmodules.md',
'aio/content/examples/ngmodules/**/{*,.*}',
'aio/content/guide/ngmodule-api.md',
'aio/content/guide/ngmodule-faq.md',
'aio/content/guide/ngmodule-vs-jsmodule.md',
'aio/content/guide/module-types.md',
'aio/content/guide/template-overview.md',
'aio/content/guide/template-syntax.md',
'aio/content/guide/built-in-template-functions.md',
'aio/content/examples/built-in-template-functions/**/{*,.*}',
'aio/content/guide/event-binding.md',
'aio/content/guide/event-binding-concepts.md',
'aio/content/examples/event-binding/**/{*,.*}',
'aio/content/guide/interpolation.md',
'aio/content/examples/interpolation/**/{*,.*}',
'aio/content/examples/template-syntax/**/{*,.*}',
'aio/content/images/guide/template-syntax/**/{*,.*}',
'aio/content/guide/binding-overview.md',
'aio/content/guide/binding-syntax.md',
'aio/content/examples/binding-syntax/**/{*,.*}',
'aio/content/guide/property-binding.md',
'aio/content/examples/property-binding/**/{*,.*}',
'aio/content/guide/property-binding-best-practices.md',
'aio/content/guide/attribute-binding.md',
'aio/content/examples/attribute-binding/**/{*,.*}',
'aio/content/guide/two-way-binding.md',
'aio/content/examples/two-way-binding/**/{*,.*}',
'aio/content/guide/built-in-directives.md',
'aio/content/guide/directive-composition-api.md',
'aio/content/examples/built-in-directives/**/{*,.*}',
'aio/content/images/guide/built-in-directives/**/{*,.*}',
'aio/content/guide/template-reference-variables.md',
'aio/content/examples/template-reference-variables/**/{*,.*}',
'aio/content/guide/inputs-outputs.md',
'aio/content/examples/inputs-outputs/**/{*,.*}',
'aio/content/images/guide/inputs-outputs/**/{*,.*}',
'aio/content/guide/understanding-template-expr-overview.md',
'aio/content/guide/template-expression-operators.md',
'aio/content/examples/template-expression-operators/**/{*,.*}',
'aio/content/guide/pipes.md',
'aio/content/guide/pipes-custom-data-trans.md',
'aio/content/guide/pipes-overview.md',
'aio/content/guide/pipe-precedence.md',
'aio/content/guide/pipes-transform-data.md',
'aio/content/guide/pipe-template.md',
'aio/content/examples/pipes/**/{*,.*}',
'aio/content/images/guide/pipes/**/{*,.*}',
'aio/content/guide/providers.md',
'aio/content/examples/providers/**/{*,.*}',
'aio/content/images/guide/providers/**/{*,.*}',
'aio/content/guide/singleton-services.md',
'aio/content/guide/sharing-ngmodules.md',
'aio/content/guide/standalone-components.md',
'aio/content/guide/standalone-migration.md',
'aio/content/guide/structural-directives.md',
'aio/content/examples/structural-directives/**/{*,.*}',
'aio/content/guide/svg-in-templates.md',
'aio/content/guide/style-precedence.md',
'aio/content/images/guide/structural-directives/**/{*,.*}',
'aio/content/guide/template-statements.md',
'aio/content/guide/understanding-angular-overview.md',
'aio/content/guide/user-input.md',
'aio/content/examples/user-input/**/{*,.*}',
'aio/content/images/guide/user-input/**/{*,.*}',
'aio/content/guide/view-encapsulation.md',
'aio/content/examples/view-encapsulation/**/{*,.*}',
'aio/content/images/guide/view-encapsulation/**/{*,.*}',
'aio/content/special-elements/**/{*,.*}',
'aio/content/blocks/**/{*,.*}',
'aio/content/guide/hydration.md',
'aio/content/guide/defer.md',
'aio/content/guide/signals.md',
'aio/content/guide/control_flow.md',
'aio/content/examples/injection-token/**/{*,.*}',
])
reviewers:
users:
@@ -352,8 +188,9 @@ groups:
- AndrewKushnir
- atscott
- crisbeto
- devversion
- dylhunn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
# =========================================================
@@ -373,7 +210,7 @@ groups:
- AndrewKushnir
- atscott
- dylhunn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
# =========================================================
@@ -386,23 +223,6 @@ groups:
contains_any_globs(files, [
'packages/common/http/**/{*,.*}',
'packages/examples/http/**/{*,.*}',
'aio/content/guide/understanding-communicating-with-http.md',
'aio/content/guide/http-configure-http-url-parameters.md',
'aio/content/guide/http-handle-request-errors.md',
'aio/content/guide/http-intercept-requests-and-responses.md',
'aio/content/guide/http-interceptor-use-cases.md',
'aio/content/guide/http-make-jsonp-request.md',
'aio/content/guide/http-optimize-server-interaction.md',
'aio/content/guide/http-pass-metadata-to-interceptors.md',
'aio/content/guide/http-request-data-from-server.md',
'aio/content/guide/http-security-xsrf-protection.md',
'aio/content/guide/http-send-data-to-server.md',
'aio/content/guide/http-server-communication.md',
'aio/content/guide/http-setup-server-communication.md',
'aio/content/guide/http-test-requests.md',
'aio/content/guide/http-track-show-request-progress.md',
'aio/content/examples/http/**/{*,.*}',
'aio/content/images/guide/http/**/{*,.*}'
])
reviewers:
users:
@@ -410,7 +230,7 @@ groups:
- AndrewKushnir
- atscott
- dylhunn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
# =========================================================
@@ -422,9 +242,6 @@ groups:
- >
contains_any_globs(files, [
'packages/elements/**/{*,.*}',
'aio/content/examples/elements/**/{*,.*}',
'aio/content/images/guide/elements/**/{*,.*}',
'aio/content/guide/elements.md'
])
reviewers:
users:
@@ -433,7 +250,7 @@ groups:
- andrewseguin
- atscott
- dylhunn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
# =========================================================
@@ -446,22 +263,6 @@ groups:
contains_any_globs(files, [
'packages/forms/**/{*,.*}',
'packages/examples/forms/**/{*,.*}',
'aio/content/guide/forms.md',
'aio/content/examples/forms/**/{*,.*}',
'aio/content/images/guide/forms/**/{*,.*}',
'aio/content/guide/forms-overview.md',
'aio/content/examples/forms-overview/**/{*,.*}',
'aio/content/images/guide/forms-overview/**/{*,.*}',
'aio/content/guide/form-validation.md',
'aio/content/guide/typed-forms.md',
'aio/content/examples/form-validation/**/{*,.*}',
'aio/content/images/guide/form-validation/**/{*,.*}',
'aio/content/guide/dynamic-form.md',
'aio/content/examples/dynamic-form/**/{*,.*}',
'aio/content/images/guide/dynamic-form/**/{*,.*}',
'aio/content/guide/reactive-forms.md',
'aio/content/examples/reactive-forms/**/{*,.*}',
'aio/content/images/guide/reactive-forms/**/{*,.*}'
])
reviewers:
users:
@@ -490,21 +291,6 @@ groups:
'packages/compiler/src/render3/view/i18n/**/{*,.*}',
'packages/compiler-cli/src/extract_i18n.ts',
'packages/localize/**/{*,.*}',
'aio/content/guide/i18n-overview.md',
'aio/content/guide/i18n-common-overview.md',
'aio/content/guide/i18n-common-add-package.md',
'aio/content/guide/i18n-common-locale-id.md',
'aio/content/guide/i18n-common-format-data-locale.md',
'aio/content/guide/i18n-common-prepare.md',
'aio/content/guide/i18n-common-translation-files.md',
'aio/content/guide/i18n-common-merge.md',
'aio/content/guide/i18n-common-deploy.md',
'aio/content/guide/i18n-example.md',
'aio/content/guide/i18n-optional-overview.md',
'aio/content/guide/i18n-optional-manual-runtime-locale.md',
'aio/content/guide/i18n-optional-import-global-variants.md',
'aio/content/guide/i18n-optional-manage-marked-text.md',
'aio/content/examples/i18n/**/{*,.*}'
])
reviewers:
users:
@@ -520,9 +306,6 @@ groups:
- >
contains_any_globs(files, [
'packages/platform-server/**/{*,.*}',
'aio/content/guide/prerendering.md',
'aio/content/guide/ssr.md',
'aio/content/examples/ssr/**/{*,.*}',
])
reviewers:
users:
@@ -531,7 +314,7 @@ groups:
- AndrewKushnir
- atscott
- dylhunn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
# =========================================================
@@ -544,16 +327,6 @@ groups:
contains_any_globs(files, [
'packages/router/**/{*,.*}',
'packages/examples/router/**/{*,.*}',
'aio/content/guide/router.md',
'aio/content/guide/router-tutorial.md',
'aio/content/guide/router-tutorial-toh.md',
'aio/content/guide/routing-overview.md',
'aio/content/guide/router-reference.md',
'aio/content/examples/router-tutorial/**/{*,.*}',
'aio/content/examples/router/**/{*,.*}',
'aio/content/images/guide/router/**/{*,.*}',
'aio/content/guide/routing-with-urlmatcher.md',
'aio/content/examples/routing-with-urlmatcher/**/{*,.*}'
])
reviewers:
users:
@@ -570,15 +343,6 @@ groups:
contains_any_globs(files, [
'packages/service-worker/**/{*,.*}',
'packages/examples/service-worker/**/{*,.*}',
'aio/content/guide/service-worker-getting-started.md',
'aio/content/examples/service-worker-getting-started/**/{*,.*}',
'aio/content/guide/app-shell.md',
'aio/content/guide/service-worker-communications.md',
'aio/content/guide/service-worker-config.md',
'aio/content/guide/service-worker-devops.md',
'aio/content/guide/service-worker-intro.md',
'aio/content/guide/service-worker-notifications.md',
'aio/content/images/guide/service-worker/**/{*,.*}'
])
reviewers:
users:
@@ -595,22 +359,11 @@ groups:
'packages/upgrade/**/{*,.*}',
'packages/common/upgrade/**/{*,.*}',
'packages/examples/upgrade/**/{*,.*}',
'aio/content/guide/upgrade.md',
'aio/content/examples/upgrade-lazy-load-ajs/**/{*,.*}',
'aio/content/examples/upgrade-module/**/{*,.*}',
'aio/content/images/guide/upgrade/**/{*,.*}',
'aio/content/examples/upgrade-phonecat-1-typescript/**/{*,.*}',
'aio/content/examples/upgrade-phonecat-2-hybrid/**/{*,.*}',
'aio/content/examples/upgrade-phonecat-3-final/**/{*,.*}',
'aio/content/guide/upgrade-performance.md',
'aio/content/guide/upgrade-setup.md',
'aio/content/guide/ajs-quick-reference.md',
'aio/content/examples/ajs-quick-reference/**/{*,.*}'
])
reviewers:
users:
- alxhub
- jessicajaniuk
- thePunderWoman
# =========================================================
# Framework: Testing
@@ -621,17 +374,6 @@ groups:
- >
contains_any_globs(files.exclude('packages/compiler-cli/*').exclude('packages/language-service/*').exclude('packages/service-worker/*'), [
'packages/**/testing/**/{*,.*}',
'aio/content/guide/testing.md',
'aio/content/guide/test-debugging.md',
'aio/content/guide/testing-attribute-directives.md',
'aio/content/guide/testing-code-coverage.md',
'aio/content/guide/testing-components-basics.md',
'aio/content/guide/testing-components-scenarios.md',
'aio/content/guide/testing-pipes.md',
'aio/content/guide/testing-services.md',
'aio/content/guide/testing-utility-apis.md',
'aio/content/examples/testing/**/{*,.*}',
'aio/content/images/guide/testing/**/{*,.*}'
])
reviewers:
users:
@@ -639,7 +381,7 @@ groups:
- AndrewKushnir
- atscott
- dylhunn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
# =========================================================
@@ -658,7 +400,7 @@ groups:
- AndrewKushnir
- atscott
- dylhunn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
# =========================================================
@@ -677,7 +419,7 @@ groups:
- AndrewKushnir
- atscott
- dylhunn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
# =========================================================
@@ -695,9 +437,6 @@ groups:
'packages/tsconfig-tsec-base.json',
'packages/tsec-exemption.json',
'tools/tsec.bzl',
'aio/content/guide/security.md',
'aio/content/examples/security/**/{*,.*}',
'aio/content/images/guide/security/**/{*,.*}',
])
reviewers:
users:
@@ -734,13 +473,12 @@ groups:
- >
contains_any_globs(files, [
'packages/language-service/**/{*,.*}',
'aio/content/guide/language-service.md',
'aio/content/images/guide/language-service/**/{*,.*}'
])
reviewers:
users:
- alxhub
- atscott
- dylhunn
# =========================================================
# zone.js
@@ -751,7 +489,6 @@ groups:
- >
contains_any_globs(files, [
'packages/zone.js/**/{*,.*}',
'aio/content/guide/zone.md'
])
reviewers:
users:
@@ -773,7 +510,7 @@ groups:
- atscott
- crisbeto
- dylhunn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
# =========================================================
@@ -808,108 +545,8 @@ groups:
- AndrewKushnir
- atscott
- dylhunn
- jessicajaniuk
- thePunderWoman
- josephperrott
- pkozlowski-opensource
# =========================================================
# Docs: Contributors
# =========================================================
docs-contributors:
<<: *defaults
conditions:
- >
contains_any_globs(files, [
'aio/content/marketing/contributors.json',
'aio/content/images/bios/**/{*,.*}',
])
reviewers:
users:
- MarkTechson
- mgechev
- twerske
# =========================================================
# Docs: Gettings Started & Tutorial
# =========================================================
docs-getting-started-and-tutorial:
<<: *defaults
conditions:
- >
contains_any_globs(files, [
'aio/content/guide/setup-local.md',
'aio/content/images/guide/setup-local/**/{*,.*}',
'aio/content/tutorial/**/{*,.*}',
'aio/content/images/guide/toh/**/{*,.*}',
'aio/content/demos/first-app/**/{*,.*}',
'aio/content/examples/first-app-*/**/{*,.*}',
'aio/content/images/guide/faa/**/{*,.*}',
'aio/content/examples/toh-pt0/**/{*,.*}',
'aio/content/examples/toh-pt1/**/{*,.*}',
'aio/content/examples/toh-pt2/**/{*,.*}',
'aio/content/examples/toh-pt3/**/{*,.*}',
'aio/content/examples/toh-pt4/**/{*,.*}',
'aio/content/examples/toh-pt5/**/{*,.*}',
'aio/content/examples/toh-pt6/**/{*,.*}',
'aio/content/examples/getting-started-v0/**/{*,.*}',
'aio/content/examples/getting-started/**/{*,.*}',
'aio/content/start/**/{*,.*}',
'aio/content/guide/quick-start.md',
'aio/content/images/guide/start/**/{*,.*}',
'aio/content/examples/what-is-angular/**/{*,.*}',
'aio/content/guide/what-is-angular.md'
])
reviewers:
users:
- AndrewKushnir
- jessicajaniuk
# =========================================================
# Docs: Marketing
# =========================================================
docs-marketing:
<<: *defaults
conditions:
- >
contains_any_globs(files.exclude("aio/content/marketing/contributors.json"), [
'aio/content/examples/marketing-first-app/**/{*,.*}',
'aio/content/guide/roadmap.md',
'aio/content/marketing/**/{*,.*}',
'aio/content/images/marketing/**/{*,.*}',
'aio/content/file-not-found.md',
'aio/content/license.md',
'aio/content/navigation.json'
])
reviewers:
users:
- MarkTechson
- mgechev
- twerske
# =========================================================
# Docs: Observables
# =========================================================
docs-observables:
<<: *defaults
conditions:
- >
contains_any_globs(files, [
'aio/content/guide/observables.md',
'aio/content/examples/observables/**/{*,.*}',
'aio/content/guide/comparing-observables.md',
'aio/content/examples/comparing-observables/**/{*,.*}',
'aio/content/guide/observables-in-angular.md',
'aio/content/examples/observables-in-angular/**/{*,.*}',
'aio/content/guide/practical-observable-usage.md',
'aio/content/examples/practical-observable-usage/**/{*,.*}',
'aio/content/guide/rx-library.md',
'aio/content/examples/rx-library/**/{*,.*}'
])
reviewers:
users:
- alxhub
- atscott
- dylhunn
# =========================================================
# Docs: Packaging, Tooling, Releasing
@@ -919,47 +556,16 @@ groups:
conditions:
- >
contains_any_globs(files, [
'docs/PUBLIC_API.md',
'docs/RELEASE_SCHEDULE.md',
'aio/content/guide/npm-packages.md',
'aio/content/guide/browser-support.md',
'aio/content/guide/releases.md',
'aio/content/guide/updating.md',
'aio/content/guide/deprecations.md',
'aio/content/examples/deprecation-guide/**/{*,.*}',
'aio/content/guide/migration-module-with-providers.md',
'aio/content/guide/static-query-migration.md',
'aio/content/guide/update-to-latest-version.md',
'aio/content/guide/versions.md',
'aio/content/guide/update-to-version-14.md',
'aio/content/guide/update-to-version-15.md',
'aio/content/guide/update-to-version-16.md',
'contributing-docs/public-api-surface.md',
])
reviewers:
users:
- alxhub
- AndrewKushnir
- atscott
- jessicajaniuk
- thePunderWoman
- jelbourn
# =========================================================
# Docs: Angular DevTools
# =========================================================
docs-devtools:
<<: *defaults
conditions:
- >
contains_any_globs(files, [
'aio/content/guide/devtools.md',
'aio/content/images/guide/devtools/**/{*,.*}'
])
reviewers:
users:
- MarkTechson
- mgechev
- twerske
# =========================================================
# Tooling: Compiler API shared with Angular CLI
#
@@ -983,80 +589,6 @@ groups:
required: 2 # require at least 2 approvals
reviewed_for: required
# =========================================================
# Docs: CLI
# =========================================================
docs-cli:
<<: *defaults
conditions:
- >
contains_any_globs(files, [
'aio/content/cli/**/{*,.*}',
'aio/content/guide/typescript-configuration.md',
'aio/content/examples/setup/**/{*,.*}',
'aio/content/guide/build.md',
'aio/content/images/guide/build/**/{*,.*}',
'aio/content/images/guide/cli/**/{*,.*}',
'aio/content/guide/cli-builder.md',
'aio/content/examples/cli-builder/**/{*,.*}',
'aio/content/guide/deployment.md',
'aio/content/images/guide/deployment/**/{*,.*}',
'aio/content/guide/file-structure.md',
'aio/content/guide/ivy.md',
'aio/content/guide/strict-mode.md',
'aio/content/guide/web-worker.md',
'aio/content/guide/workspace-config.md',
'aio/content/guide/migration-solution-style-tsconfig.md',
'aio/content/guide/migration-update-libraries-tslib.md',
'aio/content/guide/esbuild.md',
])
reviewers:
users:
- alan-agius4
- clydin
- dgp1130
- mgechev
# =========================================================
# Docs: CLI Libraries
# =========================================================
docs-libraries:
<<: *defaults
conditions:
- >
contains_any_globs(files, [
'aio/content/examples/angular-linker-plugin/webpack.config.mjs',
'aio/content/guide/creating-libraries.md',
'aio/content/guide/libraries.md',
'aio/content/guide/using-libraries.md',
'aio/content/guide/angular-package-format.md'
])
reviewers:
users:
- alan-agius4
- alxhub
- mgechev
# =========================================================
# Docs: Schematics
# =========================================================
docs-schematics:
<<: *defaults
conditions:
- >
contains_any_globs(files, [
'aio/content/guide/schematics.md',
'aio/content/guide/schematics-authoring.md',
'aio/content/guide/schematics-for-libraries.md',
'aio/content/images/guide/schematics/**/{*,.*}',
'aio/content/examples/schematics-for-libraries/**/{*,.*}'
])
reviewers:
users:
- alan-agius4
- dylhunn
- mgechev
# =========================================================
# Docs: Angular Dev Site
# =========================================================
@@ -1065,72 +597,23 @@ groups:
conditions:
- >
contains_any_globs(files, [
'adev/**/{.*,*}'
'adev/**/{.*,*}',
'aio/**/{.*,*}'
])
reviewers:
users:
- twerske
- josephperrott
- jelbourn
# =========================================================
# Docs-infra
# =========================================================
docs-infra:
<<: *defaults
conditions:
- >
contains_any_globs(files, [
'aio/{*,.*}',
'aio/aio-builds-setup/**/{*,.*}',
'aio/content/cli-src/**/{*,.*}',
'aio/content/examples/{*,.*}',
'aio/scripts/**/{*,.*}',
'aio/src/**/{*,.*}',
'aio/tests/**/{*,.*}',
'aio/tools/**/{*,.*}',
'aio/tools/examples/shared/boilerplate/cli/.vscode/**/{*,.*}',
'aio/content/BUILD.bazel',
'aio/content/images/guide/contributors-guide/**/{*,.*}',
'aio/content/guide/contributors-guide-overview.md',
'aio/content/guide/docs-style-guide.md',
'aio/content/examples/docs-style-guide/**/{*,.*}',
'aio/content/images/guide/docs-style-guide/**/{*,.*}',
'aio/content/guide/docs-lint-errors.md',
'aio/content/images/guide/docs-lint-errors/**/{*,.*}',
'aio/content/guide/localized-documentation.md',
'aio/content/guide/localizing-angular.md',
'aio/content/guide/reviewing-content.md',
'aio/content/guide/updating-content-github-ui.md',
'aio/content/guide/updating-search-keywords.md',
'aio/content/guide/doc-build-test.md',
'aio/content/guide/doc-edit-finish.md',
'aio/content/guide/doc-editing.md',
'aio/content/guide/doc-github-tasks.md',
'aio/content/guide/doc-pr-open.md',
'aio/content/guide/doc-pr-prep.md',
'aio/content/guide/doc-pr-update.md',
'aio/content/guide/doc-prepare-to-edit.md',
'aio/content/guide/doc-select-issue.md',
'aio/content/guide/doc-tasks.md',
'aio/content/guide/doc-update-overview.md',
'aio/content/guide/doc-update-start.md',
'aio/content/guide/docs-lint-errors.md',
'aio/content/images/guide/preparing-to-edit-docs/**/{*,.*}',
'aio/content/images/guide/github-for-docs/**/{*,.*}',
'aio/content/images/guide/doc-update-start/**/{*,.*}',
'aio/content/images/guide/doc-update-overview/**/{*,.*}',
'aio/content/images/guide/doc-pr-update/**/{*,.*}',
'aio/content/images/guide/doc-pr-prep/**/{*,.*}',
'aio/content/images/guide/doc-pr-open/**/{*,.*}',
'aio/content/images/guide/doc-github-tasks/**/{*,.*}',
'aio/content/images/guide/doc-prepare-to-edit/**/{*,.*}',
])
reviewers:
users:
- bencodezen
- thePunderWoman
- dylhunn
- AndrewKushnir
- jessicajaniuk
- josephperrott
- alxhub
- crisbeto
- devversion
- atscott
- pkozlowski-opensource
- ~JeanMeche
# =========================================================
# Angular DevTools
@@ -1150,7 +633,7 @@ groups:
- josephperrott
- mgechev
- twerske
- ~jeanmeche
- ~JeanMeche
# =========================================================
# Dev-infra
@@ -1168,8 +651,8 @@ groups:
'.ng-dev/**/{*,.*}',
'.vscode/**/{*,.*}',
'.yarn/**/{*,.*}',
'docs/*.md',
'docs/images/**/{*,.*}',
'contributing-docs/*.md',
'contributing-docs/images/**/{*,.*}',
'goldens/{*,.*}',
'goldens/public-api/manage.js',
'modules/{*,.*}',
@@ -1214,12 +697,6 @@ groups:
- >
contains_any_globs(files.exclude("goldens/public-api/manage.js"), [
'goldens/public-api/**/{*,.*}',
'docs/NAMING.md',
'aio/content/guide/angular-package-format.md',
'aio/content/guide/glossary.md',
'aio/content/guide/styleguide.md',
'aio/content/examples/styleguide/**/{*,.*}',
'aio/content/images/guide/styleguide/{*,.*}'
])
reviewers:
users:
@@ -1228,8 +705,11 @@ groups:
- atscott
- dylhunn
- ~jelbourn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
- ~iteriani
- ~tbondwilkinson
- ~rahatarmanahmed
reviews:
request: 3 # Request reviews from 3 people
required: 2 # Require that 2 people approve
@@ -1254,7 +734,7 @@ groups:
- atscott
- dylhunn
- ~jelbourn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
reviews:
request: 2 # Request reviews from 2 people
@@ -1280,7 +760,7 @@ groups:
- atscott
- dylhunn
- ~jelbourn
- jessicajaniuk
- thePunderWoman
- pkozlowski-opensource
####################################################################################
@@ -1304,9 +784,61 @@ groups:
- andrewseguin
- dgp1130
- ~jelbourn
- jessicajaniuk
- thePunderWoman
- josephperrott
# =========================================================
# Primitives
# =========================================================
# Angular team required reviews
primitives:
<<: *defaults
conditions:
- >
contains_any_globs(files, [
'packages/core/primitives/**/{*,.*}',
])
reviewers:
users:
- pkozlowski-opensource # Pawel Kozlowski
- alxhub # Alex Rickabaugh
- thePunderWoman # Jessica Janiuk
- dylhunn # Dylan Hunn
- AndrewKushnir # Andrew Kushnir
- atscott # Andrew Scott
labels:
pending: 'requires: TGP'
approved: 'requires: TGP'
rejected: 'requires: TGP'
# External team required reviews
primitives-shared:
<<: *defaults
conditions:
- >
contains_any_globs(files, [
'packages/core/primitives/**/{*,.*}',
])
reviewers:
users:
- csmick # Cameron Smick
- lannka # Hongfei Ding
- eduhmc # Eduardo Huerta-Mercado
- ehlemur # Edward Lesmes
- ellenyuan # Ellen Yuan
- jatraman # Jatin Ramanathan
- jesse-good # Jesse Costello-Good
- mturco # Matt Turco
- neonstalwart # Ben Hockey
- iteriani # Thomas Nguyen
- tbondwilkinson # Tom Wilkinson
- rahatarmanahmed # Rahat Ahmed
labels:
pending: 'requires: TGP'
approved: 'requires: TGP'
rejected: 'requires: TGP'
####################################################################################
# Override managed result groups
#
@@ -1383,27 +915,6 @@ groups:
author_value: 0 # The author of the PR cannot provide an approval for themself
reviewed_for: ignored # All reviews apply to this group whether noted via Reviewed-for or not
reviewers:
users:
- alan-agius4 # Alan Agius
- AleksanderBodurri # Aleksander Bodurri
- alxhub # Alex Rickabaugh
- AndrewKushnir # Andrew Kushnir
- andrewseguin # Andrew Seguin
- atscott # Andrew Scott
- clydin # Charles Lyding
- crisbeto # Kristiyan Kostadinov
- devversion # Paul Gschwendtner
- dgp1130 # Doug Parker
- dylhunn # Dylan Hunn
- jeanmeche # Matthieu Riegler
- jelbourn # Jeremy Elbourn
- jessicajaniuk # Jessica Janiuk
- JiaLiPassion # Jia Li
- JoostK # Joost Koehoorn
- josephperrott # Joey Perrott
- MarkTechson # Mark Thompson (Techson)
- mgechev # Minko Gechev
- mmalerba # Miles Malerba
- pkozlowski-opensource # Pawel Kozlowski
- twerske # Emma Twersky
- zarend # Zach Arend
teams:
# Any member of the team can provide a review to perform the minimum review required
- team
-6
View File
@@ -5,12 +5,6 @@
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"BazelBuild.vscode-bazel",
"gkalpak.aio-docs-utils",
"ms-vscode.vscode-typescript-tslint-plugin",
"xaver.clang-format",
// The following extensions are useful when working on angular.io (i.e. inside the `aio/` directory).
//"angular.ng-template",
//"dbaeumer.vscode-eslint",
//"errata-ai.vale-server",
],
}
-8
View File
@@ -1,16 +1,10 @@
{
// Format js and ts files on save with `clang-format.executable`
// If `clang-format.executable` is not being used, these two settings should be removed otherwise it will break existing formatting.
// You can instead run `yarn gulp format` to manually format your code.
"[javascript]": {
"editor.formatOnSave": true,
},
"[typescript]": {
"editor.formatOnSave": true,
},
// Please install https://marketplace.visualstudio.com/items?itemName=xaver.clang-format to take advantage of `clang-format` in VSCode.
// (See https://clang.llvm.org/docs/ClangFormat.html for more info `clang-format`.)
"clang-format.executable": "${workspaceRoot}/node_modules/.bin/clang-format",
// Exclude third party modules and build artifacts from the editor watchers/searches.
"files.watcherExclude": {
"**/.git/objects/**": true,
@@ -18,14 +12,12 @@
"**/node_modules/**": true,
"**/bazel-out/**": true,
"**/dist/**": true,
"**/aio/src/generated/**": true,
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/bazel-out": true,
"**/dist": true,
"**/aio/src/generated": true,
".history": true,
},
"git.ignoreLimitWarning": true,
-1
View File
@@ -67,7 +67,6 @@ nodejs_binary(
data = [".yarn/releases/yarn-1.22.19.cjs"],
entry_point = ".yarn/releases/yarn-1.22.19.cjs",
visibility = [
"//aio/tools/examples/shared:__pkg__",
"//integration:__subpackages__",
],
)
+840 -22
View File
@@ -1,3 +1,837 @@
<a name="18.1.2"></a>
# 18.1.2 (2024-07-24)
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [463945003d](https://github.com/angular/angular/commit/463945003dcf253c64809ffdcddabedb87e78e06) | fix | limit the number of chained instructions ([#57069](https://github.com/angular/angular/pull/57069)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [e904f34020](https://github.com/angular/angular/commit/e904f3402053ce9098854a31f2652020dd79e8f9) | fix | add warning for unused let declarations ([#57033](https://github.com/angular/angular/pull/57033)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [9e52c1c840](https://github.com/angular/angular/commit/9e52c1c8402dd5a54cf73caafff4a5b81d73fabd) | fix | `afterNextRender` hooks return that callback value. ([#57031](https://github.com/angular/angular/pull/57031)) |
| [b9fb98c67c](https://github.com/angular/angular/commit/b9fb98c67c29d8e5697b72788f09f1263e8130f4) | fix | tree shake dev mode error message ([#57035](https://github.com/angular/angular/pull/57035)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="18.1.1"></a>
# 18.1.1 (2024-07-17)
### common
| Commit | Type | Description |
| -- | -- | -- |
| [a1cb9dfc0d](https://github.com/angular/angular/commit/a1cb9dfc0d3539d16020a53dd4c32311240a6265) | fix | Don't run preconnect assertion on the server. ([#56213](https://github.com/angular/angular/pull/56213)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [daf0317bdc](https://github.com/angular/angular/commit/daf0317bdcef79445eead4a3e0e1be75671f43fb) | fix | JIT mode incorrectly interpreting host directive configuration in partial compilation ([#57002](https://github.com/angular/angular/pull/57002)) |
| [d7dca6dbb6](https://github.com/angular/angular/commit/d7dca6dbb6d8afc77a988de0b7471ac4e078762e) | fix | use strict equality for 'code' comparison ([#56944](https://github.com/angular/angular/pull/56944)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [c94a897248](https://github.com/angular/angular/commit/c94a8972488f62656f5d0368b8763776e2cd39c6) | fix | avoid emitting references to typecheck files in TS 5.4 ([#56961](https://github.com/angular/angular/pull/56961)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [5682527d94](https://github.com/angular/angular/commit/5682527d949b078e92ff7588c7e25dad37fffc52) | fix | not all callbacks running when registered at the same time ([#56981](https://github.com/angular/angular/pull/56981)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [b666d2c20f](https://github.com/angular/angular/commit/b666d2c20f932f435fa6c51e1d74d7bca53381f2) | fix | fix common module removal ([#56968](https://github.com/angular/angular/pull/56968)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="18.1.0"></a>
# 18.1.0 (2024-07-10)
### common
| Commit | Type | Description |
| -- | -- | -- |
| [f25653e231](https://github.com/angular/angular/commit/f25653e2311152d30b14d25acb0dccb4e2b5ea56) | fix | typo in NgOptimizedImage warning ([#56756](https://github.com/angular/angular/pull/56756)) |
| [9b35726e42](https://github.com/angular/angular/commit/9b35726e42ebdeed138a25581e0a7eefff466206) | fix | typo in warning for NgOptimizedDirective ([#56817](https://github.com/angular/angular/pull/56817)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [fd6cd0422d](https://github.com/angular/angular/commit/fd6cd0422d2d761d2c6cc0cd41838fbba8a3f010) | feat | Add extended diagnostic to warn when there are uncalled functions in event bindings ([#56295](https://github.com/angular/angular/pull/56295)) |
| [341a116d61](https://github.com/angular/angular/commit/341a116d611c095ed414c82612adb529e7be310c) | fix | allow more characters in let declaration name ([#56764](https://github.com/angular/angular/pull/56764)) |
| [2a1291e942](https://github.com/angular/angular/commit/2a1291e942a3cd645ee635e72e7d83722383d39b) | fix | give precedence to local let declarations over parent ones ([#56752](https://github.com/angular/angular/pull/56752)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [66e582551e](https://github.com/angular/angular/commit/66e582551eb081e422e0df41badce1821c46dc62) | fix | avoid duplicate diagnostics for let declarations read before definition ([#56843](https://github.com/angular/angular/pull/56843)) |
| [4d18c5bfd5](https://github.com/angular/angular/commit/4d18c5bfd54c53655955c8cd90472081ade40b34) | fix | flag all conflicts between let declarations and local symbols ([#56752](https://github.com/angular/angular/pull/56752)) |
| [9e21582456](https://github.com/angular/angular/commit/9e215824565f0d30da7edb20087c4460069a6660) | fix | Show template syntax errors in local compilation modified ([#55855](https://github.com/angular/angular/pull/55855)) |
| [5996502921](https://github.com/angular/angular/commit/599650292107f8856c7cd41791bd0856f9d14eb1) | fix | type check let declarations nested inside nodes ([#56752](https://github.com/angular/angular/pull/56752)) |
| [cdebf751e4](https://github.com/angular/angular/commit/cdebf751e4949048b01acc92de2517f46fcd5d37) | fix | used before declared diagnostic not firing for control flow blocks ([#56843](https://github.com/angular/angular/pull/56843)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [ea3c802056](https://github.com/angular/angular/commit/ea3c80205653af109c688a4d4808143b34591d54) | feat | Add a schematic to migrate afterRender phase flag ([#55648](https://github.com/angular/angular/pull/55648)) |
| [5df3e78c99](https://github.com/angular/angular/commit/5df3e78c9907f522f2f96c087b10ca12d57f7028) | feat | add equality function to rxjs-interop `toSignal` ([#56447](https://github.com/angular/angular/pull/56447)) |
| [0a48d584f2](https://github.com/angular/angular/commit/0a48d584f2ffeebb9402032182d4fc13a260c5cf) | feat | add support for let syntax ([#56715](https://github.com/angular/angular/pull/56715)) |
| [352e0782ec](https://github.com/angular/angular/commit/352e0782ec37d2adcc662cfc69c83d38058a34bf) | feat | expose signal input metadata in `ComponentMirror` ([#56402](https://github.com/angular/angular/pull/56402)) |
| [a655e46447](https://github.com/angular/angular/commit/a655e46447962bf56bf0184e3104328b9f7c1531) | feat | Redesign the `afterRender` & `afterNextRender` phases API ([#55648](https://github.com/angular/angular/pull/55648)) |
| [e5a6f91722](https://github.com/angular/angular/commit/e5a6f917225aafa7c5c860f280d2aafe3615727e) | feat | support TypeScript 5.5 ([#56096](https://github.com/angular/angular/pull/56096)) |
| [38effcc63e](https://github.com/angular/angular/commit/38effcc63eea360e948dc22860add72d3aa02288) | fix | Add back phase flag option as a deprecated API ([#55648](https://github.com/angular/angular/pull/55648)) |
| [86bcfd3e49](https://github.com/angular/angular/commit/86bcfd3e498b8ec1de1a2a1ad0847fe567f7e9d4) | fix | improve docs on afterRender hooks ([#56522](https://github.com/angular/angular/pull/56522)) |
| [b2445a0953](https://github.com/angular/angular/commit/b2445a095314aa66da038d3093e6a1b18fe5768b) | fix | link errors to ADEV ([#55554](https://github.com/angular/angular/pull/55554)) ([#56038](https://github.com/angular/angular/pull/56038)) |
| [03a2acd2a3](https://github.com/angular/angular/commit/03a2acd2a3bdc87aaeb6b835a7c1016f800b31cb) | fix | properly remove imports in the afterRender phase migration ([#56524](https://github.com/angular/angular/pull/56524)) |
| [4d87b9e899](https://github.com/angular/angular/commit/4d87b9e899381894a1de90f251da58613a96eed0) | fix | rename the equality function option in toSignal ([#56769](https://github.com/angular/angular/pull/56769)) ([#56922](https://github.com/angular/angular/pull/56922)) |
| [8bd4c074af](https://github.com/angular/angular/commit/8bd4c074afe85b739dff4d3c4dcc19384c42b85e) | fix | toSignal equal option should be passed to inner computed ([#56903](https://github.com/angular/angular/pull/56903)) |
### forms
| Commit | Type | Description |
| -- | -- | -- |
| [00bde8b1c2](https://github.com/angular/angular/commit/00bde8b1c2d1511da40526a374d4e94d31e0d575) | fix | Make `NgControlStatus` host bindings `OnPush` compatible ([#55720](https://github.com/angular/angular/pull/55720)) |
### http
| Commit | Type | Description |
| -- | -- | -- |
| [cc21989132](https://github.com/angular/angular/commit/cc21989132bc64b981df83cb6ff6e1506b42a1d0) | fix | Make `Content-Type` header case insensitive ([#56541](https://github.com/angular/angular/pull/56541)) |
### language-service
| Commit | Type | Description |
| -- | -- | -- |
| [b400e2e4d4](https://github.com/angular/angular/commit/b400e2e4d4c27a9c8d8e91b52852ef7b64f7591a) | feat | autocompletion for the component not imported ([#55595](https://github.com/angular/angular/pull/55595)) |
| [67b2c336bc](https://github.com/angular/angular/commit/67b2c336bc0bdce3f7ae054c094990a9831f5b20) | fix | import the default exported component correctly ([#56432](https://github.com/angular/angular/pull/56432)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [a13f5da773](https://github.com/angular/angular/commit/a13f5da77303f4ab2f1543df1de1f416216b5a9c) | feat | Allow `UrlTree` as an input to `routerLink` ([#56265](https://github.com/angular/angular/pull/56265)) |
| [1d3a7529b4](https://github.com/angular/angular/commit/1d3a7529b4fa3617a5d6a97e742cb13818253a14) | feat | Set a different browser URL from the one for route matching ([#53318](https://github.com/angular/angular/pull/53318)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="18.0.5"></a>
# 18.0.5 (2024-06-26)
### core
| Commit | Type | Description |
| -- | -- | -- |
| [2f73281dfd](https://github.com/angular/angular/commit/2f73281dfd97fd254179770cbdbda5236f5f37fd) | fix | improve docs on afterRender hooks ([#56525](https://github.com/angular/angular/pull/56525)) |
| [be9e4892f9](https://github.com/angular/angular/commit/be9e4892f9d2e3dbc772b732a130f97d67cba965) | fix | improve support for i18n hydration of projected content ([#56192](https://github.com/angular/angular/pull/56192)) |
| [5f9bd5521e](https://github.com/angular/angular/commit/5f9bd5521eaadb4106c43eb2f8e7ac25777e9ea6) | fix | prevent calling devMode only function on `@defer` error. ([#56559](https://github.com/angular/angular/pull/56559)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="18.0.4"></a>
# 18.0.4 (2024-06-20)
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [ec0d1bf6f3](https://github.com/angular/angular/commit/ec0d1bf6f337fc4f2c29cacaa6ca5b915eb4e561) | fix | insert constant statements after the first group of imports ([#56431](https://github.com/angular/angular/pull/56431)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [83ffa94783](https://github.com/angular/angular/commit/83ffa9478372db3e5dd2d256d266a5612008da0a) | fix | do not activate event replay when no events are registered ([#56509](https://github.com/angular/angular/pull/56509)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [5578681da2](https://github.com/angular/angular/commit/5578681da27345b0c8260eb5d73e702d19581abd) | fix | Delay the view transition to ensure renders in microtasks complete ([#56494](https://github.com/angular/angular/pull/56494)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="18.0.3"></a>
# 18.0.3 (2024-06-12)
### benchpress
| Commit | Type | Description |
| -- | -- | -- |
| [ebf00aa0659](https://github.com/angular/angular/commit/ebf00aa06592a966b72c81ff4ca09c6ef1344a20) | fix | adjust supported browser names for headless chrome ([#56360](https://github.com/angular/angular/pull/56360)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [dbd0fa00f8c](https://github.com/angular/angular/commit/dbd0fa00f8c742a9b804ce2a96a0add552a179dd) | fix | async EventEmitter should contribute to app stability ([#56308](https://github.com/angular/angular/pull/56308)) |
| [625ca3e2b3f](https://github.com/angular/angular/commit/625ca3e2b3f04fb770ecbef03a9a4151c54e201b) | fix | signals should be tracked when embeddedViewRef.detectChanges is called ([#55719](https://github.com/angular/angular/pull/55719)) |
### localize
| Commit | Type | Description |
| -- | -- | -- |
| [d6dd3dbdb09](https://github.com/angular/angular/commit/d6dd3dbdb09da956a7c7c95187ae29347568b2e9) | fix | add `@angular/localize/init` as polyfill in `angular.json` ([#56300](https://github.com/angular/angular/pull/56300)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [c07e1b33569](https://github.com/angular/angular/commit/c07e1b335695ce8e5402e7d7ad7810ccd472b224) | fix | resolve error in standalone migration ([#56302](https://github.com/angular/angular/pull/56302)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="18.0.2"></a>
# 18.0.2 (2024-06-05)
### core
| Commit | Type | Description |
| -- | -- | -- |
| [78cf9bfc0e](https://github.com/angular/angular/commit/78cf9bfc0eb1e78c1f6d3a562e65982579698896) | fix | Do not migrate `HttpClientModule` imports on components. ([#56067](https://github.com/angular/angular/pull/56067)) |
| [616cdef474](https://github.com/angular/angular/commit/616cdef4748d5112460cf58200832585856777d6) | fix | don't coerce all producers to consumers on liveness change ([#56140](https://github.com/angular/angular/pull/56140)) |
| [2a440e1064](https://github.com/angular/angular/commit/2a440e1064bddc839df91dbe77fc27bb8bd15641) | fix | Fix shouldPreventDefaultBeforeDispatching bug ([#56188](https://github.com/angular/angular/pull/56188)) |
| [290a47d842](https://github.com/angular/angular/commit/290a47d8427f4854234cb2b4244871eaf1f82c19) | fix | handle missing `withI18nSupport()` call for components that use i18n blocks ([#56175](https://github.com/angular/angular/pull/56175)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [b70b80ba55](https://github.com/angular/angular/commit/b70b80ba55ff16a5dd10e07c7120b0d3aecd5d2d) | fix | do not generate aliased variables with the same name ([#56154](https://github.com/angular/angular/pull/56154)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="18.0.1"></a>
# 18.0.1 (2024-05-29)
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [419ffa2026](https://github.com/angular/angular/commit/419ffa20265e4b9b5b1d92045ec40f59f5c4de2e) | fix | optimize track function that only passes $index ([#55872](https://github.com/angular/angular/pull/55872)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [4c7efc005a](https://github.com/angular/angular/commit/4c7efc005a8d0d343f437007740254b1d35c718b) | fix | interpolatedSignalNotInvoked diagnostic for class, style, attribute and animation bindings ([#55969](https://github.com/angular/angular/pull/55969)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [4e6ea0e19c](https://github.com/angular/angular/commit/4e6ea0e19c52c9aceb635accb379572c78a457da) | fix | handle elements with local refs in event replay serialization logic ([#56076](https://github.com/angular/angular/pull/56076)) |
| [d73a0175cb](https://github.com/angular/angular/commit/d73a0175cb2d8c74e6bb877dc30eec07fd484fff) | fix | link errors to ADEV ([#55554](https://github.com/angular/angular/pull/55554)) |
| [985a215b10](https://github.com/angular/angular/commit/985a215b102be2a58dd4d13e1c05399f58f3078e) | fix | typo in zoneless warning ([#55974](https://github.com/angular/angular/pull/55974)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [ba85d08158](https://github.com/angular/angular/commit/ba85d081583277a5b7a04bc349a3a8d528467c52) | fix | handle empty ngSwitchCase ([#56105](https://github.com/angular/angular/pull/56105)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.3.10"></a>
# 17.3.10 (2024-05-22)
<!-- CHANGELOG SPLIT MARKER -->
<a name="18.0.0"></a>
# 18.0.0 (2024-05-22)
[Blog post "Angular v18 is now available"](http://goo.gle/angular-v18).
## Breaking Changes
### animations
- Deprecated `matchesElement` method has been removed from `AnimationDriver` as it is unused.
### common
- The deprecated `isPlatformWorkerUi` and `isPlatformWorkerApp` have been removed without replacement, as they serve no purpose since the removal of the WebWorker platform.
### compiler
- Angular only supports writable expressions inside of two-way bindings.
### compiler-cli
- * Angular no longer supports TypeScript versions older than 5.4.
### core
- `OnPush` views at the root of the application need to
be marked dirty for their host bindings to refresh. Previously, the host
bindings were refreshed for all root views without respecting the
`OnPush` change detection strategy.
- `OnPush` views at the root of the application need to
be marked dirty for their host bindings to refresh. Previously, the host
bindings were refreshed for all root views without respecting the
`OnPush` change detection strategy.
- The `ComponentFixture` `autoDetect` feature will no
longer refresh the component's host view when the component is `OnPush`
and not marked dirty. This exposes existing issues in components which
claim to be `OnPush` but do not correctly call `markForCheck` when they
need to be refreshed. If this change causes test failures, the easiest
fix is to change the component to `ChangeDetectionStrategy.Default`.
- `ComponentFixture.whenStable` now matches the
`ApplicationRef.isStable` observable. Prior to this change, stability
of the fixture did not include everything that was considered in
`ApplicationRef`. `whenStable` of the fixture will now include unfinished
router navigations and unfinished `HttpClient` requests. This will cause
tests that `await` the `whenStable` promise to time out when there are
incomplete requests. To fix this, remove the `whenStable`,
instead wait for another condition, or ensure `HttpTestingController`
mocks responses for all requests. Try adding `HttpTestingController.verify()`
before your `await fixture.whenStable` to identify the open requests.
Also, make sure your tests wait for the stability promise. We found many
examples of tests that did not, meaning the expectations did not execute
within the test body.
In addition, `ComponentFixture.isStable` would synchronously switch to
true in some scenarios but will now always be asynchronous.
- Angular will ensure change detection runs, even when the state update originates from
outside the zone, tests may observe additional rounds of change
detection compared to the previous behavior.
This change will be more likely to impact existing unit tests.
This should usually be seen as more correct and the test should be updated,
but in cases where it is too much effort to debug, the test can revert to the old behavior by adding
`provideZoneChangeDetection({schedulingMode: NgZoneSchedulingMode.NgZoneOnly})`
to the `TestBed` providers.
Similarly, applications which may want to update state outside the zone
and _not_ trigger change detection can add
`provideZoneChangeDetection({schedulingMode: NgZoneSchedulingMode.NgZoneOnly})`
to the providers in `bootstrapApplication` or add
`schedulingMode: NgZoneSchedulingMode.NgZoneOnly` to the
`BootstrapOptions` of `bootstrapModule`.
- When Angular runs change detection, it will continue to
refresh any views attached to `ApplicationRef` that are still marked for
check after one round completes. In rare cases, this can result in infinite
loops when certain patterns continue to mark views for check using
`ChangeDetectorRef.detectChanges`. This will be surfaced as a runtime
error with the `NG0103` code.
- `async` has been removed, use `waitForAsync` instead.
- The `ComponentFixture.autoDetect` feature now executes
change detection for the fixture within `ApplicationRef.tick`. This more
closely matches the behavior of how a component would refresh in
production. The order of component refresh in tests may be slightly
affected as a result, especially when dealing with additional components
attached to the application, such as dialogs. Tests sensitive to this
type of change (such as screenshot tests) may need to be updated.
Concretely, this change means that the component will refresh _before_
additional views attached to `ApplicationRef` (i.e. dialog components).
Prior to this change, the fixture component would refresh _after_ other
views attached to the application.
- The exact timing of change detection execution when
using event or run coalescing with `NgZone` is now the first of either
`setTimeout` or `requestAnimationFrame`. Code which relies on this
timing (usually by accident) will need to be adjusted. If a callback
needs to execute after change detection, we recommend `afterNextRender`
instead of something like `setTimeout`.
- Newly created and views marked for check and reattached
during change detection are now guaranteed to be refreshed in that same
change detection cycle. Previously, if they were attached at a location
in the view tree that was already checked, they would either throw
`ExpressionChangedAfterItHasBeenCheckedError` or not be refreshed until
some future round of change detection. In rare circumstances, this
correction can cause issues. We identified one instance that relied on
the previous behavior by reading a value on initialization which was
queued to be updated in a microtask instead of being available in the
current change detection round. The component only read this value during
initialization and did not read it again after the microtask updated it.
- Testability methods `increasePendingRequestCount`,
`decreasePendingRequestCount` and `getPendingRequestCount` have been
removed. This information is tracked with zones.
### http
- By default we now prevent caching of HTTP requests that require authorization . To opt-out from this behaviour use the `includeRequestsWithAuthHeaders` option in `withHttpTransferCache`.
Example:
```ts
withHttpTransferCache({
includeRequestsWithAuthHeaders: true,
})
```
### platform-browser
- Deprecated `StateKey`, `TransferState` and `makeStateKey` have been removed from `@angular/platform-browser`, use the same APIs from `@angular/core`.
### platform-browser-dynamic
- No longer used `RESOURCE_CACHE_PROVIDER` APIs have been removed.
### platform-server
- deprecated `platformDynamicServer` has been removed. Add an `import @angular/compiler` and replace the usage with `platformServer`
- deprecated `ServerTransferStateModule` has been removed. `TransferState` can be use without providing this module.
- deprecated `useAbsoluteUrl` and `baseUrl` been removed from `PlatformConfig`. Provide and absolute `url` instead.
- Legacy handling or Node.js URL parsing has been removed from `ServerPlatformLocation`.
The main differences are;
- `pathname` is always suffixed with a `/`.
- `port` is empty when `http:` protocol and port in url is `80`
- `port` is empty when `https:` protocol and port in url is `443`
### router
- Guards can now return `RedirectCommand` for redirects
in addition to `UrlTree`. Code which expects only `boolean` or `UrlTree`
values in `Route` types will need to be adjusted.
- This change allows `Route.redirectTo` to be a function
in addition to the previous string. Code which expects `redirectTo` to
only be a string on `Route` objects will need to be adjusted.
- When a a guard returns a `UrlTree` as a redirect, the
redirecting navigation will now use `replaceUrl` if the initial
navigation was also using the `replaceUrl` option. If this is not
desirable, the redirect can configure new `NavigationBehaviorOptions` by
returning a `RedirectCommand` with the desired options instead of `UrlTree`.
- Providers available to the routed components always
come from the injector heirarchy of the routes and never inherit from
the `RouterOutlet`. This means that providers available only to the
component that defines the `RouterOutlet` will no longer be available to
route components in any circumstances. This was already the case
whenever routes defined providers, either through lazy loading an
`NgModule` or through explicit `providers` on the route config.
- Providers available to the routed components always
come from the injector heirarchy of the routes and never inherit from
the `RouterOutlet`. This means that providers available only to the
component that defines the `RouterOutlet` will no longer be available to
route components in any circumstances. This was already the case
whenever routes defined providers, either through lazy loading an
`NgModule` or through explicit `providers` on the route config.
## Deprecations
### common
- `getCurrencySymbol`, `getLocaleCurrencyCode`, `getLocaleCurrencyName`, `getLocaleCurrencySymbol`, `getLocaleDateFormat`, `getLocaleDateTimeFormat`, `getLocaleDayNames`, `getLocaleDayPeriods`, `getLocaleDirection`, `getLocaleEraNames`, `getLocaleExtraDayPeriodRules`, `getLocaleExtraDayPeriods`, `getLocaleFirstDayOfWeek`, `getLocaleId`, `getLocaleMonthNames`, `getLocaleNumberFormat`, `getLocaleNumberSymbol`, `getLocalePluralCase`, `getLocaleTimeFormat`, `getLocaleWeekEndRange`, `getNumberOfCurrencyDigits`
### core
- `@Component.interpolation` is deprecated. Use Angular's
delimiters instead.
### http
- `HttpClientModule`, `HttpClientXsrfModule` and `HttpClientJsonpModule`
As mentionned, those modules can be replaced by provider function only.
### animations
| Commit | Type | Description |
| -- | -- | -- |
| [bcce85af72](https://github.com/angular/angular/commit/bcce85af72a82634f60b31d66a5ef42ecd844ce8) | refactor | remove deprecated `matchesElement` from `AnimationDriver` ([#55479](https://github.com/angular/angular/pull/55479)) |
### common
| Commit | Type | Description |
| -- | -- | -- |
| [d34c033902](https://github.com/angular/angular/commit/d34c033902b4e7543796de6c57d0cfd09093eb43) | refactor | Deprecate Local Data API functions ([#54483](https://github.com/angular/angular/pull/54483)) |
| [3b0de30b37](https://github.com/angular/angular/commit/3b0de30b37f558d4815ca9a61db1010aaf3df068) | refactor | remove deprecated `isPlatformWorkerApp` and `isPlatformWorkerUi` API ([#55302](https://github.com/angular/angular/pull/55302)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [91b007e58f](https://github.com/angular/angular/commit/91b007e58ffb91f7c396cbc0333a91d18f02bd27) | fix | add math elements to schema ([#55631](https://github.com/angular/angular/pull/55631)) |
| [33d0102304](https://github.com/angular/angular/commit/33d0102304e2213ee0af0bc86028a4f564c81ed4) | fix | allow comments between connected blocks ([#55966](https://github.com/angular/angular/pull/55966)) |
| [7fc7f3f05f](https://github.com/angular/angular/commit/7fc7f3f05f0139dd773032fd5ad308f8d2a9fcf5) | fix | capture all control flow branches for content projection in if blocks ([#54921](https://github.com/angular/angular/pull/54921)) |
| [a369f43fbd](https://github.com/angular/angular/commit/a369f43fbdf45456bbae1caf71ef7becd15d1e90) | fix | capture switch block cases for content projection ([#54921](https://github.com/angular/angular/pull/54921)) |
| [eb625d3783](https://github.com/angular/angular/commit/eb625d37839c3b9f20a2ffb3af06426f9910c8ac) | fix | declare for loop aliases in addition to new name ([#54942](https://github.com/angular/angular/pull/54942)) |
| [f824911510](https://github.com/angular/angular/commit/f8249115102204dbb957a0d292ed5342ea5108e9) | fix | For `FatalDiagnosticError`, hide the `message` field without affecting the emit ([#55160](https://github.com/angular/angular/pull/55160)) |
| [a040fb720a](https://github.com/angular/angular/commit/a040fb720af7db08b328a9f78511c9881f50482d) | fix | maintain multiline CSS selectors during CSS scoping ([#55509](https://github.com/angular/angular/pull/55509)) |
| [39624c6b12](https://github.com/angular/angular/commit/39624c6b129252af352c22c6d6f12ef153477bfc) | fix | output input flags as a literal ([#55215](https://github.com/angular/angular/pull/55215)) |
| [eba92cfa55](https://github.com/angular/angular/commit/eba92cfa55500f3558c02edd0aa348ae118794e0) | fix | prevent usage of reserved control flow symbol in custom interpolation context. ([#55809](https://github.com/angular/angular/pull/55809)) |
| [7d5bc1c628](https://github.com/angular/angular/commit/7d5bc1c62870d9c68e06eddec229a9b8988e92ee) | fix | remove container index from conditional instruction ([#55190](https://github.com/angular/angular/pull/55190)) |
| [4eb0165750](https://github.com/angular/angular/commit/4eb0165750d8c65812502343a70ef4cc35c725b9) | fix | remove support for unassignable expressions in two-way bindings ([#55342](https://github.com/angular/angular/pull/55342)) |
| [e1650e3b13](https://github.com/angular/angular/commit/e1650e3b13556ab09c919cfdf97913fa0291622c) | fix | throw error if item name and context variables conflict ([#55045](https://github.com/angular/angular/pull/55045)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [5bd188a394](https://github.com/angular/angular/commit/5bd188a394d30053099e2c83fe79136d590e5399) | feat | add partial compilation support for deferred blocks ([#54908](https://github.com/angular/angular/pull/54908)) |
| [b02b31a915](https://github.com/angular/angular/commit/b02b31a915333e680cf96de5d0f965a6e2639028) | feat | drop support for TypeScript older than 5.4 ([#54961](https://github.com/angular/angular/pull/54961)) |
| [78188e877a](https://github.com/angular/angular/commit/78188e877a4db8655bdd3dc5012b70b12a7234de) | fix | add diagnostic if initializer API is used outside of an initializer ([#54993](https://github.com/angular/angular/pull/54993)) |
| [69a83993b3](https://github.com/angular/angular/commit/69a83993b3772dd98cc10d3e12b0ca6c66293cf2) | fix | do not throw when retrieving TCB symbol for signal input with restricted access ([#55774](https://github.com/angular/angular/pull/55774)) |
| [4f4f41016e](https://github.com/angular/angular/commit/4f4f41016e897c3fab77ffc23fcfeddadaa782c1) | fix | dom property binding check in signal extended diagnostic ([#54324](https://github.com/angular/angular/pull/54324)) |
| [7a16d7e969](https://github.com/angular/angular/commit/7a16d7e969eaf5a9475ffdd21a4bf637ce523856) | fix | don't type check the bodies of control flow nodes in basic mode ([#55360](https://github.com/angular/angular/pull/55360)) |
| [8d93597a82](https://github.com/angular/angular/commit/8d93597a82860112a5398828745653a7e27dcef0) | fix | fix type narrowing of `@if` with aliases ([#55835](https://github.com/angular/angular/pull/55835)) |
| [9b424d7224](https://github.com/angular/angular/commit/9b424d7224db46edb16c81979c7e231d5e3db5e9) | fix | preserve original reference to non-deferrable dependency ([#54759](https://github.com/angular/angular/pull/54759)) |
| [694ba79cbf](https://github.com/angular/angular/commit/694ba79cbf7aaed1079b1fabf53ea446162fc933) | fix | report cases where initializer APIs are used in a non-directive class ([#54993](https://github.com/angular/angular/pull/54993)) |
| [6219341d26](https://github.com/angular/angular/commit/6219341d267ae7689299835b90f0afa0fe61e213) | fix | report errors when initializer APIs are used on private fields ([#54981](https://github.com/angular/angular/pull/54981)) |
| [c04ffb1fa6](https://github.com/angular/angular/commit/c04ffb1fa61f5164ee5eb7c05b7d76292042ff0b) | fix | use switch statements to narrow Angular switch blocks ([#55168](https://github.com/angular/angular/pull/55168)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [a730f09ae9](https://github.com/angular/angular/commit/a730f09ae9e729da79a3e0951e15e0139ef67713) | feat | Add a public API to establish events to be replayed and an attribute to mark an element with an event handler. ([#55356](https://github.com/angular/angular/pull/55356)) |
| [fdd560ea14](https://github.com/angular/angular/commit/fdd560ea14f2f35608e26102c7fac0471a634b3e) | feat | Add ability to configure zone change detection to use zoneless scheduler ([#55252](https://github.com/angular/angular/pull/55252)) |
| [bce5e2344f](https://github.com/angular/angular/commit/bce5e2344f312dc3a8a30d54e412958bd07180c1) | feat | Add build target for jsaction contract binary. ([#55319](https://github.com/angular/angular/pull/55319)) |
| [666d646575](https://github.com/angular/angular/commit/666d646575800e9326eebd513776f8e92b0357e9) | feat | Add event delegation library to queue up events and replay them when the application is ready ([#55121](https://github.com/angular/angular/pull/55121)) |
| [5f06ca8f55](https://github.com/angular/angular/commit/5f06ca8f5539ed208bae0b110887b5538ac4041f) | feat | add HOST_TAG_NAME token ([#54751](https://github.com/angular/angular/pull/54751)) |
| [a600a39d0c](https://github.com/angular/angular/commit/a600a39d0cf9bb8fc2b6786e6f31acb78b7acc6e) | feat | add support for fallback content in ng-content ([#54854](https://github.com/angular/angular/pull/54854)) |
| [146306a141](https://github.com/angular/angular/commit/146306a1417c378920d80a6d91fd847f22e407ab) | feat | add support for i18n hydration ([#54823](https://github.com/angular/angular/pull/54823)) |
| [f09c5a7bc4](https://github.com/angular/angular/commit/f09c5a7bc455a59aea133264cbf9fd9ef7509a7f) | feat | Add zoneless change detection provider as experimental ([#55329](https://github.com/angular/angular/pull/55329)) |
| [d28614b90e](https://github.com/angular/angular/commit/d28614b90eff835639747e8961fe61e874c44666) | feat | Modify EventType from an enum to an object. ([#55323](https://github.com/angular/angular/pull/55323)) |
| [ac863ded48](https://github.com/angular/angular/commit/ac863ded4818af3426ef5888c706a2bd8c79c0be) | feat | provide ExperimentalPendingTasks API ([#55487](https://github.com/angular/angular/pull/55487)) |
| [1ee9f32621](https://github.com/angular/angular/commit/1ee9f32621f6d72e8038a08f5ad4a0cfe8bd6a13) | feat | Synchronize changes from internal JSAction codebase. ([#55182](https://github.com/angular/angular/pull/55182)) |
| [d888da4606](https://github.com/angular/angular/commit/d888da460696ee74bb4c10a19ac49e3fa1948399) | fix | `ApplicationRef.tick` should respect OnPush for host bindings ([#53718](https://github.com/angular/angular/pull/53718)) |
| [64f870c12b](https://github.com/angular/angular/commit/64f870c12bae1ad66509f0d65f8d3e051aae6eaa) | fix | `ApplicationRef.tick` should respect OnPush for host bindings ([#53718](https://github.com/angular/angular/pull/53718)) ([#53718](https://github.com/angular/angular/pull/53718)) |
| [8cad4e8cbe](https://github.com/angular/angular/commit/8cad4e8cbe2baf20dae7b7ef1f4253a4940cbba0) | fix | `ComponentFixture` `autoDetect` respects `OnPush` flag of host view ([#54824](https://github.com/angular/angular/pull/54824)) |
| [658cf8c384](https://github.com/angular/angular/commit/658cf8c3840b637284a5bb6c9751226d24ccbf9f) | fix | `ComponentFixture` stability should match `ApplicationRef` ([#54949](https://github.com/angular/angular/pull/54949)) |
| [2fc11eae9e](https://github.com/angular/angular/commit/2fc11eae9ea65160866bf7ba46c10520ae9a141f) | fix | account for re-projected ng-content elements with fallback content ([#54854](https://github.com/angular/angular/pull/54854)) |
| [0cbd73c6e9](https://github.com/angular/angular/commit/0cbd73c6e9931dc4938054fc6f7831bdee2606a4) | fix | add warning when using zoneless but zone.js is still loaded ([#55769](https://github.com/angular/angular/pull/55769)) |
| [d5edfde6ee](https://github.com/angular/angular/commit/d5edfde6ee3d65bf7f938ecfeac9f30633f8731b) | fix | afterRender hooks registered outside change detection can mark views dirty ([#55623](https://github.com/angular/angular/pull/55623)) |
| [de7447d15e](https://github.com/angular/angular/commit/de7447d15ed964ae26f0dace4cb3b08f5cccb1c1) | fix | Angular should not ignore changes that happen outside the zone ([#55102](https://github.com/angular/angular/pull/55102)) |
| [ba8e465974](https://github.com/angular/angular/commit/ba8e46597435a827670f10b971b2c58f7033b180) | fix | Change Detection will continue to refresh views while marked for check ([#54734](https://github.com/angular/angular/pull/54734)) |
| [5a10f405d3](https://github.com/angular/angular/commit/5a10f405d315a28b9a000c669e9b1cb3fa24a7f1) | fix | complete the removal of deprecation `async` function ([#55491](https://github.com/angular/angular/pull/55491)) |
| [24bc0ed4f2](https://github.com/angular/angular/commit/24bc0ed4f2de47bd998338d73cba394fb45dd497) | fix | ComponentFixture autodetect should detect changes within ApplicationRef.tick ([#54733](https://github.com/angular/angular/pull/54733)) |
| [1c0ec56c46](https://github.com/angular/angular/commit/1c0ec56c462cf18fb38aae29858165a08b5a2a82) | fix | correctly project single-root content inside control flow ([#54921](https://github.com/angular/angular/pull/54921)) |
| [840c375255](https://github.com/angular/angular/commit/840c375255dc381674bb27746d9ababd14567c33) | fix | do not save point-in-time `setTimeout` and `rAF` references ([#55124](https://github.com/angular/angular/pull/55124)) |
| [10c5cdb49c](https://github.com/angular/angular/commit/10c5cdb49c51c95086febd37f4d88a9b944d7e1c) | fix | ensure change detection runs in a reasonable timeframe with zone coalescing ([#54578](https://github.com/angular/angular/pull/54578)) |
| [ad045efd4b](https://github.com/angular/angular/commit/ad045efd4b1565e01c14399998143538ebfbfd99) | fix | Ensure views marked for check are refreshed during change detection ([#54735](https://github.com/angular/angular/pull/54735)) |
| [69085ea26e](https://github.com/angular/angular/commit/69085ea26e11f372578999337b2d8f099600b630) | fix | error about provideExperimentalCheckNoChangesForDebug uses wrong name ([#55824](https://github.com/angular/angular/pull/55824)) |
| [0147e0b85a](https://github.com/angular/angular/commit/0147e0b85a4f1201b1ae5edaa0d2bc708a13673e) | fix | exhaustive checkNoChanges should only do a single pass ([#55839](https://github.com/angular/angular/pull/55839)) |
| [e02bcf89cf](https://github.com/angular/angular/commit/e02bcf89cf77c3118c649a7db68e66a78f16155c) | fix | Fix clearing of pending task in zoneless cleanup implementation ([#55074](https://github.com/angular/angular/pull/55074)) |
| [0cec9e4f9a](https://github.com/angular/angular/commit/0cec9e4f9a90ec59f0e9838dcbd82705b1709fc0) | fix | Fix null dereference error `addEvent` ([#55353](https://github.com/angular/angular/pull/55353)) |
| [44c0ed83a6](https://github.com/angular/angular/commit/44c0ed83a6499fa96f65a27bc5c926579c06b6d2) | fix | hide implementation details of ExperimentalPendingTasks ([#55516](https://github.com/angular/angular/pull/55516)) |
| [314112de99](https://github.com/angular/angular/commit/314112de99bb97475a0d8bdbddf84a3b3ce4a8fb) | fix | Prevent `markForCheck` during change detection from causing infinite loops ([#54900](https://github.com/angular/angular/pull/54900)) |
| [a5fa279b6e](https://github.com/angular/angular/commit/a5fa279b6e9f5ab4005d6d33107f0e1bb48d05de) | fix | prevent i18n hydration from cleaning projected nodes ([#54823](https://github.com/angular/angular/pull/54823)) |
| [6534c035c0](https://github.com/angular/angular/commit/6534c035c099b30987d6fd1346aea454b79cc79d) | fix | Remove deprecated Testability methods ([#53768](https://github.com/angular/angular/pull/53768)) |
| [a5c57c7484](https://github.com/angular/angular/commit/a5c57c7484f1dc3afab4ece4e969a4a7308cdeca) | fix | resolve error for multiple component instances that use fallback content ([#55478](https://github.com/angular/angular/pull/55478)) |
| [f44a5e4604](https://github.com/angular/angular/commit/f44a5e460491a29e5c0cad5577bade8347d52e11) | fix | support content projection and VCRs in i18n ([#54823](https://github.com/angular/angular/pull/54823)) |
| [0510930a25](https://github.com/angular/angular/commit/0510930a257e610460c875dbbc5566fd06547814) | fix | TestBed should not override NgZone from initTestEnvironment ([#55226](https://github.com/angular/angular/pull/55226)) |
| [e9a0c86766](https://github.com/angular/angular/commit/e9a0c86766ab15c896e026120f0c63c2fb1f9e04) | fix | TestBed should not override NgZone from initTestEnvironment ([#55226](https://github.com/angular/angular/pull/55226)) |
| [700c0520bb](https://github.com/angular/angular/commit/700c0520bb638952ba41a8d8260cf12afb078c0e) | fix | Update ApplicationRef.tick loop to only throw in dev mode ([#54848](https://github.com/angular/angular/pull/54848)) |
| [a99cb7ce5b](https://github.com/angular/angular/commit/a99cb7ce5b77a125ab660da8ebef23ecb158e2e3) | fix | zoneless scheduler should check if Zone is defined before accessing it ([#55118](https://github.com/angular/angular/pull/55118)) |
| [1fd63e9cff](https://github.com/angular/angular/commit/1fd63e9cff9159a8c10c35a0af43bc986e4e8e26) | refactor | deprecate `@Component.interpolation` ([#55778](https://github.com/angular/angular/pull/55778)) |
### forms
| Commit | Type | Description |
| -- | -- | -- |
| [1c736dc3b2](https://github.com/angular/angular/commit/1c736dc3b258a502360cda40b3a00c07102ccbf5) | feat | Unified Control State Change Events ([#54579](https://github.com/angular/angular/pull/54579)) |
| [61007dced0](https://github.com/angular/angular/commit/61007dced0f3396c40efcd2617c130633fb9837a) | fix | Add event for forms submitted & reset ([#55667](https://github.com/angular/angular/pull/55667)) |
| [2e27ca9ddf](https://github.com/angular/angular/commit/2e27ca9ddfc1f3f0387cd720071e85ff46f19db6) | fix | Allow canceled async validators to emit. ([#55134](https://github.com/angular/angular/pull/55134)) |
### http
| Commit | Type | Description |
| -- | -- | -- |
| [6f88d80758](https://github.com/angular/angular/commit/6f88d8075895bd80592b1b7e0fba8202a58a5417) | feat | allow caching requests with different origins between server and client ([#55274](https://github.com/angular/angular/pull/55274)) |
| [8eacb6e4b9](https://github.com/angular/angular/commit/8eacb6e4b982a5aa23cfbf9078dc4e19d9466d73) | feat | exclude caching for authenticated HTTP requests ([#55034](https://github.com/angular/angular/pull/55034)) |
| [d9b339fdbc](https://github.com/angular/angular/commit/d9b339fdbc0f8d1e9bb7b1e4190e7d80e68542f9) | fix | resolve `withRequestsMadeViaParent` behavior with `withFetch` ([#55652](https://github.com/angular/angular/pull/55652)) |
| [ef665a40a5](https://github.com/angular/angular/commit/ef665a40a580ff4df79617084ac83738f28ae924) | refactor | Deprecate `HttpClientModule` & related modules ([#54020](https://github.com/angular/angular/pull/54020)) |
### language-service
| Commit | Type | Description |
| -- | -- | -- |
| [6d1b82df32](https://github.com/angular/angular/commit/6d1b82df32049cfaba2f6a50b9639b6e3b722170) | fix | allow external projects to use provided compiler options ([#55035](https://github.com/angular/angular/pull/55035)) |
| [a48afe0d94](https://github.com/angular/angular/commit/a48afe0d9478aca314e68552f4af77f4123563cd) | fix | avoid generating TS syntactic diagnostics for templates ([#55091](https://github.com/angular/angular/pull/55091)) |
| [bd236cc150](https://github.com/angular/angular/commit/bd236cc150e1b21932612ecf91678be77a503d18) | fix | implement getDefinitionAtPosition for Angular templates ([#55269](https://github.com/angular/angular/pull/55269)) |
| [4166dfc1b6](https://github.com/angular/angular/commit/4166dfc1b62a83b60203bfe45a6d4aa7148a0b23) | fix | prevent underlying TS Service from handling template files ([#55003](https://github.com/angular/angular/pull/55003)) |
| [b7f2fd4739](https://github.com/angular/angular/commit/b7f2fd473988a561bfd032386d8955e90c8d91ed) | fix | use type-only import in plugin factory ([#55996](https://github.com/angular/angular/pull/55996)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [f914f6a362](https://github.com/angular/angular/commit/f914f6a3628847c06cbdde9c90cd417fb2f4c61f) | feat | Migration schematics for `HttpClientModule` ([#54020](https://github.com/angular/angular/pull/54020)) |
| [8459ee46cb](https://github.com/angular/angular/commit/8459ee46cba7f63966c41a2fb7199ec295a91cbb) | fix | handle more cases in HttpClientModule migration ([#55640](https://github.com/angular/angular/pull/55640)) |
| [c4b2f18709](https://github.com/angular/angular/commit/c4b2f18709076f8c400bd26226be37ae07e5e83d) | fix | migrate HttpClientTestingModule in test modules ([#55803](https://github.com/angular/angular/pull/55803)) |
| [bb4a4016a9](https://github.com/angular/angular/commit/bb4a4016a9a29a9c56342ee01d866b0c8a3fb419) | fix | preserve existing properties in HttpClientModule migration ([#55777](https://github.com/angular/angular/pull/55777)) |
| [f93e5180be](https://github.com/angular/angular/commit/f93e5180be1e20a59ff68f12853653f4f3282846) | fix | resolve multiple structural issues with HttpClient migration ([#55557](https://github.com/angular/angular/pull/55557)) |
### platform-browser
| Commit | Type | Description |
| -- | -- | -- |
| [45ae7a6b60](https://github.com/angular/angular/commit/45ae7a6b60019bd49b8a58122a0d5bcbda7e245b) | feat | add withI18nSupport() in developer preview ([#55130](https://github.com/angular/angular/pull/55130)) |
| [23f914f101](https://github.com/angular/angular/commit/23f914f1012545330f6a5aeed4e862bf0e66117b) | fix | Use the right namespace for mathML. ([#55622](https://github.com/angular/angular/pull/55622)) |
| [cba336d4f1](https://github.com/angular/angular/commit/cba336d4f1badd601b24a58fc51bde995f45682d) | refactor | remove deprecated transfer state APIs ([#55474](https://github.com/angular/angular/pull/55474)) |
### platform-browser-dynamic
| Commit | Type | Description |
| -- | -- | -- |
| [eb20c1a8b1](https://github.com/angular/angular/commit/eb20c1a8b18e2e080c856e3e1bf7bcd02f3bfd28) | refactor | unused `RESOURCE_CACHE_PROVIDER` API has been removed ([#54875](https://github.com/angular/angular/pull/54875)) |
### platform-server
| Commit | Type | Description |
| -- | -- | -- |
| [5674c644ab](https://github.com/angular/angular/commit/5674c644abf51ae8764befd3011742ff1febdf29) | fix | add `nonce` attribute to event record script ([#55495](https://github.com/angular/angular/pull/55495)) |
| [e71e869112](https://github.com/angular/angular/commit/e71e869112af1c0ee7a9dd64a963ad7af14a40e2) | fix | remove event dispatch script from HTML when hydration is disabled ([#55681](https://github.com/angular/angular/pull/55681)) |
| [07ac017731](https://github.com/angular/angular/commit/07ac017731f0e08ea3736f1f212093a28648a304) | refactor | remove deprecated `platformDynamicServer` API ([#54874](https://github.com/angular/angular/pull/54874)) |
| [e8b588d8b7](https://github.com/angular/angular/commit/e8b588d8b7fc014aaef99d4b0c1e4567b4aa195d) | refactor | remove deprecated `ServerTransferStateModule` API ([#54874](https://github.com/angular/angular/pull/54874)) |
| [3b1967ca64](https://github.com/angular/angular/commit/3b1967ca64479df9137b3ad7a0d04dbaff6496f4) | refactor | remove deprecated `useAbsoluteUrl` and `baseUrl` from `PlatformConfig` ([#54874](https://github.com/angular/angular/pull/54874)) |
| [2357d3566c](https://github.com/angular/angular/commit/2357d3566c4d18dc40cbda6644ed459ef7703893) | refactor | remove legacy URL handling logic ([#54874](https://github.com/angular/angular/pull/54874)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [4a42961393](https://github.com/angular/angular/commit/4a42961393b3abf40f34374df059d3959dadecc0) | feat | `withNavigationErrorHandler` can convert errors to redirects ([#55370](https://github.com/angular/angular/pull/55370)) |
| [8735af08b9](https://github.com/angular/angular/commit/8735af08b976b30cf236a83f9e8b64b5ff62e9f3) | feat | Add ability to return `UrlTree` with `NavigationBehaviorOptions` from guards ([#45023](https://github.com/angular/angular/pull/45023)) |
| [87f3f27f90](https://github.com/angular/angular/commit/87f3f27f9087d757e18e8e2a0f2fca6f2a2c7edf) | feat | Allow resolvers to return `RedirectCommand` ([#54556](https://github.com/angular/angular/pull/54556)) |
| [2b802587f2](https://github.com/angular/angular/commit/2b802587f27186baa493c1dd01f42d568b652f38) | feat | Allow Route.redirectTo to be a function which returns a string or UrlTree ([#52606](https://github.com/angular/angular/pull/52606)) |
| [60f1d681e0](https://github.com/angular/angular/commit/60f1d681e0ba66d3d94b0819f2c612f095c2d3d3) | fix | preserve replaceUrl when returning a urlTree from CanActivate ([#54042](https://github.com/angular/angular/pull/54042)) |
| [3839cfbb18](https://github.com/angular/angular/commit/3839cfbb18fcc70cae5a6ba4ba7676b1c4acf7a0) | fix | Routed components never inherit `RouterOutlet` `EnvironmentInjector` ([#54265](https://github.com/angular/angular/pull/54265)) |
| [da906fdafc](https://github.com/angular/angular/commit/da906fdafcbb302fa280a162d1c1f04369be2efa) | fix | Routed components never inherit `RouterOutlet` `EnvironmentInjector` ([#54265](https://github.com/angular/angular/pull/54265)) |
### service-worker
| Commit | Type | Description |
| -- | -- | -- |
| [3bc63eaaf3](https://github.com/angular/angular/commit/3bc63eaaf344712ac6de1c9618d4558d9443c848) | fix | avoid running CDs on `controllerchange` ([#54222](https://github.com/angular/angular/pull/54222)) |
| [e598634c10](https://github.com/angular/angular/commit/e598634c10a60936ec4199b221eca4e901220763) | fix | remove `controllerchange` listener when app is destroyed ([#55365](https://github.com/angular/angular/pull/55365)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.3.9"></a>
# 17.3.9 (2024-05-15)
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.3.8"></a>
# 17.3.8 (2024-05-08)
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [c21b459ba6](https://github.com/angular/angular/commit/c21b459ba6520fd5835e23800338ac9c997fee91) | fix | add math elements to schema ([#55631](https://github.com/angular/angular/pull/55631)) ([#55645](https://github.com/angular/angular/pull/55645)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [3818436ebc](https://github.com/angular/angular/commit/3818436ebc649267bb39b976b6b567b7f2b06a64) | fix | don't schedule timer triggers on the server ([#55605](https://github.com/angular/angular/pull/55605)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.3.7"></a>
# 17.3.7 (2024-05-01)
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [51ac883167](https://github.com/angular/angular/commit/51ac8831670637b562dfa135bec1e27a0b49f21d) | fix | don't type check the bodies of control flow nodes in basic mode ([#55558](https://github.com/angular/angular/pull/55558)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [af0eb846a5](https://github.com/angular/angular/commit/af0eb846a572d0e9de2c6bb7016ddd339473dc00) | fix | render hooks should not specifically run outside the Angular zone ([#55399](https://github.com/angular/angular/pull/55399)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [3eea50da64](https://github.com/angular/angular/commit/3eea50da644f6023e7f001b8738c54cb89aece4c) | fix | Scroller should scroll as soon as change detection completes ([#55105](https://github.com/angular/angular/pull/55105)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.3.6"></a>
# 17.3.6 (2024-04-25)
### core
| Commit | Type | Description |
| -- | -- | -- |
| [826861b1fa](https://github.com/angular/angular/commit/826861b1fa7693010743f5dd881fb31ec33eee52) | fix | DeferBlockFixture.render should not wait for stability ([#55271](https://github.com/angular/angular/pull/55271)) |
| [5cf14da35c](https://github.com/angular/angular/commit/5cf14da35cce1ea4456bae4365d3dbe6667b1881) | fix | make `ActivatedRoute` inject correct instance inside `@defer` blocks ([#55374](https://github.com/angular/angular/pull/55374)) |
| [8979fba2c5](https://github.com/angular/angular/commit/8979fba2c5813673767a133caeec9ac768d17329) | fix | skip defer timers on the server ([#55480](https://github.com/angular/angular/pull/55480)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.3.5"></a>
# 17.3.5 (2024-04-17)
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.3.4"></a>
# 17.3.4 (2024-04-10)
### common
| Commit | Type | Description |
| -- | -- | -- |
| [53427d875d](https://github.com/angular/angular/commit/53427d875d33de16b1dbb04e76a9fe32a2b8a445) | fix | invalid ImageKit quality parameter ([#55193](https://github.com/angular/angular/pull/55193)) |
| [766548c3ec](https://github.com/angular/angular/commit/766548c3ecc06ffd8f06ed9a7d0cbb3db6f1b0f6) | fix | skip transfer cache on client ([#55012](https://github.com/angular/angular/pull/55012)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.3.2"></a>
# 17.3.2 (2024-03-28)
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [2b7bad5151](https://github.com/angular/angular/commit/2b7bad515100cbfa40b3e8d844bae13d43fd5602) | fix | invoke method-based tracking function with context ([#54960](https://github.com/angular/angular/pull/54960)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [b478dfbfda](https://github.com/angular/angular/commit/b478dfbfda3f32fbe723a1e8725e86490422520d) | fix | report errors when initializer APIs are used on private fields ([#55070](https://github.com/angular/angular/pull/55070)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [708ba8115f](https://github.com/angular/angular/commit/708ba8115f7ad05201db5c529aefe4dd48fc64c5) | fix | establish proper injector resolution order for `@defer` blocks ([#55079](https://github.com/angular/angular/pull/55079)) |
### http
| Commit | Type | Description |
| -- | -- | -- |
| [cb433af0e1](https://github.com/angular/angular/commit/cb433af0e1ba61073eb4a02ccd75cf360e9fd409) | fix | include transferCache when cloning HttpRequest ([#54939](https://github.com/angular/angular/pull/54939)) |
| [64f202cab9](https://github.com/angular/angular/commit/64f202cab9e7a5c873b17bbddd02368006426152) | fix | manage different body types for caching POST requests ([#54980](https://github.com/angular/angular/pull/54980)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [2f9d94bc4a](https://github.com/angular/angular/commit/2f9d94bc4ab5a94e620a13404aba4e094f8b2344) | fix | account for variables in imports initializer ([#55081](https://github.com/angular/angular/pull/55081)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [365fd50407](https://github.com/angular/angular/commit/365fd504077d0e7509efc3077ea4ae8bbafb01f7) | fix | RouterLinkActive will always remove active classes when links are not active ([#54982](https://github.com/angular/angular/pull/54982)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.3.1"></a>
# 17.3.1 (2024-03-20)
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [c0788200e2](https://github.com/angular/angular/commit/c0788200e26406bacb90ee0079ea9753eebd1b32) | fix | capture data bindings for content projection purposes in blocks ([#54876](https://github.com/angular/angular/pull/54876)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [99e9474aa2](https://github.com/angular/angular/commit/99e9474aa2ccccdf4385fbac6b62b1a4585ed4b4) | fix | symbol feature detection for the compiler ([#54711](https://github.com/angular/angular/pull/54711)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.3.0"></a>
# 17.3.0 (2024-03-13)
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [1a6beae8a2](https://github.com/angular/angular/commit/1a6beae8a2bdcff27d4c1e402f98246a52247906) | feat | Enable template pipeline by default. ([#54571](https://github.com/angular/angular/pull/54571)) |
| [f386a04c9d](https://github.com/angular/angular/commit/f386a04c9ddc2951c8105d5cafcce7b4bedea569) | fix | handle two-way bindings to signal-based template variables in instruction generation ([#54714](https://github.com/angular/angular/pull/54714)) |
| [1f129f114e](https://github.com/angular/angular/commit/1f129f114edb21137d74471dd6b652848d2ffb68) | fix | not catching for loop empty tracking expressions ([#54772](https://github.com/angular/angular/pull/54772)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [12dc4d074e](https://github.com/angular/angular/commit/12dc4d074e63edaff626003ad6136a8d122b2ba6) | fix | account for as expression in docs extraction ([#54414](https://github.com/angular/angular/pull/54414)) |
| [da7fbb40f0](https://github.com/angular/angular/commit/da7fbb40f06e6e37504f69e7b335f8219f424de2) | fix | detect when the linker is working in unpublished angular and widen supported versions ([#54439](https://github.com/angular/angular/pull/54439)) |
| [492e03f699](https://github.com/angular/angular/commit/492e03f699ca95df4cf854885253f63a5a1fb5c1) | fix | flag two-way bindings to non-signal values in templates ([#54714](https://github.com/angular/angular/pull/54714)) |
| [5afa4f0ec1](https://github.com/angular/angular/commit/5afa4f0ec1b64b88ef875d48bd143e0f36e0a955) | fix | support `ModuleWithProviders` literal detection with `typeof` ([#54650](https://github.com/angular/angular/pull/54650)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [331b16efd2](https://github.com/angular/angular/commit/331b16efd2f5af876e6dc0ad2474ee7a87b00de5) | feat | add API to inject attributes on the host node ([#54604](https://github.com/angular/angular/pull/54604)) |
| [fb540e169a](https://github.com/angular/angular/commit/fb540e169a78a61f38d611f538eea8fdb0971f1d) | feat | add migration for invalid two-way bindings ([#54630](https://github.com/angular/angular/pull/54630)) |
| [c687b8f453](https://github.com/angular/angular/commit/c687b8f4531252cd1c3dfbb9a7bd42bdbe666a36) | feat | expose new `output()` API ([#54650](https://github.com/angular/angular/pull/54650)) |
| [c809069f21](https://github.com/angular/angular/commit/c809069f213244afd0e2d803a6a43510b218e6f5) | feat | introduce `outputFromObservable()` interop function ([#54650](https://github.com/angular/angular/pull/54650)) |
| [aff65fd1f4](https://github.com/angular/angular/commit/aff65fd1f4a61ed76a6f9b623852f197eb3500e4) | feat | introduce `outputToObservable` interop helper ([#54650](https://github.com/angular/angular/pull/54650)) |
| [974958913c](https://github.com/angular/angular/commit/974958913ca632971f878a045537472f2c99c665) | feat | support TypeScript 5.4 ([#54414](https://github.com/angular/angular/pull/54414)) |
| [39a50f9a8d](https://github.com/angular/angular/commit/39a50f9a8df5afc4968d18924f3d9d7d6b649d3a) | fix | ensure all initializer functions run in an injection context ([#54761](https://github.com/angular/angular/pull/54761)) |
| [243ccce624](https://github.com/angular/angular/commit/243ccce62475ae03a2e727d2b3cb2d51a595c4a7) | fix | exclude class attribute intended for projection matching from directive matching ([#54800](https://github.com/angular/angular/pull/54800)) |
| [2909e9817d](https://github.com/angular/angular/commit/2909e9817daf69b6478d7d09229491a9a48cff16) | fix | prevent infinite loops in clobbered elements check ([#54425](https://github.com/angular/angular/pull/54425)) |
| [7243c704cf](https://github.com/angular/angular/commit/7243c704cf8a4986fae419793027458e142658f0) | fix | return a readonly signal on `asReadonly`. ([#54706](https://github.com/angular/angular/pull/54706)) |
| [bb35414a38](https://github.com/angular/angular/commit/bb35414a38f8a8447d03c66dc5bf60b84409f9e3) | perf | speed up retrieval of `DestroyRef` in `EventEmitter` ([#54748](https://github.com/angular/angular/pull/54748)) |
### http
| Commit | Type | Description |
| -- | -- | -- |
| [8d37ed035c](https://github.com/angular/angular/commit/8d37ed035c9e9796ba9a7b1f055404ea220dbb3b) | fix | exclude caching for authenticated HTTP requests ([#54746](https://github.com/angular/angular/pull/54746)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [c1c7384e02](https://github.com/angular/angular/commit/c1c7384e02becc623c6a42985f7178ca98137264) | feat | Add reusable types for router guards ([#54580](https://github.com/angular/angular/pull/54580)) |
| [7225485311](https://github.com/angular/angular/commit/722548531108e247660ebe6966b99b57d510b615) | fix | Navigations triggered by cancellation events should cancel previous navigation ([#54710](https://github.com/angular/angular/pull/54710)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.2.4"></a>
# 17.2.4 (2024-03-06)
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [917b9bdd2e](https://github.com/angular/angular/commit/917b9bdd2eec9cd6395adb0cbde979490bcc3a88) | fix | unwrap expressions with type parameters in query read property ([#54647](https://github.com/angular/angular/pull/54647)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [586cc24a10](https://github.com/angular/angular/commit/586cc24a102d51e7c42ecc839124353afe459073) | fix | apply TestBed provider overrides to `@defer` dependencies ([#54667](https://github.com/angular/angular/pull/54667)) |
| [b558a01c84](https://github.com/angular/angular/commit/b558a01c84a1fe4f9e047e92d99d69f02f2ccc4f) | fix | generic inference for signal inputs may break with `--strictFunctionTypes` ([#54652](https://github.com/angular/angular/pull/54652)) |
| [443e5f1591](https://github.com/angular/angular/commit/443e5f1591896909eab6ad157bb4b5db50a49f26) | fix | return a readonly signal on `asReadonly`. ([#54719](https://github.com/angular/angular/pull/54719)) |
| [ffbafc7d4a](https://github.com/angular/angular/commit/ffbafc7d4a3c61226cb5c524b3ff42ed4f9f1d76) | fix | untrack various core operations ([#54614](https://github.com/angular/angular/pull/54614)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.2.3"></a>
# 17.2.3 (2024-02-27)
### common
| Commit | Type | Description |
| -- | -- | -- |
| [1a526f2881](https://github.com/angular/angular/commit/1a526f28814429c05b003edbe40500b7069e1404) | perf | `AsyncPipe` should not call `markForCheck` on subscription ([#54554](https://github.com/angular/angular/pull/54554)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [2aefed8763](https://github.com/angular/angular/commit/2aefed87632293c5570e17653a7d270162ea35c3) | fix | catch function instance properties in interpolated signal diagnostic ([#54325](https://github.com/angular/angular/pull/54325)) |
| [48aec63ee4](https://github.com/angular/angular/commit/48aec63ee48fe9d20c1f1565b044ec359100736d) | fix | identify aliased initializer functions ([#54480](https://github.com/angular/angular/pull/54480)) |
| [daf7c611b2](https://github.com/angular/angular/commit/daf7c611b23797ba2dba24e20e26c344902e7bc7) | fix | identify aliased initializer functions ([#54609](https://github.com/angular/angular/pull/54609)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [57123524a2](https://github.com/angular/angular/commit/57123524a2e1481987eaf239d2ae7f1216291864) | fix | collect providers from NgModules while rendering `@defer` block ([#52881](https://github.com/angular/angular/pull/52881)) |
| [79a32816dc](https://github.com/angular/angular/commit/79a32816dcb57e9b02ba6e18261c6dccd14b0b23) | fix | fix typo in injectors.svg file ([#54596](https://github.com/angular/angular/pull/54596)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [dbe673b027](https://github.com/angular/angular/commit/dbe673b02751b8bf12f6f6f79b843dd268d965e1) | fix | resolve infinite loop for a single line element with a long tag name and angle bracket on a new line ([#54588](https://github.com/angular/angular/pull/54588)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.2.2"></a>
# 17.2.2 (2024-02-21)
### common
| Commit | Type | Description |
| -- | -- | -- |
| [d34e3298db](https://github.com/angular/angular/commit/d34e3298db2da9d3aa8f8e2c49e1d1aed849e7d2) | fix | image placeholder not removed in OnPush component ([#54515](https://github.com/angular/angular/pull/54515)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [6447c0eecc](https://github.com/angular/angular/commit/6447c0eecc15800417bb5bde2d273865c559b7d4) | fix | adding the inert property to the "SCHEMA" array ([#53148](https://github.com/angular/angular/pull/53148)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [0a3edfb543](https://github.com/angular/angular/commit/0a3edfb5433e1b67f37d7b3f69a5c77b48eedce6) | fix | correctly detect deferred dependencies across scoped nodes ([#54499](https://github.com/angular/angular/pull/54499)) |
| [790f4f7c26](https://github.com/angular/angular/commit/790f4f7c26474af2b1d81a4f3c761047bf920edf) | fix | use correct symbol name for default imported symbols in defer blocks ([#54495](https://github.com/angular/angular/pull/54495)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [3bd5860c74](https://github.com/angular/angular/commit/3bd5860c749517c4d35850703c53a768138b7bde) | fix | properly execute content queries for root components ([#54457](https://github.com/angular/angular/pull/54457)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [bb57d34110](https://github.com/angular/angular/commit/bb57d34110ea8796f5c5f522b98dadf078e8ad8a) | fix | Fix cf migration regular expression to include underscores ([#54533](https://github.com/angular/angular/pull/54533)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [3e31f1a34e](https://github.com/angular/angular/commit/3e31f1a34ee97a802a4032cd9e7816d683a51d5e) | fix | Clear internal transition when navigation finalizes ([#54261](https://github.com/angular/angular/pull/54261)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.2.1"></a>
# 17.2.1 (2024-02-14)
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [7234824228](https://github.com/angular/angular/commit/7234824228df11249a5ebe01a6dee381be74e02e) | fix | fix broken version detection condition ([#54443](https://github.com/angular/angular/pull/54443)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.2.0"></a>
# 17.2.0 (2024-02-14)
### common
| Commit | Type | Description |
| -- | -- | -- |
| [03c3b3eb79](https://github.com/angular/angular/commit/03c3b3eb79ec061b0031d6ad7ba386d185c87d8d) | feat | add Netlify image loader ([#54311](https://github.com/angular/angular/pull/54311)) |
| [f5c520b836](https://github.com/angular/angular/commit/f5c520b836c4545c7043649f28b3a0369c168747) | feat | add placeholder to NgOptimizedImage ([#53783](https://github.com/angular/angular/pull/53783)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [47e6e84101](https://github.com/angular/angular/commit/47e6e841016abfca0c1aa84051d82a04b3027617) | feat | Add a TSConfig option `useTemplatePipeline` ([#54057](https://github.com/angular/angular/pull/54057)) |
| [66e940aebf](https://github.com/angular/angular/commit/66e940aebfd5a93944860a4e0dbd14e1072f80f2) | feat | scope selectors in @starting-style ([#53943](https://github.com/angular/angular/pull/53943)) |
| [7b4d275f49](https://github.com/angular/angular/commit/7b4d275f494a64c38b61cea7045ba8b6e8447b78) | fix | Fix the template pipeline option ([#54148](https://github.com/angular/angular/pull/54148)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [7e861c640e](https://github.com/angular/angular/commit/7e861c640edf90c5f8d4f7e091861d3d98cd49c0) | feat | generate extra imports for component local dependencies in local mode ([#53543](https://github.com/angular/angular/pull/53543)) |
| [3263df23f2](https://github.com/angular/angular/commit/3263df23f2f4da722ef2c1a1dacfb0866498dd60) | feat | generate global imports in local compilation mode ([#53543](https://github.com/angular/angular/pull/53543)) |
| [b774e22d8e](https://github.com/angular/angular/commit/b774e22d8e384f43e9cd8f5c55475d06e7f66988) | feat | make it configurable to generate alias reexports ([#53937](https://github.com/angular/angular/pull/53937)) |
| [3e1384048e](https://github.com/angular/angular/commit/3e1384048eb76c92532ae19aa2883318121c00e8) | feat | support host directives for local compilation mode ([#53877](https://github.com/angular/angular/pull/53877)) |
| [a592904c69](https://github.com/angular/angular/commit/a592904c691844d2c1aed00bd914edabef49f9b1) | fix | allow custom/duplicate decorators for `@Injectable` classes in local compilation mode ([#54139](https://github.com/angular/angular/pull/54139)) |
| [4b1d948b36](https://github.com/angular/angular/commit/4b1d948b36285ec6d80dbe93e0b92133f9d4be94) | fix | consider the case of duplicate Angular decorators in local compilation diagnostics ([#54139](https://github.com/angular/angular/pull/54139)) |
| [96bcf4fb12](https://github.com/angular/angular/commit/96bcf4fb1208d1f073784a2cde4a03553e905807) | fix | forbid custom/duplicate decorator when option `forbidOrphanComponents` is set ([#54139](https://github.com/angular/angular/pull/54139)) |
| [64fa5715c6](https://github.com/angular/angular/commit/64fa5715c696101fba0b4f8623eaec0eadc5b159) | fix | generating extra imports in local compilation mode when cycle is introduced ([#53543](https://github.com/angular/angular/pull/53543)) |
| [6c8b09468a](https://github.com/angular/angular/commit/6c8b09468a05a80cba3960861f0ab8d3bae80415) | fix | highlight the unresolved element in the @Component.styles array for the error LOCAL_COMPILATION_UNRESOLVED_CONST ([#54230](https://github.com/angular/angular/pull/54230)) |
| [0970129e20](https://github.com/angular/angular/commit/0970129e20f77dc309f2b4f76f961b310124778c) | fix | show proper error for custom decorators in local compilation mode ([#53983](https://github.com/angular/angular/pull/53983)) |
| [f39cb06418](https://github.com/angular/angular/commit/f39cb064183d984254bdf4e41b61d3dc9379738a) | fix | show specific error for unresolved @Directive.exportAs in local compilation mode ([#54230](https://github.com/angular/angular/pull/54230)) |
| [f3851b5945](https://github.com/angular/angular/commit/f3851b59459a1d9c214ace3db5a716d51c1f93c7) | fix | show specific error for unresolved @HostBinding's argument in local compilation mode ([#54230](https://github.com/angular/angular/pull/54230)) |
| [39ddd884e8](https://github.com/angular/angular/commit/39ddd884e826cc0be63fd0f7d7de20d642877ef9) | fix | show specific error for unresolved @HostListener's event name in local compilation mode ([#54230](https://github.com/angular/angular/pull/54230)) |
| [5d633240fd](https://github.com/angular/angular/commit/5d633240fd5927c4318a9240e60c3a30b2333cee) | fix | show the correct message for the error LOCAL_COMPILATION_UNRESOLVED_CONST when an unresolved symbol used for @Component.styles ([#54230](https://github.com/angular/angular/pull/54230)) |
| [58b8a232d6](https://github.com/angular/angular/commit/58b8a232d64f5fe3207c90c8145cab36e7e192c2) | fix | support jumping to definitions of signal-based inputs ([#54053](https://github.com/angular/angular/pull/54053)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [702ab28b4c](https://github.com/angular/angular/commit/702ab28b4c07a903c403a20af2ca287348b6afd0) | feat | add support for model inputs ([#54252](https://github.com/angular/angular/pull/54252)) |
| [e95ef2cbc6](https://github.com/angular/angular/commit/e95ef2cbc6f850d8fe96218b74cff76cea947674) | feat | expose queries as signals ([#54283](https://github.com/angular/angular/pull/54283)) |
| [656bc282e3](https://github.com/angular/angular/commit/656bc282e345c5e37a9189a0a4daa631e02c31bf) | fix | add toString implementation to signals ([#54002](https://github.com/angular/angular/pull/54002)) |
| [62b87b4551](https://github.com/angular/angular/commit/62b87b4551d77815f58af152d1921de3733621ba) | fix | do not crash for signal query that does not have any matches ([#54353](https://github.com/angular/angular/pull/54353)) |
| [4b96f370ee](https://github.com/angular/angular/commit/4b96f370eea08d2531cc54f65a651f94b504692d) | fix | expose model signal subcribe for type checking purposes ([#54357](https://github.com/angular/angular/pull/54357)) |
| [744cb1e561](https://github.com/angular/angular/commit/744cb1e561d9b0cbffd20ad612d5ea9e2cf6b2e7) | fix | return the same children query results if there are no changes ([#54392](https://github.com/angular/angular/pull/54392)) |
| [6d00115bf4](https://github.com/angular/angular/commit/6d00115bf45731b80178e11921df6ec1dc89efaf) | fix | show placeholder block on the server with immediate trigger ([#54394](https://github.com/angular/angular/pull/54394)) |
### http
| Commit | Type | Description |
| -- | -- | -- |
| [1c536250b6](https://github.com/angular/angular/commit/1c536250b6112c67a68159de50c4afe0dbc440f8) | fix | Use string body to generate transfer cache key. ([#54379](https://github.com/angular/angular/pull/54379)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.1.3"></a>
# 17.1.3 (2024-02-08)
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [bc4a6a9715](https://github.com/angular/angular/commit/bc4a6a9715547881ed8e65169a5aaebfd3188a7f) | fix | do not error due to multiple components named equally ([#54273](https://github.com/angular/angular/pull/54273)) |
| [a997e08c6f](https://github.com/angular/angular/commit/a997e08c6f5c5321e5d18f3368ff0886fa133d59) | fix | handle default imports in defer blocks ([#53695](https://github.com/angular/angular/pull/53695)) |
| [63a9027720](https://github.com/angular/angular/commit/63a9027720611002c6ee3b443a11e9feff213059) | fix | interpolatedSignalNotInvoked diagnostic for model signals ([#54338](https://github.com/angular/angular/pull/54338)) |
| [40e1edc977](https://github.com/angular/angular/commit/40e1edc977fbe398adc535167f8ede2db8985656) | fix | properly catch fatal diagnostics in type checking ([#54309](https://github.com/angular/angular/pull/54309)) |
| [9f6605d11b](https://github.com/angular/angular/commit/9f6605d11b7ee75f289b5a2ed69e201d65b038d8) | fix | support jumping to definitions of signal-based inputs ([#54233](https://github.com/angular/angular/pull/54233)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [7df133dcc2](https://github.com/angular/angular/commit/7df133dcc243cd6b0f779fa35de7f916e6938301) | fix | `afterRender` hooks should allow updating state ([#54074](https://github.com/angular/angular/pull/54074)) |
| [744e20641a](https://github.com/angular/angular/commit/744e20641a21d18c324bd9c157c8912d38741826) | fix | Fix possible infinite loop with `markForCheck` by partially reverting [#54074](https://github.com/angular/angular/pull/54074) ([#54329](https://github.com/angular/angular/pull/54329)) |
| [0fb114274c](https://github.com/angular/angular/commit/0fb114274cead9f317a2fc902cc3a3f6b046e708) | fix | update imports to be compatible with rxjs 6 ([#54193](https://github.com/angular/angular/pull/54193)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [238f2a8bc9](https://github.com/angular/angular/commit/238f2a8bc9c46b0d08aff163349ecc1493441a69) | fix | Clear internal transition when navigation finalizes ([#54261](https://github.com/angular/angular/pull/54261)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.1.2"></a>
# 17.1.2 (2024-01-31)
###
| Commit | Type | Description |
| -- | -- | -- |
| [ccddacf11d](https://github.com/angular/angular/commit/ccddacf11deaebeda12e1bdb6e93ec401397d352) | fix | cta clickability issue in adev homepage. ([#52905](https://github.com/angular/angular/pull/52905)) |
### animations
| Commit | Type | Description |
| -- | -- | -- |
| [98d545fafa](https://github.com/angular/angular/commit/98d545fafa7fc3b1fb3ae049ce655e33ef9bd423) | fix | cleanup DOM elements when root view is removed with async animations ([#53033](https://github.com/angular/angular/pull/53033)) |
### common
| Commit | Type | Description |
| -- | -- | -- |
| [cdc5e39532](https://github.com/angular/angular/commit/cdc5e3953237a192beafd6330f9d9e36ede34f2c) | fix | The date pipe should return ISO format for week and week-year as intended in the unit test. ([#53879](https://github.com/angular/angular/pull/53879)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [f12b01ec88](https://github.com/angular/angular/commit/f12b01ec88eaf18041c2e46335428627aa0d7744) | fix | Update type check block to fix control flow source mappings ([#53980](https://github.com/angular/angular/pull/53980)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [c477e876e3](https://github.com/angular/angular/commit/c477e876e39495b855b096440d53cf1dd1ad33c6) | fix | change defer block fixture default behavior to playthrough ([#54088](https://github.com/angular/angular/pull/54088)) |
### migrations
| Commit | Type | Description |
| -- | -- | -- |
| [8264382a6b](https://github.com/angular/angular/commit/8264382a6bf389fb3fca75fa2d6c0a2aa5a1e42f) | fix | error in standalone migration when non-array value is used as declarations in TestBed ([#54122](https://github.com/angular/angular/pull/54122)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.1.1"></a>
# 17.1.1 (2024-01-24)
### router
| Commit | Type | Description |
| -- | -- | -- |
| [f222bee8fa](https://github.com/angular/angular/commit/f222bee8fa037f437761e5f7f127f22f280e9154) | fix | revert commit that replaced `last` helper with native `Array.at(-1)` ([#54021](https://github.com/angular/angular/pull/54021)) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.1.0"></a>
# 17.1.0 (2024-01-17)
### compiler
@@ -329,32 +1163,16 @@ Live long and prosper 🖖🏻
Node.js v16 is planned to be End-of-Life on 2023-09-11. Angular will stop supporting Node.js v16 in Angular v17. For Node.js release schedule details, please see: https://github.com/nodejs/release#release-schedule
### common
-
- the NgSwitch directive now defaults to the === equality operator,
migrating from the previously used ==. NgSwitch expressions and / or
migrating from the previously used == operator. NgSwitch expressions and / or
individual condition values need adjusting to this stricter equality
check. The added warning message should help pinpointing NgSwitch
usages where adjustements are needed.
check. The added warning message should help pin-pointing NgSwitch
usages where adjustments are needed.
### core
- Angular now required `zone.js` version `~0.14.0`
- Angular now requires `zone.js` version `~0.14.0`
- Versions of TypeScript older than 5.2 are no longer supported.
- The `mutate` method was removed from the `WritableSignal` interface and completely
dropped from the public API surface. As an alternative please use the update method and
make immutable changes to the object.
Example before:
```typescript
items.mutate(itemsArray => itemsArray.push(newItem));
```
Example after:
```typescript
items.update(itemsArray => [itemsArray, …newItem]);
```
- The `mutate` method was removed from the `WritableSignal` interface and completely
dropped from the public API surface. As an alternative please use the update method and
dropped from the public API surface. As an alternative, please use the `update` method and
make immutable changes to the object.
Example before:
@@ -437,7 +1255,7 @@ Live long and prosper 🖖🏻
- Swapping out the context object for `EmbeddedViewRef`
is no longer supported. Support for this was introduced with v12.0.0, but
this pattern is rarely used. There is no replacement, but you can use
simple assignments in most cases, or `Object.assign , or alternatively
simple assignments in most cases, or `Object.assign` , or alternatively
still replace the full object by using a `Proxy` (see `NgTemplateOutlet`
as an example).
+7 -12
View File
@@ -32,7 +32,7 @@ Stack Overflow is a much better place to ask questions since:
To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
If you would like to chat about the question in real-time, you can reach out via [our Discord server][discord].
If you would like to chat about the question in real-time, you can reach out via [the Angular community Discord server][discord].
## <a name="issue"></a> Found a Bug?
@@ -138,7 +138,7 @@ If we ask for changes via code reviews then:
git push
```
For more info on working with fixup commits see [here](docs/FIXUP_COMMITS.md).
For more info on working with fixup commits see [here](./contributing-docs/using-fixup-commits.md).
That's it! Thank you for your contribution!
@@ -207,7 +207,7 @@ To ensure consistency throughout the source code, keep these rules in mind as yo
* All public API methods **must be documented**.
* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at **100 characters**.
An automated formatter is available, see [DEVELOPER.md](docs/DEVELOPER.md#clang-format).
An automated formatter is available, see [DEVELOPER.md](contributing-docs/building-and-testing-angular#formatting-your-source-code).
## <a name="commit"></a> Commit Message Format
@@ -302,7 +302,7 @@ There are currently a few exceptions to the "use package name" rule:
* `dev-infra`: used for dev-infra related changes within the directories /scripts and /tools
* `docs-infra`: used for docs-app (angular.io) related changes within the /aio directory of the repo
* `docs-infra`: used for docs-app (angular.dev) related changes within the /adev directory of the repo
* `migrations`: used for changes to the `ng update` migrations.
@@ -353,9 +353,9 @@ DEPRECATED: <what is deprecated>
Closes #<pr number>
```
Breaking Change section should start with the phrase "BREAKING CHANGE: " followed by a summary of the breaking change, a blank line, and a detailed description of the breaking change that also includes migration instructions.
Breaking Change section should start with the phrase `BREAKING CHANGE: ` followed by a summary of the breaking change, a blank line, and a detailed description of the breaking change that also includes migration instructions.
Similarly, a Deprecation section should start with "DEPRECATED: " followed by a short description of what is deprecated, a blank line, and a detailed description of the deprecation that also mentions the recommended update path.
Similarly, a Deprecation section should start with `DEPRECATED: ` followed by a short description of what is deprecated, a blank line, and a detailed description of the deprecation that also mentions the recommended update path.
### Revert commits
@@ -389,16 +389,11 @@ The following documents can help you sort out issues with GitHub accounts and mu
[angular-group]: https://groups.google.com/forum/#!forum/angular
[coc]: https://github.com/angular/code-of-conduct/blob/main/CODE_OF_CONDUCT.md
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
[corporate-cla]: https://cla.developers.google.com/about/google-corporate
[dev-doc]: https://github.com/angular/angular/blob/main/docs/DEVELOPER.md
[dev-doc]: ./contributing-docs/building-and-testing-angular.md
[github]: https://github.com/angular/angular
[discord]: https://discord.gg/angular
[individual-cla]: https://cla.developers.google.com/about/google-individual
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
[jsfiddle]: https://jsfiddle.net/
[plunker]: https://plnkr.co/edit
[runnable]: https://runnable.com/
[stackoverflow]: https://stackoverflow.com/questions/tagged/angular
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License
Copyright (c) 2010-2023 Google LLC. https://angular.io/license
Copyright (c) 2010-2024 Google LLC. https://angular.io/license
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+9 -5
View File
@@ -1,7 +1,7 @@
<h1 align="center">Angular - The modern web developer's platform</h1>
<p align="center">
<img src="aio/src/assets/images/logos/angular/angular_renaissance.png" alt="angular-logo" width="120px" height="120px"/>
<img src="adev/src/assets/images/press-kit/angular_icon_gradient.gif" alt="angular-logo" width="120px" height="120px"/>
<br>
<em>Angular is a development platform for building mobile and desktop web applications
<br> using TypeScript/JavaScript and other languages.</em>
@@ -61,6 +61,10 @@ Get started with Angular, learn the fundamentals and explore advanced topics on
- [Lazy Loading][lazyloading]
- [Animations][animations]
### Local Development
To contribute to the Angular Docs, check out the [Angular.dev README](adev/README.md)
## Development Setup
### Prerequisites
@@ -97,7 +101,7 @@ Angular is cross-platform, fast, scalable, has incredible tooling, and is loved
## Ecosystem
<p>
<img src="/docs/images/angular-ecosystem-logos.png" alt="angular ecosystem logos" width="500px" height="auto">
<img src="/contributing-docs/images/angular-ecosystem-logos.png" alt="angular ecosystem logos" width="500px" height="auto">
</p>
- [Angular Command Line (CLI)][cli]
@@ -109,7 +113,7 @@ Angular is cross-platform, fast, scalable, has incredible tooling, and is loved
## Upgrading
Check out our [upgrade guide](https://update.angular.io/) to find out the best way to upgrade your project.
Check out our [upgrade guide](https://angular.dev/update-guide/) to find out the best way to upgrade your project.
## Contributing
@@ -148,8 +152,8 @@ Join the conversation and help the community.
[angularmaterial]: https://material.angular.io/
[cli]: https://angular.dev/tools/cli
[architecture]: https://angular.dev/essentials
[componentstemplates]: https://angular.dev/tutorials/learn-angular/components-in-angular
[forms]: https://angular.dev/tutorials/learn-angular/forms
[componentstemplates]: https://angular.dev/tutorials/learn-angular/1-components-in-angular
[forms]: https://angular.dev/tutorials/learn-angular/15-forms
[api]: https://angular.dev/api
[angularelements]: https://angular.dev/guide/elements
[ssr]: https://angular.dev/guide/ssr
+1 -1
View File
@@ -1,3 +1,3 @@
Angular is part of Google [Open Source Software Vulnerability Reward Program](https://bughunters.google.com/about/rules/6521337925468160/google-open-source-software-vulnerability-reward-program-rules). For vulnerabilities in Angular, please submit your report [here](https://bughunters.google.com/report).
For more information, check out [Angular's security policy](https://angular.io/guide/security).
For more information, check out [Angular's security policy](https://angular.dev/best-practices/security).
+15 -68
View File
@@ -2,27 +2,12 @@ workspace(
name = "angular",
managed_directories = {
"@npm": ["node_modules"],
"@aio_npm": ["aio/node_modules"],
},
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//:yarn.bzl", "YARN_LABEL")
# Add a patch fix for rules_webtesting v0.3.5 required for enabling runfiles on Windows.
# TODO: Remove the http_archive for this transitive dependency when a release is cut
# for https://github.com/bazelbuild/rules_webtesting/commit/581b1557e382f93419da6a03b91a45c2ac9a9ec8
# and the version is updated in rules_nodejs.
http_archive(
name = "io_bazel_rules_webtesting",
patch_args = ["-p1"],
patches = [
"//:tools/bazel-repo-patches/rules_webtesting__windows_runfiles_fix.patch",
],
sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a",
urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz"],
)
http_archive(
name = "build_bazel_rules_nodejs",
patches = [
@@ -64,7 +49,17 @@ load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
nodejs_register_toolchains(
name = "nodejs",
node_version = "18.13.0",
node_repositories = {
"18.20.0-darwin_arm64": ("node-v18.20.0-darwin-arm64.tar.gz", "node-v18.20.0-darwin-arm64", "10066ad4dd9e03ea5c4c45ef8775420ff37b860de09bbdf87b97e0c07b1ea036"),
"18.20.0-darwin_amd64": ("node-v18.20.0-darwin-x64.tar.gz", "node-v18.20.0-darwin-x64", "062ba71618e88e06321de5caa038843c350aababa2d315f3ca7b8551f8e66c1c"),
"18.20.0-linux_arm64": ("node-v18.20.0-linux-arm64.tar.xz", "node-v18.20.0-linux-arm64", "afe51da9ffb38ac1e3a20d9a06efd403ced4bf8831ab554a02a088dd8392fd79"),
"18.20.0-linux_ppc64le": ("node-v18.20.0-linux-ppc64le.tar.xz", "node-v18.20.0-linux-ppc64le", "9e652bbf53a3e37285b11dfb9d6a9bb8b02010c3b50e5c8229d4cc10e72681da"),
"18.20.0-linux_s390x": ("node-v18.20.0-linux-s390x.tar.xz", "node-v18.20.0-linux-s390x", "a6c2a5796b9d9e9bf21da62ec89ff30b41a8108880b9eaa3c912f1ce795a7743"),
"18.20.0-linux_amd64": ("node-v18.20.0-linux-x64.tar.xz", "node-v18.20.0-linux-x64", "03eea148e56785babb27930b05ed6bf311aaa3bc573c0399dd63cad2fe5713c7"),
"18.20.0-windows_amd64": ("node-v18.20.0-win-x64.zip", "node-v18.20.0-win-x64", "1c0aab05cc6836a8f5148cca345b92ebc948a4a2013f18d117b7ade6ff05aca6"),
},
# We need at least Node 18.17 due to some transitive dependencies.
node_version = "18.20.0",
)
# Download npm dependencies.
@@ -80,7 +75,7 @@ yarn_install(
"//:.yarnrc",
"//:tools/npm-patches/@bazel+jasmine+5.8.1.patch",
"//tools:postinstall-patches.js",
"//tools/esm-interop:patches/npm/@angular+build-tooling+0.0.0-e0ec7b60641d7f6369be45d8d02663fd50f320be.patch",
"//tools/esm-interop:patches/npm/@angular+build-tooling+0.0.0-d30a56c19bafaac67cf44e605ed8c2c0e45b0a51.patch",
"//tools/esm-interop:patches/npm/@bazel+concatjs+5.8.1.patch",
"//tools/esm-interop:patches/npm/@bazel+esbuild+5.7.1.patch",
"//tools/esm-interop:patches/npm/@bazel+protractor+5.7.1.patch",
@@ -99,54 +94,6 @@ yarn_install(
yarn_lock = "//:yarn.lock",
)
yarn_install(
name = "aio_npm",
# Note that we add the postinstall scripts here so that the dependencies are re-installed
# when the postinstall patches are modified.
data = [
YARN_LABEL,
"//:.yarnrc",
"//:tools/npm-patches/@bazel+jasmine+5.8.1.patch",
"//aio:tools/cli-patches/bazel-architect-output.patch",
"//aio:tools/cli-patches/patch.js",
],
# Currently disabled due to:
# 1. Missing Windows support currently.
# 2. Incompatibilites with the `ts_library` rule.
exports_directories_only = False,
manual_build_file_contents = npm_package_archives(),
package_json = "//aio:package.json",
# We prefer to symlink the `node_modules` to only maintain a single install.
# See https://github.com/angular/dev-infra/pull/446#issuecomment-1059820287 for details.
symlink_node_modules = True,
yarn = YARN_LABEL,
yarn_lock = "//aio:yarn.lock",
)
yarn_install(
name = "aio_example_deps",
# Rename the default js_library target from "node_modules" as this obscures the
# the source directory stamped as a filegroup in the manual BUILD contents below.
all_node_modules_target_name = "node_modules_all",
data = [
YARN_LABEL,
"//:.yarnrc",
],
# Disabled because, when False, yarn_install preserves the node_modules folder
# with bin symlinks in the external repository. This is needed to link the shared
# set of deps for example e2es.
exports_directories_only = False,
manual_build_file_contents = """\
filegroup(
name = "node_modules_files",
srcs = ["node_modules"],
)
""",
package_json = "//aio/tools/examples/shared:package.json",
yarn = YARN_LABEL,
yarn_lock = "//aio/tools/examples/shared:yarn.lock",
)
load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
aspect_bazel_lib_dependencies()
@@ -196,10 +143,10 @@ cldr_xml_data_repository(
# sass rules
http_archive(
name = "io_bazel_rules_sass",
sha256 = "7a90567717c3417a23ff4b21963a698a6e9aa669ac9e682121ea33f218a2816a",
strip_prefix = "rules_sass-425ecafa8268bc013d684216363fe75bc802323e",
sha256 = "cd83736ea65d0df064283aea5922dbaf132dd2b3aa54e7151aae7edaa9572c3e",
strip_prefix = "rules_sass-83022b98114c07e9588089c7fe8f76bc0262c7e7",
urls = [
"https://github.com/bazelbuild/rules_sass/archive/425ecafa8268bc013d684216363fe75bc802323e.zip",
"https://github.com/bazelbuild/rules_sass/archive/83022b98114c07e9588089c7fe8f76bc0262c7e7.zip",
],
)
+70 -21
View File
@@ -1,6 +1,9 @@
load("//:packages.bzl", "link_packages")
load("@npm//@angular/build-tooling/bazel/remote-execution:index.bzl", "ENABLE_NETWORK")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
load("@npm//@angular-devkit/architect-cli:index.bzl", "architect", "architect_test")
load("@bazel_skylib//lib:collections.bzl", "collections")
load("//adev/tools/local_deps:index.bzl", "ensure_local_package_deps", "link_local_packages")
package(default_visibility = ["//visibility:public"])
@@ -23,12 +26,24 @@ APPLICATION_FILES = [
TEST_FILES = APPLICATION_FILES + [
"karma.conf.js",
"test-main.ts",
"tsconfig.spec.json",
] + glob(
["**/*.spec.ts"],
)
APPLICATION_DEPS = link_packages([
APPLICATION_ASSETS = [
"//adev/src/assets/images",
"//adev/src/assets/textures",
"//adev/src/assets/previews",
"//adev/src/assets:tutorials",
"//adev/src/assets/icons",
"//adev/src/assets:api",
"//adev/src/assets:content",
]
APPLICATION_DEPS = [
"@npm//@angular/build",
"@npm//@angular-devkit/build-angular",
"@npm//@angular/animations",
"@npm//@angular/cdk",
@@ -48,13 +63,6 @@ APPLICATION_DEPS = link_packages([
"@npm//ogl",
"@npm//rxjs",
"@npm//typescript",
"//adev/src/assets/images",
"//adev/src/assets/textures",
"//adev/src/assets/previews",
"//adev/src/assets:tutorials",
"//adev/src/assets/icons",
"//adev/src/assets:api",
"//adev/src/assets:content",
"@npm//@typescript/vfs",
"@npm//@codemirror/state",
"@npm//@codemirror/view",
@@ -71,42 +79,77 @@ APPLICATION_DEPS = link_packages([
"@npm//@lezer/highlight",
"@npm//@lezer/javascript",
"@npm//@lezer/common",
"@npm//xterm",
"@npm//xterm-addon-fit",
"@npm//@stackblitz/sdk",
"@npm//@xterm/xterm",
"@npm//@xterm/addon-fit",
"@npm//algoliasearch",
"@npm//angular-split",
])
"@npm//zone.js",
]
TEST_DEPS = APPLICATION_DEPS + link_packages([
TEST_DEPS = APPLICATION_DEPS + [
"@npm//@angular/platform-browser-dynamic",
"@npm//@angular/build-tooling/bazel/browsers/chromium",
"@npm//@types/jasmine",
"@npm//@types/node",
"@npm//assert",
"@npm//jasmine",
"@npm//jasmine-core",
"@npm//karma-chrome-launcher",
"@npm//karma-coverage",
"@npm//karma-jasmine",
"@npm//karma-jasmine-html-reporter",
"//aio/tools:windows-chromium-path",
])
]
# Create `npm_link` targets for all dependencies that correspond to a
# first-party Angular package that can be built from `HEAD`.
link_local_packages(
all_deps = collections.uniq(APPLICATION_DEPS + TEST_DEPS),
)
copy_to_bin(
name = "application_files_bin",
srcs = APPLICATION_FILES,
)
bool_flag(
name = "fast_build_mode",
build_setting_default = False,
)
config_setting(
name = "fast",
flag_values = {
":fast_build_mode": "true",
},
)
config_setting(
name = "full",
flag_values = {
":fast_build_mode": "false",
},
)
config_based_architect_flags = select({
":fast": ["--no-prerender"],
":full": ["--prerender"],
})
architect(
name = "build",
args = [
"angular-dev:build",
"--output-path=build",
],
] + config_based_architect_flags,
chdir = "$(RULEDIR)",
data = APPLICATION_DEPS + [
data = ensure_local_package_deps(APPLICATION_DEPS) + APPLICATION_ASSETS + [
":application_files_bin",
],
# Network is required to inline fonts.
exec_properties = ENABLE_NETWORK,
output_dir = True,
tags = [
"no-remote-exec",
],
)
architect(
@@ -118,9 +161,12 @@ architect(
"--watch",
],
chdir = package_name(),
data = APPLICATION_DEPS + [
data = ensure_local_package_deps(APPLICATION_DEPS) + APPLICATION_ASSETS + [
":application_files_bin",
],
tags = [
"no-remote-exec",
],
)
architect_test(
@@ -130,7 +176,10 @@ architect_test(
"--no-watch",
],
chdir = package_name(),
data = TEST_DEPS + TEST_FILES,
data = ensure_local_package_deps(TEST_DEPS) + TEST_FILES + APPLICATION_ASSETS + [
"//adev/tools:windows-chromium-path",
"@npm//@angular/build-tooling/bazel/browsers/chromium",
],
env = {
"CHROME_BIN": "../$(CHROMIUM)",
},
+53
View File
@@ -0,0 +1,53 @@
# [Angular.dev](https://www.angular.dev)
This site is built with Angular.
The content is written primarly in Markdown format located in `src/content`. For simple edits, you can directly edit the file on GitHub and generate a Pull Request.
## Local Development
For local development, [yarn](https://yarnpkg.com/) is the preferred package manager. You can setup a local environment with the following commands
:
```bash
# Clone Angular repo
git clone https://github.com/angular/angular.git
# Navigate to project directory
cd angular
# Install dependencies
yarn
# Build and run local dev server
# Note: Initial build will take some time
yarn docs
```
If you are having issues with the docs building, see the [FAQs](#faqs) section.
## Contributing
Want to report a bug, contribute some code, or improve the documentation? Excellent!
Read through our [contributing guidelines](/CONTRIBUTING.md) to learn about our submission process, coding rules, and more.
And if you're new, check out one of our issues labeled as <kbd>[help wanted](https://github.com/angular/angular/labels/help%20wanted)</kbd> or <kbd>[good first issue](https://github.com/angular/angular/labels/good%20first%20issue)</kbd>.
### Code of Conduct
Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md).
## FAQs
### The build is failing and I'm seeing `bazel:bazel failed: missing input file` messages.
This is most likely due to a bazel dependency / caching issue. To resolve this, run the following command:
```
# Try this first
yarn bazel clean
# If that doesn't work, try it with the expunge flag
yarn bazel clean --expunge
```
+18 -14
View File
@@ -17,25 +17,24 @@
"prefix": "adev",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"builder": "@angular/build:application",
"options": {
"externalDependencies": [
"path"
],
"externalDependencies": ["path"],
"define": {
// We need this until xterm 5.6.0 is released
// see https://github.com/xtermjs/xterm.js/pull/4940
"self": "this"
},
"outputPath": "dist/angular-dev",
"index": "src/index.html",
"browser": "src/main.ts",
"server": "src/main.server.ts",
"prerender": true,
"polyfills": ["src/polyfills.ts", "zone.js"],
"ssr": true,
"polyfills": [],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/robots.txt",
"src/assets"
],
"styles": ["@angular/docs/styles/global-styles.scss"],
"assets": ["src/favicon.ico", "src/robots.txt", "src/assets"],
"styles": ["@angular/docs/styles/global-styles.scss", "./src/local-styles.scss"],
"scripts": [],
"webWorkerTsConfig": "tsconfig.worker.json",
"optimization": {
@@ -85,10 +84,10 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"include": ["src/app"],
"karmaConfig": "karma.conf.js",
"main": "test-main.ts",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["@angular/docs/styles/global-styles.scss"],
@@ -100,6 +99,11 @@
}
},
"cli": {
"analytics": "dca119a9-da31-47f7-a6cb-b60541037021"
"analytics": "dca119a9-da31-47f7-a6cb-b60541037021",
"cache": {
// Disable build caching as the cache folder will just be dropped
// when run under Bazel sandboxed execution.
"enabled": false
}
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
"ignore": ["**/.*"],
"headers": [
{
"source": "assets/tutorials/common/*.jpg",
"source": "assets/images/tutorials/common/*.jpg",
"headers": [
{
"key": "Cross-Origin-Resource-Policy",
+12 -8
View File
@@ -1,7 +1,7 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const {getAdjustedChromeBinPathForWindows} = require('../aio/tools/windows-chromium-path');
const {getAdjustedChromeBinPathForWindows} = require('../adev/tools/windows-chromium-path');
process.env.CHROME_BIN = getAdjustedChromeBinPathForWindows();
@@ -21,7 +21,7 @@ module.exports = function (config) {
'/dummy/image': 'src/assets/images/logos/angular/angular.png',
},
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
@@ -32,15 +32,12 @@ module.exports = function (config) {
},
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
suppressAll: true, // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/site'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
],
reporters: [{type: 'html'}, {type: 'text-summary'}],
},
reporters: ['progress', 'kjhtml', 'jasmine-seed'],
port: 9876,
@@ -51,7 +48,14 @@ module.exports = function (config) {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
// See /integration/README.md#browser-tests for more info on these args
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--hide-scrollbars', '--mute-audio'],
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--hide-scrollbars',
'--mute-audio',
],
},
},
browsers: ['ChromeHeadlessNoSandbox'],
-135
View File
@@ -1,135 +0,0 @@
/*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {input, confirm} from '@inquirer/prompts';
import {existsSync} from 'fs';
import {copyFile, mkdir, writeFile} from 'fs/promises';
import {dirname, join} from 'path';
import {fileURLToPath} from 'url';
import {copyFolder} from './utils/fs.mjs';
const EXAMPLES_BASE = join(
dirname(fileURLToPath(import.meta.url)),
'../../src/content/examples',
);
const STACKBLITZ_TEMPLATE = join(
dirname(fileURLToPath(import.meta.url)),
'../../src/content/stackblitz-template',
);
const MAIN_TS_FILENAME = 'main.ts';
const STACKBLITZ_CONFIG_FILENAME = 'stackblitz.json';
createExample();
async function createExample(): Promise<void> {
console.info('Create example');
const name = await input({message: 'What is the example name?'});
const description = await input({message: 'Could you provide the description of the example?'});
const tags: string[] = [];
let addMoreTags = true;
while (addMoreTags) {
const tag = await input({message: 'Could you provide the tag of the example?'});
if (!!tag) {
tags.push(tag);
}
console.info();
addMoreTags = await confirm({message: 'Would you like to add another tag?', default: true});
}
const shouldCopySrcAppFolderFromTemplate = await confirm({
message: 'Would you like to copy /src/app/**.* from template?',
default: true,
});
const shouldCopyMainTsFromTemplate = await confirm({
message: 'Would you like to copy /src/main.ts from template?',
default: false,
});
const examplePath = join(EXAMPLES_BASE, name);
await createEmptyExample(examplePath, name, description, tags);
await copyFilesFromTemplate(
examplePath,
shouldCopySrcAppFolderFromTemplate,
shouldCopyMainTsFromTemplate,
);
}
/**
* Create the directory and marker files for the new example.
*/
async function createEmptyExample(
examplePath: string,
exampleName: string,
description: string,
tags: string[],
): Promise<void> {
validateExampleName(exampleName);
await ensureExamplePath(examplePath);
await writeStackBlitzFile(examplePath, description, tags);
}
function validateExampleName(exampleName: string): void {
if (/\s/.test(exampleName)) {
throw new Error(`Unable to create example. The example name contains spaces: '${exampleName}'`);
}
}
/**
* Ensure that the new example directory exists.
*/
async function ensureExamplePath(examplePath: string): Promise<void> {
if (existsSync(examplePath)) {
throw new Error(
`Unable to create example. The path to the new example already exists: ${examplePath}`,
);
}
await mkdir(examplePath);
}
/**
* Write the `stackblitz.json` file into the new example.
*/
async function writeStackBlitzFile(
examplePath: string,
description: string,
tags: string[],
): Promise<void> {
const config = {
description,
ignore: ['**/*.d.ts', '**/*.js', '**/*.[1,2].*'],
tags,
};
await writeFile(
join(examplePath, STACKBLITZ_CONFIG_FILENAME),
JSON.stringify(config, null, 2) + '\n',
);
}
async function copyFilesFromTemplate(
examplePath: string,
shouldCopySrcAppFolderFromTemplate: boolean,
shouldCopyMainTsFromTemplate: boolean,
): Promise<void> {
if (shouldCopySrcAppFolderFromTemplate) {
const appTemplateFolderPath = join(STACKBLITZ_TEMPLATE, 'src/app');
const exampleAppFolderPath = join(examplePath, 'src/app');
await copyFolder(appTemplateFolderPath, exampleAppFolderPath);
}
if (shouldCopyMainTsFromTemplate) {
const mainTsTemplatePath = join(STACKBLITZ_TEMPLATE, 'src', MAIN_TS_FILENAME);
const exampleMainTsPath = join(examplePath, 'src', MAIN_TS_FILENAME);
await copyFile(mainTsTemplatePath, exampleMainTsPath);
}
}
@@ -1,158 +0,0 @@
/*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import ts from 'typescript';
import * as fs from 'fs';
import {dirname, join, relative} from 'path';
import {fileURLToPath} from 'url';
import {readFile, writeFile} from 'fs/promises';
const TYPESCRIPT_EXTENSION = '.ts';
const SKIP_FILES_WITH_EXTENSIONS = ['.e2e-spec.ts', '.spec.ts', '.po.ts'];
const EXAMPLES_PATH = `../../content/examples`;
interface File {
path: string;
content: string;
}
interface AnalyzedFiles {
path: string;
componentNames: string[];
}
/** Absolute disk path to the project directory. */
const examplesDir = join(
dirname(fileURLToPath(import.meta.url)),
'../../src/content/examples',
);
const projectDir = join(dirname(fileURLToPath(import.meta.url)), '../../src');
const previewsComponentMapFileName = 'previews.ts';
main();
async function main() {
const files = await retrieveAllTypescriptFiles(
examplesDir,
(path) => !SKIP_FILES_WITH_EXTENSIONS.some((extensionToSkip) => path.endsWith(extensionToSkip)),
);
const filesWithComponent = files
.map((file) => ({
componentNames: analyzeFile(file),
path: file.path,
}))
.filter((result) => result.componentNames.length > 0);
const previewsComponentMap = generatePreviewsComponentMap(filesWithComponent);
fs.mkdirSync(join(projectDir, 'assets/previews'), {recursive: true});
await writeFile(
join(projectDir, 'assets/previews', previewsComponentMapFileName),
previewsComponentMap,
);
}
/** Recursively search the provided directory for all typescript files and asynchronously load them. */
function retrieveAllTypescriptFiles(
baseDir: string,
predicateFn: (path: string) => boolean,
): Promise<File[]> {
const typescriptFiles: Promise<File>[] = [];
const checkFilesInDirectory = (dir: string) => {
const files = fs.readdirSync(dir, {withFileTypes: true});
for (const file of files) {
const fullPathToFile = join(dir, file.name);
const relativeFilePath = relative(baseDir, fullPathToFile);
if (
file.isFile() &&
file.name.endsWith(TYPESCRIPT_EXTENSION) &&
predicateFn(relativeFilePath)
) {
typescriptFiles.push(
readFile(fullPathToFile, {encoding: 'utf-8'}).then((fileContent) => {
return {
path: relativeFilePath,
content: fileContent,
};
}),
);
} else if (file.isDirectory()) {
checkFilesInDirectory(fullPathToFile);
}
}
};
checkFilesInDirectory(baseDir);
return Promise.all(typescriptFiles);
}
/** Returns list of the `Standalone` @Component class names for given file */
function analyzeFile(file: File): string[] {
const componentClassNames: string[] = [];
const sourceFile = ts.createSourceFile(file.path, file.content, ts.ScriptTarget.Latest, false);
const visitNode = (node: ts.Node): void => {
if (ts.isClassDeclaration(node)) {
const decorators = ts.getDecorators(node);
const componentName = node.name ? node.name.text : null;
if (decorators && decorators.length) {
for (const decorator of decorators) {
const call = decorator.expression;
if (
ts.isCallExpression(call) &&
ts.isIdentifier(call.expression) &&
call.expression.text === 'Component' &&
call.arguments.length > 0 &&
ts.isObjectLiteralExpression(call.arguments[0])
) {
const hasStandaloneProperty = call.arguments[0].properties.some(
(property) =>
property.name &&
ts.isIdentifier(property.name) &&
property.name.text === 'standalone',
);
if (hasStandaloneProperty && componentName) {
componentClassNames.push(componentName);
}
}
}
}
}
ts.forEachChild(node, visitNode);
};
visitNode(sourceFile);
return componentClassNames;
}
function generatePreviewsComponentMap(data: AnalyzedFiles[]): string {
let result = '';
for (const fileData of data) {
for (const componentName of fileData.componentNames) {
const key = `${fileData.path}${
fileData.componentNames.length > 1 ? '_' + componentName : ''
}`.replace(/\\/g, '/');
result += `['${key}']: () => import('${EXAMPLES_PATH}/${fileData.path
.replace(/\\/g, '/')
.replace('.ts', '')}').then(c => c.${componentName}),\n`;
}
}
return fs
.readFileSync('scripts/examples/previews-components.template', 'utf8')
.replace(/\${previewsComponents}/g, result);
}
@@ -1,23 +0,0 @@
/*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/**
******************************************************************************
* DO NOT MANUALLY EDIT THIS FILE. THIS FILE IS AUTOMATICALLY GENERATED.
******************************************************************************
*/
import {Type} from '@angular/core';
/**
* Map of the previews components, values are functions which returns the promise of the component type, which will be displayed as preview in the ExampleViewer component.
* Keys has to be equal to paths written down in the docs markdown files.
*/
export const PREVIEWS_COMPONENTS_MAP: Record<string, () => Promise<Type<unknown>>> = {
${previewsComponents}
};
@@ -1,221 +0,0 @@
/*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {dirname, join} from 'path';
import {readFile, writeFile} from 'fs/promises';
import {
ASSETS_EXAMPLE_PATH,
CSS_TS_COPYRIGHT,
EXAMPLES_PATH,
HTML_COPYRIGHT,
STACKBLITZ_TEMPLATE_PATH,
STACKBLITZ_CONFIG_FILENAME,
TEMPORARY_EXAMPLES_PATH,
EXCLUDE_FILES_FOR_STACKBLITZ,
} from './utils/examples-constants.mjs';
import {copyFolder, createFolder, removeFolder} from './utils/fs.mjs';
import jsdom from 'jsdom';
import {glob} from 'glob';
import {regionParser} from './../../prerender/markdown-pipeline/regions/region-parser.mjs';
interface StackblitzConfig {
ignore: string[];
file: string;
tags: string[];
description: string;
}
export async function generateStackblitzExample(
exampleFolderName: string,
primaryFilePath: string,
title: string,
) {
const exampleDir = join(EXAMPLES_PATH, exampleFolderName);
const temporaryExampleDir = join(TEMPORARY_EXAMPLES_PATH, exampleFolderName);
const config = await readFile(join(exampleDir, STACKBLITZ_CONFIG_FILENAME), 'utf-8');
const stackblitzConfig: StackblitzConfig = JSON.parse(config);
primaryFilePath = join(...primaryFilePath.split('/'));
await createFolder(temporaryExampleDir);
await combineTemplateWithExample(exampleDir, temporaryExampleDir);
await generateStackblitzHtml(
temporaryExampleDir,
stackblitzConfig,
exampleFolderName,
primaryFilePath,
title,
);
await removeFolder(temporaryExampleDir);
}
async function combineTemplateWithExample(
exampleDir: string,
temporaryExampleDir: string,
): Promise<void> {
// Copy template files to TEMP folder
await copyFolder(STACKBLITZ_TEMPLATE_PATH, temporaryExampleDir);
// Copy example files to TEMP folder
await copyFolder(exampleDir, temporaryExampleDir);
}
async function generateStackblitzHtml(
temporaryExampleDir: string,
stackBlitzConfig: StackblitzConfig,
exampleFolderName: string,
primaryFilePath: string,
title: string,
): Promise<void> {
const defaultIncludes = [
'**/*.ts',
'**/*.js',
'**/*.css',
'**/*.html',
'**/*.md',
'**/*.json',
'**/*.svg',
];
const exampleFilePaths = await glob(defaultIncludes, {
cwd: temporaryExampleDir,
nodir: true,
dot: true,
ignore: stackBlitzConfig.ignore,
});
const postData = await createPostData(
temporaryExampleDir,
stackBlitzConfig,
exampleFilePaths,
title,
);
const primaryFile = getPrimaryFile(primaryFilePath ?? stackBlitzConfig.file, exampleFilePaths);
const html = createStackblitzHtml(postData, primaryFile);
const stackblitzHtmlPath = join(
join(ASSETS_EXAMPLE_PATH, exampleFolderName),
`${primaryFile}.html`,
);
await createFolder(dirname(stackblitzHtmlPath));
await writeFile(stackblitzHtmlPath, html, 'utf-8');
}
function getPrimaryFile(primaryFilePath: string, exampleFilePaths: string[]): string {
if (primaryFilePath) {
if (!exampleFilePaths.some((filePath) => filePath === primaryFilePath)) {
throw new Error(`The specified primary file (${primaryFilePath}) does not exist!`);
}
return primaryFilePath;
} else {
const defaultPrimaryFilePaths = [
'src/app/app.component.html',
'src/app/app.component.ts',
'src/app/main.ts',
];
const primaryFile = defaultPrimaryFilePaths.find((path) =>
exampleFilePaths.some((filePath) => filePath === path),
);
if (!primaryFile) {
throw new Error(
`None of the default primary files (${defaultPrimaryFilePaths.join(', ')}) exists.`,
);
}
return primaryFile;
}
}
async function createPostData(
exampleDir: string,
config: StackblitzConfig,
exampleFilePaths: string[],
title: string,
): Promise<Record<string, string>> {
const postData: Record<string, string> = {};
for (const filePath of exampleFilePaths) {
if (EXCLUDE_FILES_FOR_STACKBLITZ.some((excludedFile) => filePath.endsWith(excludedFile))) {
continue;
}
let content = await readFile(join(exampleDir, filePath), 'utf-8');
content = appendCopyright(filePath, content);
content = extractRegions(filePath, content);
postData[`project[files][${filePath}]`] = content;
}
const tags = ['angular', 'example', ...(config.tags || [])];
tags.forEach((tag, index) => (postData[`project[tags][${index}]`] = tag));
postData['project[description]'] = `Angular Example - ${config.description}`;
postData['project[template]'] = 'node';
postData['project[title]'] = title ?? 'Angular Example';
return postData;
}
function createStackblitzHtml(postData: Record<string, string>, primaryFile: string): string {
const baseHtml = createBaseStackblitzHtml(primaryFile);
const doc = new jsdom.JSDOM(baseHtml).window.document;
const form = doc.querySelector('form');
for (const [key, value] of Object.entries(postData)) {
const element = htmlToElement(doc, `<input type="hidden" name="${key}">`);
if (element && form) {
element.setAttribute('value', value as string);
form.appendChild(element);
}
}
return doc.documentElement.outerHTML;
}
function createBaseStackblitzHtml(primaryFile: string) {
const file = `?file=${primaryFile}`;
const action = `https://stackblitz.com/run${file}`;
return `
<!DOCTYPE html><html lang="en"><body>
<form id="mainForm" method="post" action="${action}" target="_self"></form>
<script>
var embedded = 'ctl=1';
var isEmbedded = window.location.search.indexOf(embedded) > -1;
if (isEmbedded) {
var form = document.getElementById('mainForm');
var action = form.action;
var actionHasParams = action.indexOf('?') > -1;
var symbol = actionHasParams ? '&' : '?'
form.action = form.action + symbol + embedded;
}
document.getElementById("mainForm").submit();
</script>
</body></html>
`.trim();
}
function appendCopyright(filename: string, content: string): string {
if (filename.endsWith('.html')) {
return `${HTML_COPYRIGHT}${content}`;
} else if (filename.endsWith('.ts') || filename.endsWith('.css')) {
return `${CSS_TS_COPYRIGHT}${content}`;
}
return content;
}
function htmlToElement(document: Document, html: string) {
const div = document.createElement('div');
div.innerHTML = html;
return div.firstElementChild;
}
function extractRegions(path: string, contents: string): string {
const regionParserResult = regionParser(contents, path);
return regionParserResult.contents;
}
-8
View File
@@ -1,8 +0,0 @@
{
"extends": "../../tsconfig.json",
"ts-node": {
"compilerOptions": {
"module": "es2020"
}
}
}
@@ -1,55 +0,0 @@
/*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {dirname, join} from 'path';
import {fileURLToPath} from 'url';
const BASE = dirname(fileURLToPath(import.meta.url));
// Directory paths
export const ASSETS_EXAMPLE_PATH = join(
BASE,
'../../../src/assets/content/examples',
);
export const EXAMPLES_PATH = join(BASE, '../../../src/content/examples');
export const STACKBLITZ_TEMPLATE_PATH = join(
BASE,
'../../../src/content/stackblitz-template',
);
export const TEMPORARY_EXAMPLES_PATH = join(fileURLToPath(import.meta.url), '../../../../TEMP');
// Extensions
export const TEST_FILES_EXTENSION_SUFFIX = '.spec.ts';
export const TEST_FILES_E2E_EXTENSION_SUFFIX = '.e2e-spec.ts';
// Filename
// TODO: BUILD.bazel and example-config will be deprecated when migration to standalone examples will be done.
export const BUILD_BAZEL_FILENAME = 'BUILD.bazel';
export const EXAMPLE_CONFIG_FILENAME = 'example-config.json';
export const STACKBLITZ_CONFIG_FILENAME = 'stackblitz.json';
// Copyright
const PAD = '\n\n';
const COPYRIGHT =
'@license\n' +
'Copyright Google LLC All Rights Reserved.\n' +
'\n' +
'Use of this source code is governed by an MIT-style license that can be\n' +
'found in the LICENSE file at https://angular.dev/license\n';
export const CSS_TS_COPYRIGHT = `/*\n${COPYRIGHT}\n*/${PAD}`;
export const HTML_COPYRIGHT = `<!-- \n${COPYRIGHT}\n-->${PAD}`;
// Exclude
export const EXCLUDE_FILES_FOR_STACKBLITZ = [
STACKBLITZ_CONFIG_FILENAME,
BUILD_BAZEL_FILENAME,
EXAMPLE_CONFIG_FILENAME,
TEST_FILES_EXTENSION_SUFFIX,
TEST_FILES_E2E_EXTENSION_SUFFIX,
];
-77
View File
@@ -1,77 +0,0 @@
/*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Dirent, existsSync, readdirSync} from 'fs';
import {copyFile, mkdir, readFile, readdir, rm, stat} from 'fs/promises';
import {join, relative} from 'path';
export async function copyFolder(source: string, destination: string) {
if (!existsSync(destination)) {
await mkdir(destination, {recursive: true});
}
const files = await readdir(source);
for (const file of files) {
const sourcePath = join(source, file);
const destPath = join(destination, file);
const stats = await stat(sourcePath);
const isDirectory = await stats.isDirectory();
if (isDirectory) {
await copyFolder(sourcePath, destPath);
} else {
await copyFile(sourcePath, destPath);
}
}
}
/** Recursively search the provided directory for all files which satisfy predicate and asynchronously load them. */
export function retrieveFiles(
baseDir: string,
predicate?: (file: Dirent) => boolean,
): Promise<{path: string; content: string}[]> {
const filesWithContent: Promise<{path: string; content: string}>[] = [];
const checkFilesInDirectory = (dir: string) => {
const files = readdirSync(dir, {withFileTypes: true});
for (const file of files) {
const fullPathToFile = join(dir, file.name);
if (file.isFile() && (predicate ? predicate(file) : true)) {
filesWithContent.push(
readFile(fullPathToFile, {encoding: 'utf-8'}).then((fileContent) => {
return {
path: relative(baseDir, fullPathToFile),
content: fileContent,
};
}),
);
} else if (file.isDirectory()) {
checkFilesInDirectory(fullPathToFile);
}
}
};
checkFilesInDirectory(baseDir);
return Promise.all(filesWithContent);
}
export async function createFolder(path: string): Promise<void> {
if (!existsSync(path)) {
await mkdir(path, {recursive: true});
}
}
export async function removeFolder(path: string): Promise<void> {
if (existsSync(path)) {
await rm(path, {recursive: true});
}
}
+3
View File
@@ -0,0 +1,3 @@
# Generating data for `angular.dev/cli`
This script updates the Angular CLI help JSON files stored in `adev/src/content/cli/help`. This files are used to generate the [angular.dev CLI](https://angular.dev/cli) pages.
+154
View File
@@ -0,0 +1,154 @@
import {execSync} from 'node:child_process';
import {readFile, writeFile, readdir, mkdtemp, realpath, copyFile, unlink} from 'node:fs/promises';
import {tmpdir} from 'node:os';
import {get} from 'node:https';
import {dirname, resolve as resolvePath, posix, join} from 'node:path';
import {fileURLToPath} from 'node:url';
import {existsSync, constants as fsConstants} from 'node:fs';
const GITHUB_API = 'https://api.github.com/repos/';
const CLI_BUILDS_REPO = 'angular/cli-builds';
const GITHUB_API_CLI_BUILDS = posix.join(GITHUB_API, CLI_BUILDS_REPO);
const scriptDir = dirname(fileURLToPath(import.meta.url));
const CLI_HELP_CONTENT_PATH = resolvePath(scriptDir, '../../src/content/cli/help');
const CLI_SHA_PATH = join(CLI_HELP_CONTENT_PATH, 'build-info.json');
async function main() {
if (!existsSync(CLI_SHA_PATH)) {
throw new Error(`${CLI_SHA_PATH} does not exist.`);
}
const branch = process.env.GITHUB_REF;
const {sha: currentSha} = JSON.parse(await readFile(CLI_SHA_PATH, 'utf-8'));
const latestSha = await getShaFromCliBuilds(branch);
console.log(`Comparing ${currentSha}...${latestSha}.`);
const affectedFiles = await getAffectedFiles(currentSha, latestSha);
const changedHelpFiles = affectedFiles.filter((file) => file.startsWith('help/'));
if (changedHelpFiles.length === 0) {
console.log(`No 'help/**' files changed between ${currentSha} and ${latestSha}.`);
return;
}
console.log(
`The below help files changed between ${currentSha} and ${latestSha}:\n` +
changedHelpFiles.map((f) => '* ' + f).join('\n'),
);
const temporaryDir = await realpath(await mkdtemp(join(tmpdir(), 'cli-src-')));
const execOptions = {cwd: temporaryDir, stdio: 'inherit'};
execSync('git init', execOptions);
execSync('git remote add origin https://github.com/angular/cli-builds.git', execOptions);
// fetch a commit
execSync(`git fetch origin ${latestSha}`, execOptions);
// reset this repository's main branch to the commit of interest
execSync('git reset --hard FETCH_HEAD', execOptions);
// get sha when files where changed
const shaWhenFilesChanged = execSync(`git rev-list -1 ${latestSha} "help/"`, {
encoding: 'utf8',
cwd: temporaryDir,
stdio: ['ignore', 'pipe', 'ignore'],
}).trim();
// Delete existing JSON help files.
const helpFilesUnlink = (await readdir(CLI_HELP_CONTENT_PATH))
.filter((f) => f.endsWith('.json'))
.map((f) => unlink(join(CLI_HELP_CONTENT_PATH, f)));
await Promise.allSettled(helpFilesUnlink);
// Copy new help files
const tempHelpDir = join(temporaryDir, 'help');
const helpFilesCopy = (await readdir(tempHelpDir)).map((f) => {
const src = join(tempHelpDir, f);
const dest = join(CLI_HELP_CONTENT_PATH, f);
return copyFile(src, dest, fsConstants.COPYFILE_FICLONE);
});
await Promise.allSettled(helpFilesCopy);
// Write SHA to file.
await writeFile(
CLI_SHA_PATH,
JSON.stringify(
{
branchName: branch,
sha: shaWhenFilesChanged,
},
undefined,
2,
),
);
console.log('\nChanges: ');
execSync(`git status --porcelain`, {stdio: 'inherit'});
console.log(`Successfully updated help files in '${CLI_HELP_CONTENT_PATH}'.\n`);
}
/**
* Get SHA of a branch.
*
* @param {string} branch
* @param {string} headSha
* @returns Promise<string>
*/
async function getShaFromCliBuilds(branch) {
const sha = await httpGet(`${GITHUB_API_CLI_BUILDS}/commits/${branch}`, {
headers: {Accept: 'application/vnd.github.VERSION.sha'},
});
if (!sha) {
throw new Error(`Unable to extract the SHA for '${branch}'.`);
}
return sha;
}
/**
* Get the affected files.
*
* @param {string} baseSha
* @param {string} headSha
* @returns Promise<string[]>
*/
async function getAffectedFiles(baseSha, headSha) {
const {files} = JSON.parse(
await httpGet(`${GITHUB_API_CLI_BUILDS}/compare/${baseSha}...${headSha}`),
);
return files.map((f) => f.filename);
}
function httpGet(url, options = {}) {
options.headers ??= {};
options.headers[
'Authorization'
] = `token ${process.env.ANGULAR_CLI_BUILDS_READONLY_GITHUB_TOKEN}`;
// User agent is required
// https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#user-agent-required
options.headers['User-Agent'] = `ADEV_Angular_CLI_Sources_Update`;
return new Promise((resolve, reject) => {
get(url, options, (res) => {
let data = '';
res
.on('data', (chunk) => {
data += chunk;
})
.on('end', () => {
resolve(data);
});
}).on('error', (e) => {
reject(e);
});
});
}
main().catch((err) => {
console.error(err);
process.exit(1);
});
+82
View File
@@ -0,0 +1,82 @@
/*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {ViewportScroller} from '@angular/common';
import {
Injectable,
inject,
ApplicationRef,
afterNextRender,
EnvironmentInjector,
} from '@angular/core';
import {Scroll, Router} from '@angular/router';
import {filter, firstValueFrom, map, switchMap, tap} from 'rxjs';
@Injectable({providedIn: 'root'})
export class AppScroller {
private readonly router = inject(Router);
private readonly viewportScroller = inject(ViewportScroller);
private readonly appRef = inject(ApplicationRef);
private readonly injector = inject(EnvironmentInjector);
disableScrolling = false;
private _lastScrollEvent?: Scroll;
private canScroll = false;
private cancelScroll?: () => void;
get lastScrollEvent(): Scroll | undefined {
return this._lastScrollEvent;
}
constructor() {
this.viewportScroller.setHistoryScrollRestoration('manual');
this.router.events
.pipe(
filter((e): e is Scroll => e instanceof Scroll),
tap((e) => {
this.cancelScroll?.();
this.canScroll = true;
this._lastScrollEvent = e;
}),
filter(() => !this.disableScrolling),
switchMap((e) => {
return firstValueFrom(
this.appRef.isStable.pipe(
filter((stable) => stable),
map(() => e),
),
);
}),
)
.subscribe(() => {
this.scroll();
});
}
scroll() {
if (!this._lastScrollEvent || !this.canScroll) {
return;
}
// Prevent double scrolling on the same event
this.canScroll = false;
const {anchor, position} = this._lastScrollEvent;
// Don't scroll during rendering
this.cancelScroll = afterNextRender(
{
write: () => {
if (position) {
this.viewportScroller.scrollToPosition(position);
} else if (anchor) {
this.viewportScroller.scrollToAnchor(anchor);
} else {
this.viewportScroller.scrollToPosition([0, 0]);
}
},
},
{injector: this.injector},
).destroy;
}
}
+5 -5
View File
@@ -1,13 +1,13 @@
@defer (when isBrowser) {
<adev-progress-bar />
<adev-progress-bar />
}
<button (click)="focusFirstHeading()" class="adev-skip">Skip to main content</button>
<div class="adev-nav"></div>
@if (displaySecondaryNav()) {
<adev-secondary-navigation />
<adev-secondary-navigation />
}
<div class="adev-app-main-content">
<div class="docs-app-main-content">
<!--
Avoid rendering cookies popup on the server,
since there is no benefit of doing this and
@@ -22,9 +22,9 @@
}
}
}
<router-outlet />
<router-outlet />
@if (displayFooter()) {
<footer adev-footer></footer>
<footer adev-footer></footer>
}
</div>
+3 -3
View File
@@ -12,9 +12,9 @@
flex-direction: column;
}
// If navs are open, render a blurry background over content
&:has(.adev-nav-secondary--open),
&:has(.docs-nav-secondary--open),
&:has(.adev-nav-primary--open) {
.adev-app-main-content {
.docs-app-main-content {
&::after {
visibility: visible;
opacity: 1;
@@ -54,7 +54,7 @@
}
}
.adev-app-main-content {
.docs-app-main-content {
display: flex;
flex-direction: column;
min-height: 100vh;
+7 -1
View File
@@ -11,10 +11,12 @@ import {AppComponent} from './app.component';
import {provideRouter} from '@angular/router';
import {routes} from './routes';
import {Search, WINDOW} from '@angular/docs';
import {CURRENT_MAJOR_VERSION} from './core/providers/current-version';
describe('AppComponent', () => {
const fakeSearch = {};
const fakeWindow = {};
const fakeWindow = {location: {hostname: 'angular.dev'}};
const fakeCurrentMajorVersion = 19;
it('should create the app', () => {
TestBed.configureTestingModule({
@@ -28,6 +30,10 @@ describe('AppComponent', () => {
provide: Search,
useValue: fakeSearch,
},
{
provide: CURRENT_MAJOR_VERSION,
useValue: fakeCurrentMajorVersion,
},
],
});
const fixture = TestBed.createComponent(AppComponent);
+33 -23
View File
@@ -7,7 +7,17 @@
*/
import {DOCUMENT, isPlatformBrowser} from '@angular/common';
import {Component, inject, NgZone, OnInit, PLATFORM_ID, signal, WritableSignal} from '@angular/core';
import {
afterNextRender,
ChangeDetectionStrategy,
Component,
inject,
Injector,
OnInit,
PLATFORM_ID,
signal,
WritableSignal,
} from '@angular/core';
import {NavigationEnd, NavigationSkipped, Router, RouterLink, RouterOutlet} from '@angular/router';
import {filter, map, skip} from 'rxjs/operators';
import {
@@ -15,17 +25,18 @@ import {
getActivatedRouteSnapshotFromRouter,
IS_SEARCH_DIALOG_OPEN,
SearchDialog,
WINDOW,
} from '@angular/docs';
import {Footer} from './core/layout/footer/footer.component';
import {Navigation} from './core/layout/navigation/navigation.component';
import {SecondaryNavigation} from './core/layout/secondary-navigation/secondary-navigation.component';
import {ProgressBarComponent} from './core/layout/progress-bar/progress-bar.component';
import {ESCAPE, SEARCH_TRIGGER_KEY} from './core/constants/keys';
import {HeaderService} from './core/services/header.service';
@Component({
standalone: true,
selector: 'adev-root',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
CookiePopup,
Navigation,
@@ -38,12 +49,14 @@ import {ESCAPE, SEARCH_TRIGGER_KEY} from './core/constants/keys';
],
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
host: {
'(window:keydown)': 'setSearchDialogVisibilityOnKeyPress($event)',
},
})
export class AppComponent implements OnInit {
private readonly document = inject(DOCUMENT);
private readonly ngZone = inject(NgZone);
private readonly router = inject(Router);
private readonly window = inject(WINDOW);
private readonly headerService = inject(HeaderService);
currentUrl = signal('');
displayFooter = signal(false);
@@ -53,7 +66,6 @@ export class AppComponent implements OnInit {
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
ngOnInit(): void {
this.setSearchDialogVisibilityOnKeyPress();
this.closeSearchDialogOnNavigationSkipped();
this.router.events
.pipe(
@@ -64,6 +76,8 @@ export class AppComponent implements OnInit {
this.currentUrl.set(url);
this.setComponentsVisibility();
this.displaySearchDialog.set(false);
this.updateCanonicalLink(url);
});
this.focusFirstHeadingOnRouteChange();
@@ -78,6 +92,10 @@ export class AppComponent implements OnInit {
h1?.focus();
}
private updateCanonicalLink(absoluteUrl: string) {
this.headerService.setCanonical(absoluteUrl);
}
private setComponentsVisibility(): void {
const activatedRoute = getActivatedRouteSnapshotFromRouter(this.router as any);
@@ -97,24 +115,16 @@ export class AppComponent implements OnInit {
});
}
private setSearchDialogVisibilityOnKeyPress(): void {
this.ngZone.runOutsideAngular(() => {
this.window.addEventListener('keydown', (event: KeyboardEvent) => {
if (event.key === SEARCH_TRIGGER_KEY && (event.metaKey || event.ctrlKey)) {
this.ngZone.run(() => {
event.preventDefault();
this.displaySearchDialog.update((display) => !display);
});
}
private setSearchDialogVisibilityOnKeyPress(event: KeyboardEvent): void {
if (event.key === SEARCH_TRIGGER_KEY && (event.metaKey || event.ctrlKey)) {
event.preventDefault();
this.displaySearchDialog.update((display) => !display);
}
if (event.key === ESCAPE && this.displaySearchDialog()) {
this.ngZone.run(() => {
event.preventDefault();
this.displaySearchDialog.set(false);
});
}
});
});
if (event.key === ESCAPE && this.displaySearchDialog()) {
event.preventDefault();
this.displaySearchDialog.set(false);
}
}
private closeSearchDialogOnNavigationSkipped(): void {
+17 -3
View File
@@ -12,8 +12,9 @@ import {
ApplicationConfig,
ENVIRONMENT_INITIALIZER,
ErrorHandler,
VERSION,
inject,
provideZoneChangeDetection,
provideExperimentalZonelessChangeDetection,
} from '@angular/core';
import {
DOCS_CONTENT_LOADER,
@@ -31,6 +32,7 @@ import {
TitleStrategy,
createUrlTreeFromSnapshot,
provideRouter,
withComponentInputBinding,
withInMemoryScrolling,
withViewTransitions,
} from '@angular/router';
@@ -44,12 +46,14 @@ import {ExampleContentLoader} from './core/services/example-content-loader.servi
import {ReuseTutorialsRouteStrategy} from './features/tutorial/tutorials-route-reuse-strategy';
import {routes} from './routes';
import {ReferenceScrollHandler} from './features/references/services/reference-scroll-handler.service';
import {CURRENT_MAJOR_VERSION} from './core/providers/current-version';
import {AppScroller} from './app-scroller';
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(
routes,
withInMemoryScrolling({anchorScrolling: 'enabled', scrollPositionRestoration: 'enabled'}),
withInMemoryScrolling(),
withViewTransitions({
onViewTransitionCreated: ({transition, to}) => {
const router = inject(Router);
@@ -67,11 +71,22 @@ export const appConfig: ApplicationConfig = {
}
},
}),
withComponentInputBinding(),
),
provideExperimentalZonelessChangeDetection(),
provideClientHydration(),
provideHttpClient(withFetch()),
provideAnimationsAsync(),
{
provide: CURRENT_MAJOR_VERSION,
useValue: Number(VERSION.major),
},
{provide: ENVIRONMENT, useValue: environment},
{
provide: ENVIRONMENT_INITIALIZER,
multi: true,
useValue: () => inject(AppScroller),
},
{
provide: ENVIRONMENT_INITIALIZER,
multi: true,
@@ -91,7 +106,6 @@ export const appConfig: ApplicationConfig = {
deps: [DOCUMENT],
},
{provide: TitleStrategy, useClass: ADevTitleStrategy},
provideZoneChangeDetection({eventCoalescing: true}),
ReferenceScrollHandler,
],
};
+3 -2
View File
@@ -8,5 +8,6 @@
export const GITHUB = 'https://github.com/angular/angular';
export const X = 'https://x.com/angular';
export const MEDIUM = 'https://blog.angular.io';
export const YOUTUBE = 'https://www.youtube.com/channel/UCbn1OgGei-DV7aSRo_HaAiw';
export const MEDIUM = 'https://blog.angular.dev';
export const YOUTUBE = 'https://www.youtube.com/angular';
export const DISCORD = 'https://discord.gg/angular';
+73
View File
@@ -0,0 +1,73 @@
/*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export const VERSIONS_CONFIG = {
aDevVersionsLinkPattern: 'https://{{prefix}}{{version}}angular.dev',
aioVersions: [
{
version: 'v17',
url: 'https://v17.angular.io/docs',
},
{
version: 'v16',
url: 'https://v16.angular.io/docs',
},
{
version: 'v15',
url: 'https://v15.angular.io/docs',
},
{
version: 'v14',
url: 'https://v14.angular.io/docs',
},
{
version: 'v13',
url: 'https://v13.angular.io/docs',
},
{
version: 'v12',
url: 'https://v12.angular.io/docs',
},
{
version: 'v11',
url: 'https://v11.angular.io/docs',
},
{
version: 'v10',
url: 'https://v10.angular.io/docs',
},
{
version: 'v9',
url: 'https://v9.angular.io/docs',
},
{
version: 'v8',
url: 'https://v8.angular.io/docs',
},
{
version: 'v7',
url: 'https://v7.angular.io/docs',
},
{
version: 'v6',
url: 'https://v6.angular.io/docs',
},
{
version: 'v5',
url: 'https://v5.angular.io/docs',
},
{
version: 'v4',
url: 'https://v4.angular.io/docs',
},
{
version: 'v2',
url: 'https://v2.angular.io/docs',
},
],
};
+2
View File
@@ -17,6 +17,7 @@ export enum PagePrefix {
PLAYGROUND = 'playground',
REFERENCE = 'reference',
TUTORIALS = 'tutorials',
UPDATE = 'update-guide',
}
// The enum with the default pages for each main tab
@@ -25,4 +26,5 @@ export enum DefaultPage {
REFERENCE = 'api',
TUTORIALS = 'tutorials',
PLAYGROUND = 'playground',
UPDATE = 'update-guide',
}
@@ -116,7 +116,7 @@
</div>
</div>
<p class="docs-license">
Super-powered by Google ©2010-2023. Code licensed under an
Super-powered by Google ©2010-2024. Code licensed under an
<a routerLink="/license" title="License text">MIT-style License</a>
. Documentation licensed under
<a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>
@@ -77,6 +77,8 @@
}
.adev-version-picker {
overflow-y: auto;
max-height: 90vh;
top: 30px;
left: 10px;
position: absolute;
@@ -86,8 +88,8 @@
padding-inline: 0;
}
li button {
min-height: fit-content;
li a {
line-height: 1em;
}
@include mq.for-tablet {
@@ -59,8 +59,11 @@
</div>
<nav
class="adev-nav-primary adev-scroll-hide"
class="adev-nav-primary docs-scroll-hide"
[class.adev-nav-primary--open]="isMobileNavigationOpened()"
[class.adev-nav-primary--rc]="currentDocsVersionMode === 'rc'"
[class.adev-nav-primary--next]="currentDocsVersionMode === 'next'"
[class.adev-nav-primary--deprecated]="currentDocsVersionMode === 'deprecated'"
>
<button
type="button"
@@ -79,7 +82,8 @@
>
<a aria-label="Angular homepage" routerLink="/">
<!-- Logo Symbol -->
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 223 236" width="32">
@if(!isUwu) {
<svg class="angular-logo" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 223 236" width="32">
<g clip-path="url(#a)">
<path
fill="url(#b)"
@@ -122,11 +126,18 @@
</clipPath>
</defs>
</svg>
<div class="adev-beta-version">Beta Docs</div>
} @else {
<img
src="assets/images/uwu.png"
style="width: auto; margin: 0"
class="uwu-logo"
alt="Angular logo"
height="34"/>
}
</a>
<!-- Version picker for v18+ -->
<!-- <div class="adev-nav-item">
<div class="adev-nav-item">
<button
type="button"
aria-label="Select Angular version"
@@ -154,19 +165,19 @@
<ul class="adev-mini-menu adev-version-picker" cdkMenu>
@for (item of versions(); track item) {
<li>
<button
<a
type="button"
cdkMenuItem
(click)="redirectToDocsVersion(item.url)"
[href]="item.url"
[attr.aria-label]="item.displayName"
>
<span>{{ item.displayName }}</span>
</button>
</a>
</li>
}
</ul>
</ng-template>
</div> -->
</div>
</li>
<!-- Search -->
@@ -369,6 +380,24 @@
</svg>
</a>
</li>
<li>
<a [href]="DISCORD" cdkMenuItem title="Angular Discord" target="_blank" rel="noopener">
<!-- Discord Icon -->
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 127.14 96.36"
width="20"
height="20"
fill="none"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M107.7,8.07A105.15,105.15,0,0,0,81.47,0a72.06,72.06,0,0,0-3.36,6.83A97.68,97.68,0,0,0,49,6.83,72.37,72.37,0,0,0,45.64,0,105.89,105.89,0,0,0,19.39,8.09C2.79,32.65-1.71,56.6.54,80.21h0A105.73,105.73,0,0,0,32.71,96.36,77.7,77.7,0,0,0,39.6,85.25a68.42,68.42,0,0,1-10.85-5.18c.91-.66,1.8-1.34,2.66-2a75.57,75.57,0,0,0,64.32,0c.87.71,1.76,1.39,2.66,2a68.68,68.68,0,0,110.87,5.19,77,77,0,0,0,6.89,11.1A105.25,105.25,0,0,0,126.6,80.22h0C129.24,52.84,122.09,29.11,107.7,8.07ZM42.45,65.69C36.18,65.69,31,60,31,53s5-12.74,11.43-12.74S54,46,53.89,53,48.84,65.69,42.45,65.69Zm42.24,0C78.41,65.69,73.25,60,73.25,53s5-12.74,11.44-12.74S96.23,46,96.12,53,91.08,65.69,84.69,65.69Z"
/>
</svg>
</a>
</li>
</ul>
</ng-template>
</div>
@@ -69,6 +69,23 @@
padding-block-end: 2rem;
box-sizing: border-box;
&.adev-nav-primary--next,
&.adev-nav-primary--rc {
// change nav background to indicate this is the rc docs
background: linear-gradient(
140deg,
color-mix(in srgb, var(--orange-red), transparent 60%) 0%,
color-mix(in srgb, var(--vivid-pink), transparent 40%) 15%,
color-mix(in srgb, var(--electric-violet), transparent 70%) 25%,
color-mix(in srgb, var(--bright-blue), transparent 60%) 90%,
);
}
&.adev-nav-primary--deprecated {
// change nav background to indicate this is an outdated version of the docs
background-color: color-mix(in srgb, var(--symbolic-gray), transparent 30%);
}
// div containing mobile close button and adev-nav_top
> div {
display: flex;
@@ -129,13 +146,6 @@
flex-direction: row;
}
.adev-beta-version {
font-family: 'Material Symbols Outlined';
text-transform: uppercase;
text-align: center;
line-height: normal;
}
// version dropdown button
.adev-version-button {
border: 1px solid var(--senary-contrast);
@@ -237,6 +247,10 @@
}
}
.adev-nav-item--logo a {
height: 34px;
}
.adev-close-nav {
display: none;
@include mq.for-phone-only {
@@ -27,10 +27,10 @@ import {
isApple,
IS_SEARCH_DIALOG_OPEN,
} from '@angular/docs';
import {NavigationEnd, Router, RouterLink} from '@angular/router';
import {ActivatedRoute, NavigationEnd, Router, RouterLink} from '@angular/router';
import {filter, map, startWith} from 'rxjs/operators';
import {DOCS_ROUTES, REFERENCE_ROUTES, TUTORIALS_ROUTES} from '../../../routes';
import {GITHUB, MEDIUM, X, YOUTUBE} from '../../constants/links';
import {GITHUB, MEDIUM, X, YOUTUBE, DISCORD} from '../../constants/links';
import {PagePrefix} from '../../enums/pages';
import {Theme, ThemeManager} from '../../services/theme-manager.service';
import {VersionManager} from '../../services/version-manager.service';
@@ -79,10 +79,14 @@ export class Navigation implements OnInit {
readonly X = X;
readonly MEDIUM = MEDIUM;
readonly YOUTUBE = YOUTUBE;
readonly DISCORD = DISCORD;
readonly PRIMARY_NAV_ID = PRIMARY_NAV_ID;
readonly SECONDARY_NAV_ID = SECONDARY_NAV_ID;
// We can't use the ActivatedRouter queryParams as we're outside the router outlet
readonly isUwu = 'location' in globalThis ? location.search.includes('uwu') : false;
miniMenuPositions = [
new ConnectionPositionPair(
{originX: 'end', originY: 'center'},
@@ -102,6 +106,8 @@ export class Navigation implements OnInit {
openedMenu: MenuType | null = null;
currentDocsVersion = this.versionManager.currentDocsVersion;
currentDocsVersionMode = this.versionManager.currentDocsVersion()?.version;
// Set the values of the search label and title only on the client, because the label is user-agent specific.
searchLabel = this.isBrowser
? isApple
@@ -125,10 +131,6 @@ export class Navigation implements OnInit {
this.closeMobileNavOnPrimaryRouteChange();
}
redirectToDocsVersion(versionUrl: string): void {
this.window.location.href = versionUrl;
}
setTheme(theme: Theme): void {
this.themeManager.setTheme(theme);
}
@@ -197,7 +199,8 @@ export class Navigation implements OnInit {
this.activeRouteItem.set(PagePrefix.DOCS);
} else if (
urlAfterRedirects.startsWith(PagePrefix.REFERENCE) ||
urlAfterRedirects.startsWith(PagePrefix.API)
urlAfterRedirects.startsWith(PagePrefix.API) ||
urlAfterRedirects.startsWith(PagePrefix.UPDATE)
) {
this.activeRouteItem.set(PagePrefix.REFERENCE);
} else if (urlAfterRedirects === PagePrefix.PLAYGROUND) {
@@ -8,7 +8,8 @@
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {ProgressBarComponent} from './progress-bar.component';
import {PROGRESS_BAR_DELAY, ProgressBarComponent} from './progress-bar.component';
import {RouterTestingHarness, RouterTestingModule} from '@angular/router/testing';
describe('ProgressBarComponent', () => {
let component: ProgressBarComponent;
@@ -16,7 +17,7 @@ describe('ProgressBarComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ProgressBarComponent],
imports: [ProgressBarComponent, RouterTestingModule],
}).compileComponents();
fixture = TestBed.createComponent(ProgressBarComponent);
@@ -24,7 +25,13 @@ describe('ProgressBarComponent', () => {
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
it('should call progressBar.complete() on route change', async () => {
const progressBarCompleteSpy = spyOn(component.progressBar, 'complete');
const harness = await RouterTestingHarness.create();
await harness.navigateByUrl('/');
await new Promise((resolve) => setTimeout(resolve, PROGRESS_BAR_DELAY));
expect(progressBarCompleteSpy).toHaveBeenCalled();
});
});
@@ -27,7 +27,7 @@ import {
import {filter, map, switchMap, take} from 'rxjs/operators';
/** Time to wait after navigation starts before showing the progress bar. This delay allows a small amount of time to skip showing the progress bar when a navigation is effectively immediate. 30ms is approximately the amount of time we can wait before a delay is perceptible.*/
const PROGRESS_BAR_DELAY = 30;
export const PROGRESS_BAR_DELAY = 30;
@Component({
selector: 'adev-progress-bar',
@@ -1,5 +1,5 @@
<div [attr.id]="SECONDARY_NAV_ID" class="adev-secondary-nav-mask" [class.adev-nav-secondary--open]="isSecondaryNavVisible()" (docsClickOutside)="close()" [docsClickOutsideIgnore]="[PRIMARY_NAV_ID]">
<div class="adev-nav-secondary adev-scroll-track-transparent" [style.transform]="translateX()" [style.transition]="transition">
<div [attr.id]="SECONDARY_NAV_ID" class="adev-secondary-nav-mask" [class.docs-nav-secondary--open]="isSecondaryNavVisible()" (docsClickOutside)="close()" [docsClickOutsideIgnore]="[PRIMARY_NAV_ID]">
<div class="docs-nav-secondary docs-scroll-track-transparent" [style.transform]="translateX()" [style.transition]="transition()">
<!-- Secondary Nav -->
@if (navigationItems && navigationItems.length > 0) {
<docs-navigation-list
@@ -1,24 +1,21 @@
@use '@angular/docs/styles/media-queries' as mq;
:host {
z-index: 100;
@include mq.for-tablet-landscape-up {
position: sticky;
top: 0;
// Render secondary nav below primary nav
z-index: 99;
}
@include mq.for-tablet-landscape-down {
position: fixed;
// Render secondary nav above mobile menu
z-index: 100;
}
@include mq.for-phone-only {
transform: translateX(0);
z-index: 99;
transition: transform 0.3s ease;
&:has(.adev-nav-secondary--open) {
&:has(.docs-nav-secondary--open) {
transform: translateX(82px);
transition: transform 0.3s ease-in 0.3s;
}
@@ -40,13 +37,16 @@
transition: transform 0.45s ease;
@media (prefers-reduced-motion: no-preference) {
transition: transform 0.45s ease, background-color 0.3s ease, border-color 0.3s ease;
transition:
transform 0.45s ease,
background-color 0.3s ease,
border-color 0.3s ease;
}
@include mq.for-tablet-landscape-down {
transform: translateX(-100%);
&.adev-nav-secondary--open {
&.docs-nav-secondary--open {
transform: translateX(0);
}
}
@@ -56,7 +56,7 @@
// exit immediately
transition: transform 0.45s ease-in;
&.adev-nav-secondary--open {
&.docs-nav-secondary--open {
transform: translateX(0);
// enter delayed
transition: transform 0.45s ease-out 0.2s;
@@ -64,8 +64,8 @@
}
}
// seconday nav - translated on x to display levels
.adev-nav-secondary {
// secondary nav - translated on x to display levels
.docs-nav-secondary {
display: flex;
flex-direction: row;
max-width: var(--secondary-nav-width);
@@ -14,6 +14,7 @@ import {
PLATFORM_ID,
computed,
inject,
signal,
} from '@angular/core';
import {takeUntilDestroyed, toObservable} from '@angular/core/rxjs-interop';
import {
@@ -64,19 +65,19 @@ export class SecondaryNavigation implements OnInit {
private readonly router = inject(Router);
private readonly window = inject(WINDOW);
isSecondaryNavVisible = this.navigationState.isMobileNavVisible;
primaryActiveRouteItem = this.navigationState.primaryActiveRouteItem;
maxVisibleLevelsOnSecondaryNav = computed(() =>
readonly isSecondaryNavVisible = this.navigationState.isMobileNavVisible;
readonly primaryActiveRouteItem = this.navigationState.primaryActiveRouteItem;
readonly maxVisibleLevelsOnSecondaryNav = computed(() =>
this.primaryActiveRouteItem() === PagePrefix.REFERENCE ? 1 : 2,
);
navigationItemsSlides = this.navigationState.expandedItems;
readonly navigationItemsSlides = this.navigationState.expandedItems;
navigationItems: NavigationItem[] | undefined;
translateX = computed(() => {
const level = this.navigationState.expandedItems()?.length ?? 0;
return `translateX(${-level * 100}%)`;
});
transition: string = '0ms';
transition = signal('0ms');
readonly PRIMARY_NAV_ID = PRIMARY_NAV_ID;
readonly SECONDARY_NAV_ID = SECONDARY_NAV_ID;
@@ -182,7 +183,7 @@ export class SecondaryNavigation implements OnInit {
return;
}
setTimeout(() => {
this.transition = `${ANIMATION_DURATION}ms`;
this.transition.set(`${ANIMATION_DURATION}ms`);
}, ANIMATION_DURATION);
}
@@ -0,0 +1,3 @@
import {InjectionToken} from '@angular/core';
export const CURRENT_MAJOR_VERSION = new InjectionToken<number>('CURRENT_MAJOR_VERSION');
@@ -7,8 +7,9 @@
*/
import {Injector} from '@angular/core';
import {ENVIRONMENT, WINDOW} from '@angular/docs';
import {ENVIRONMENT, WINDOW, LOCAL_STORAGE} from '@angular/docs';
import {AnalyticsService} from './analytics.service';
import {MockLocalStorage} from '@angular/docs/testing';
describe('AnalyticsService', () => {
let service: AnalyticsService;
@@ -18,6 +19,7 @@ describe('AnalyticsService', () => {
let windowOnErrorHandler: (event: ErrorEvent) => void;
let mockWindow: any;
let mockLocalStorage = new MockLocalStorage();
beforeEach(() => {
gtagSpy = jasmine.createSpy('gtag');
@@ -39,6 +41,7 @@ describe('AnalyticsService', () => {
{provide: ENVIRONMENT, useValue: {}},
{provide: AnalyticsService, deps: [WINDOW]},
{provide: WINDOW, useFactory: () => mockWindow, deps: []},
{provide: LOCAL_STORAGE, useValue: mockLocalStorage},
],
});
@@ -8,7 +8,7 @@
import {inject, Injectable} from '@angular/core';
import {WINDOW, ENVIRONMENT} from '@angular/docs';
import {WINDOW, ENVIRONMENT, LOCAL_STORAGE, STORAGE_KEY, setCookieConsent} from '@angular/docs';
import {formatErrorEventForAnalytics} from './analytics-format-error';
@@ -28,6 +28,7 @@ interface WindowWithAnalytics extends Window {
export class AnalyticsService {
private environment = inject(ENVIRONMENT);
private window: WindowWithAnalytics = inject(WINDOW);
private readonly localStorage = inject(LOCAL_STORAGE);
constructor() {
this._installGlobalSiteTag();
@@ -64,6 +65,21 @@ export class AnalyticsService {
window.gtag = function () {
window.dataLayer?.push(arguments);
};
// Cookie banner consent initial state
// This code is modified in the @angular/docs package in the cookie-popup component.
// Docs: https://developers.google.com/tag-platform/security/guides/consent
if (this.localStorage) {
if (this.localStorage.getItem(STORAGE_KEY) === 'true') {
setCookieConsent('granted');
} else {
setCookieConsent('denied');
}
} else {
// In case localStorage is not available, we default to denying cookies.
setCookieConsent('denied');
}
window.gtag('js', new Date());
// Configure properties before loading the script. This is necessary to avoid
@@ -10,6 +10,7 @@ import {HttpClient} from '@angular/common/http';
import {Injectable, inject} from '@angular/core';
import {DocContent, DocsContentLoader} from '@angular/docs';
import {Router} from '@angular/router';
import {firstValueFrom} from 'rxjs';
import {map} from 'rxjs/operators';
@Injectable()
@@ -27,13 +28,14 @@ export class ContentLoader implements DocsContentLoader {
try {
this.cache.set(
path,
this.httpClient
firstValueFrom(
this.httpClient
.get(`assets/content/${path}`, {
responseType: 'text',
})
.pipe(map((contents) => ({contents, id: path})))
.toPromise()
);
.pipe(map((contents) => ({contents, id: path}))),
),
);
} catch {
this.router.navigateByUrl('/404');
}
@@ -45,7 +45,7 @@ export class CustomErrorHandler implements ErrorHandler {
openErrorSnackBar(): void {
this.snackBar
.openFromComponent(ErrorSnackBar, {
panelClass: 'adev-invert-mode',
panelClass: 'docs-invert-mode',
data: {
message: `Our docs have been updated, reload the page to see the latest.`,
actionText: `Reload`,
@@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/
import {Component, Inject} from '@angular/core';
import {ChangeDetectionStrategy, Component, Inject, inject} from '@angular/core';
import {MAT_SNACK_BAR_DATA, MatSnackBarAction, MatSnackBarRef} from '@angular/material/snack-bar';
export interface ErrorSnackBarData {
@@ -16,10 +16,11 @@ export interface ErrorSnackBarData {
@Component({
selector: 'error-snack-bar',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
{{ message }}
<button
class="adev-primary-btn"
class="docs-primary-btn"
type="button"
matSnackBarAction
[attr.text]="actionText"
@@ -28,18 +29,16 @@ export interface ErrorSnackBarData {
{{ actionText }}
</button>
`,
imports: [MatSnackBarAction],
standalone: true,
imports: [MatSnackBarAction],
styles: `:host { display: flex; align-items: center; button { margin-left: 16px }}`,
})
export class ErrorSnackBar {
protected message: string;
protected actionText?: string;
constructor(
protected snackBarRef: MatSnackBarRef<ErrorSnackBar>,
@Inject(MAT_SNACK_BAR_DATA) public data: ErrorSnackBarData,
) {
constructor(protected snackBarRef: MatSnackBarRef<ErrorSnackBar>) {
const data = inject(MAT_SNACK_BAR_DATA) as ErrorSnackBarData;
this.message = data.message;
this.actionText = data.actionText;
}
@@ -0,0 +1,32 @@
/*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {TestBed} from '@angular/core/testing';
import {HeaderService} from './header.service';
import {link} from 'fs';
describe('HeaderService', () => {
let service: HeaderService;
beforeEach(() => {
service = TestBed.inject(HeaderService);
});
it('setCanonical', () => {
// setCanonical assumes there is a preexisting element
const linkEl = document.createElement('link');
linkEl.setAttribute('rel', 'canonical');
document.querySelector('head')?.appendChild(linkEl);
service.setCanonical('/some/link');
expect(document.querySelector('link[rel=canonical]')!.getAttribute('href')).toBe(
'https://angular.dev/some/link',
);
});
});
@@ -0,0 +1,32 @@
import {DOCUMENT} from '@angular/common';
import {Injectable, inject} from '@angular/core';
const ANGULAR_DEV = 'https://angular.dev';
/**
* Information about the deployment of this application.
*/
@Injectable({providedIn: 'root'})
export class HeaderService {
private readonly document = inject(DOCUMENT);
/**
* Sets the canonical link in the header.
* It supposes the header link is already present in the index.html
*
* The function behave invariably and will always point to angular.dev,
* no matter if it's a specific version build
*/
setCanonical(absolutePath: string): void {
const pathWithoutFragment = this.normalizePath(absolutePath).split('#')[0];
const fullPath = `${ANGULAR_DEV}/${pathWithoutFragment}`;
this.document.querySelector('link[rel=canonical]')?.setAttribute('href', fullPath);
}
private normalizePath(path: string): string {
if (path[0] === '/') {
return path.substring(1);
}
return path;
}
}
@@ -14,8 +14,8 @@ import {Subject} from 'rxjs';
// Keep these constants in sync with the code in index.html
export const THEME_PREFERENCE_LOCAL_STORAGE_KEY = 'themePreference';
export const DARK_MODE_CLASS_NAME = 'adev-dark-mode';
export const LIGHT_MODE_CLASS_NAME = 'adev-light-mode';
export const DARK_MODE_CLASS_NAME = 'docs-dark-mode';
export const LIGHT_MODE_CLASS_NAME = 'docs-light-mode';
export const PREFERS_COLOR_SCHEME_DARK = '(prefers-color-scheme: dark)';
export type Theme = 'dark' | 'light' | 'auto';
@@ -38,13 +38,13 @@ export class ThemeManager {
}
this.loadThemePreference();
this.watchPreferedColorScheme();
this.watchPreferredColorScheme();
}
setTheme(theme: Theme): void {
this.theme.set(theme);
this.setThemeInLocalStorage();
this.setThemeBodyClasses(theme === 'auto' ? preferedScheme() : theme);
this.setThemeBodyClasses(theme === 'auto' ? preferredScheme() : theme);
}
// 1. Read theme preferences stored in localStorage
@@ -54,7 +54,7 @@ export class ThemeManager {
const useTheme = savedUserPreference ?? 'auto';
this.theme.set(useTheme);
this.setThemeBodyClasses(useTheme === 'auto' ? preferedScheme() : useTheme);
this.setThemeBodyClasses(useTheme === 'auto' ? preferredScheme() : useTheme);
}
// Set theme classes on the body element
@@ -81,14 +81,14 @@ export class ThemeManager {
}
}
private watchPreferedColorScheme() {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (event) => {
const preferedScheme = event.matches ? 'dark' : 'light';
this.setThemeBodyClasses(preferedScheme);
private watchPreferredColorScheme() {
window.matchMedia(PREFERS_COLOR_SCHEME_DARK).addEventListener('change', (event) => {
const preferredScheme = event.matches ? 'dark' : 'light';
this.setThemeBodyClasses(preferredScheme);
});
}
}
function preferedScheme(): 'dark' | 'light' {
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
function preferredScheme(): 'dark' | 'light' {
return window.matchMedia(PREFERS_COLOR_SCHEME_DARK).matches ? 'dark' : 'light';
}
@@ -8,17 +8,52 @@
import {TestBed} from '@angular/core/testing';
import {VersionManager} from './version-manager.service';
import {INITIAL_ADEV_DOCS_VERSION, VersionManager} from './version-manager.service';
import {WINDOW} from '@angular/docs';
import {CURRENT_MAJOR_VERSION} from '../providers/current-version';
describe('VersionManager', () => {
const fakeWindow = {location: {hostname: 'angular.dev'}};
const fakeCurrentMajorVersion = 19;
let service: VersionManager;
beforeEach(() => {
TestBed.configureTestingModule({});
TestBed.configureTestingModule({
providers: [
{
provide: WINDOW,
useValue: fakeWindow,
},
{
provide: CURRENT_MAJOR_VERSION,
useValue: fakeCurrentMajorVersion,
},
],
});
service = TestBed.inject(VersionManager);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
it('should contain correct number of Angular Docs versions', () => {
// Note: From v2 to v17 (inclusive), there were no v3
const expectedAioDocsVersionsCount = 15;
// Last stable version and next
const expectedRecentDocsVersionCount = 2;
const expectedPreviousAdevVersionsCount = fakeCurrentMajorVersion - INITIAL_ADEV_DOCS_VERSION;
expect(service['getAioVersions']().length).toBe(expectedAioDocsVersionsCount);
expect(service['getRecentVersions']().length).toBe(expectedRecentDocsVersionCount);
expect(service['getAdevVersions']().length).toBe(expectedPreviousAdevVersionsCount);
expect(service.versions().length).toBe(
expectedAioDocsVersionsCount +
expectedRecentDocsVersionCount +
expectedPreviousAdevVersionsCount,
);
});
});
@@ -6,27 +6,10 @@
* found in the LICENSE file at https://angular.dev/license
*/
import {Injectable, VERSION, computed, signal} from '@angular/core';
// TODO(josephperrott): extract this out of the file into a managed location.
const VERSIONS_CONFIG = {
currentVersion: "stable",
historicalVersionsLinkPattern: "https://v{{version}}.angular.dev",
mainVersions: [
{
version: "stable",
url: "https://angular.dev"
},
{
version: "rc",
url: "https://rc.angular.dev"
},
{
version: "next",
url: "https://next.angular.dev"
}
]
};
import {Injectable, computed, inject, signal} from '@angular/core';
import {VERSIONS_CONFIG} from '../constants/versions';
import {WINDOW} from '@angular/docs';
import {CURRENT_MAJOR_VERSION} from '../providers/current-version';
export interface Version {
displayName: string;
@@ -34,41 +17,86 @@ export interface Version {
url: string;
}
export type VersionMode = 'stable' | 'rc' | 'next' | number;
export type VersionMode = 'stable' | 'deprecated' | 'rc' | 'next' | number;
export const INITIAL_DOCS_VERSION = 17;
export const VERSION_PATTERN_PLACEHOLDER = '{{version}}';
export const INITIAL_ADEV_DOCS_VERSION = 18;
export const VERSION_PLACEHOLDER = '{{version}}';
export const MODE_PLACEHOLDER = '{{prefix}}';
@Injectable({
providedIn: 'root',
})
export class VersionManager {
private readonly currentMajorVersion = inject(CURRENT_MAJOR_VERSION);
private readonly window = inject(WINDOW);
// Note: We can assume that if the URL starts with v{{version}}, it is documentation for previous versions of Angular.
// Based on URL we can indicate as well if it's rc or next Docs version.
private get currentVersionMode(): VersionMode {
const hostname = this.window.location.hostname;
if (hostname.startsWith('v')) return 'deprecated';
if (hostname.startsWith('rc')) return 'rc';
if (hostname.startsWith('next')) return 'next';
return 'stable';
}
versions = signal<Version[]>([
...VERSIONS_CONFIG.mainVersions.map((item) =>
this.mapToVersion(item as Pick<Version, 'url' | 'version'>),
),
...this.getHistoricalVersions(),
...this.getRecentVersions(),
...this.getAdevVersions(),
...this.getAioVersions(),
]);
currentDocsVersion = computed(() => {
return this.versions().find(
(version) => version.version.toString() === VERSIONS_CONFIG.currentVersion,
(version) => version.version.toString() === this.currentVersionMode,
);
});
private getHistoricalVersions(): Version[] {
const historicalVersions: Version[] = [];
for (let version = Number(VERSION.major) - 1; version >= INITIAL_DOCS_VERSION; version--) {
historicalVersions.push({
url: VERSIONS_CONFIG.historicalVersionsLinkPattern.replace(
VERSION_PATTERN_PLACEHOLDER,
version.toString(),
),
// List of Angular Docs versions which includes current version, next and rc.
private getRecentVersions(): Version[] {
return [
{
url: this.getAdevDocsUrl('next'),
displayName: `next`,
version: 'next',
},
// Note: 'rc' should not be visible for now
// {
// url: this.getAdevDocsUrl('rc'),
// displayName: `rc`,
// version: 'rc',
// },
{
url: 'https://angular.dev/',
displayName: this.getVersion(this.currentMajorVersion),
version: this.currentVersionMode,
},
];
}
// List of Angular Docs versions hosted on angular.dev domain.
private getAdevVersions(): Version[] {
const adevVersions: Version[] = [];
for (
let version = this.currentMajorVersion - 1;
version >= INITIAL_ADEV_DOCS_VERSION;
version--
) {
adevVersions.push({
url: this.getAdevDocsUrl(version),
displayName: this.getVersion(version),
version,
version: 'deprecated',
});
}
return historicalVersions;
return adevVersions;
}
// List of Angular Docs versions hosted on angular.io domain.
private getAioVersions(): Version[] {
return VERSIONS_CONFIG.aioVersions.map((item) =>
this.mapToVersion(item as Pick<Version, 'url' | 'version'>),
);
}
private mapToVersion(value: Pick<Version, 'url' | 'version'>): Version {
@@ -79,12 +107,23 @@ export class VersionManager {
}
private getVersion(versionMode: VersionMode): string {
if (versionMode === 'stable') {
return `v${VERSION.major}`;
if (versionMode === 'stable' || versionMode === 'deprecated') {
return `v${this.currentMajorVersion}`;
}
if (Number.isInteger(versionMode)) {
return `v${versionMode}`;
}
return versionMode.toString();
}
private getAdevDocsUrl(version: VersionMode): string {
const docsUrlPrefix = isNaN(Number(version)) ? `` : 'v';
return VERSIONS_CONFIG.aDevVersionsLinkPattern
.replace(MODE_PLACEHOLDER, docsUrlPrefix)
.replace(
VERSION_PLACEHOLDER,
`${version.toString() === 'stable' ? '' : `${version.toString()}.`}`,
);
}
}
+207
View File
@@ -0,0 +1,207 @@
# EmbeddedEditor components, services and functionality
- [Scenarios](#scenarios)
- [Loading a project](#loading-a-project)
- [Updating the code](#updating-the-code)
- [Creating a new file](#creating-a-new-file)
- [Deleting a file](#deleting-a-file)
- [Switching a project](#switching-a-project)
- [Components and services](#components-and-services)
- [EmbeddedEditor](#EmbeddedEditor)
- [CodeEditor](#CodeEditor)
- [CodeMirrorEditor](#CodeMirrorEditor)
- [TypeScript Web Worker](#typescript-web-worker)
- [Preview](#Preview)
- [Terminal](#Terminal)
- [InteractiveTerminal](#InteractiveTerminal)
- [Console](#Console)
- [NodeRuntimeSandbox](#NodeRuntimeSandbox)
- [NodeRuntimeState](#NodeRuntimeState)
- [EmbeddedTutorialManager](#EmbeddedTutorialManager)
- [EditorUiState](#EditorUiState)
- [DownloadManager](#DownloadManager)
- [AlertManager](#AlertManager)
- [TypingsLoader](#TypingsLoader)
## External libraries
- [WebContainers API](https://webcontainers.io/)
- [CodeMirror](https://codemirror.net/)
- [@typescript/vfs](https://www.npmjs.com/package/@typescript/vfs)
- [Xterm.js](https://xtermjs.org/)
## Notes
- See [scripts/tutorials/README.md](/scripts/tutorials/README.md) for more information about the tutorials script.
- See [adev/src/content/tutorials/README.md](/adev/src/content/tutorials/README.md) for more information about the tutorials content.
---
## Scenarios
### Loading a project
1. The page responsible for the embedded editor lazy loads the [`EmbeddedEditor`](./embedded-editor.component.ts) component and the [`NodeRuntimeSandbox`](./node-runtime-sandbox.service.ts), then triggers the initialization of all components and services. The embedded editor is available in the following pages:
- homepage: https://angular.dev
- playground: https://angular.dev/playground
- tutorial pages: https://angular.dev/tutorials
2. The project assets are fetched by the [`EmbeddedTutorialManager`](./embedded-tutorial-manager.service.ts). Meanwhile:
- The code editor is initialized
- The code editor initializes the TypeScript Web Worker, which initializes the "default file system map" using TypeScript's CDN.
- The WebContainer is initialized
- The terminal is initialized
3. The tutorial source code is mounted in the `WebContainer`'s filesystem by the [`NodeRuntimeSandbox`](./node-runtime-sandbox.service.ts)
4. The tutorial project dependencies are installed by the [`NodeRuntimeSandbox`](./node-runtime-sandbox.service.ts).
5. The development server is started by the [`NodeRuntimeSandbox`](./node-runtime-sandbox.service.ts) and the types are loaded by the [`TypingsLoader`](./typings-loader.service.ts) service.
6. The preview is loaded with the URL provided by the WebContainer API after the development server is started.
7. The project is ready.
### Updating the code
1. The user update the code in the code editor.
2. The code editor state is updated on real time, without debouncing so that the user can see the changes in the code editor and CodeMirror can handle the changes accordingly.
3. At the same time, the changes are sent to the TypeScript web worker to provide diagnostics, autocomplete and type features as soon as possible.
4. The code changes are debounced to be written in the WebContainer filesystem by the [`NodeRuntimeSandbox`](./node-runtime-sandbox.service.ts).
5. After the debounce time is reached, the code changes are written in the WebContainer filesystem by the [`NodeRuntimeSandbox`](./node-runtime-sandbox.service.ts), then the user can see the changes in the preview.
### Creating a new file
1. The user clicks on the new file button.
2. The new file tab is opened.
3. The user types the new file name.
4. If the file name is valid, the file is created in the WebContainer filesystem by the [`NodeRuntimeSandbox`](./node-runtime-sandbox.service.ts).
- `..` is disallowed in the file name to prevent users to create files outside the `src` directory.
5. The file is added to the TypeScript virtual file system, allowing the TypeScript web worker to provide diagnostics, autocomplete and type features for the new file. Also, exports from the new file are available in other files.
6. The new file is added as the last tab in the code editor and the new file can be edited.
Note: If the new file name matches a file that already exists but is hidden in the code editor, the content for that file will show up in the created file. An example for a file that always exists is `index.html`.
### Deleting a file
1. The user clicks on the delete file button.
2. The file is deleted from the WebContainer filesystem by the [`NodeRuntimeSandbox`](./node-runtime-sandbox.service.ts).
3. The file is removed from the TypeScript virtual file system.
4. The file is removed from the code editor tabs.
Note: Some files can't be deleted to prevent users to break the app, being `src/main.ts`and `src/index.html`
### Switching a project
The embedded editor considers a project change when the embedded editor was already initialized and the user changes the page in the following scenarios:
- Navigating through tutorial steps
- Going from the homepage after the embedded editor is initialized to the playground
- Going from a tutorial page to the playground
- Going from a tutorial page to the homepage
- Going from the playground to the homepage
When a project change is detected, the [`EmbeddedTutorialManager`](./embedded-tutorial-manager.service.ts) emits the `tutorialChanged` observable, which is listened in multiple sub-components and services, then each component/service performs the necessary operations to switch the project.
The following steps are executed on project change:
1. The new project files are fetched by the [`EmbeddedTutorialManager`](./embedded-tutorial-manager.service.ts).
2. The new project files are mounted in the WebContainer filesystem.
3. The TypeScript virtual filesystem is updated with the new files and contents.
4. The previous project and new project files are compared.
1. Files that are not available in the new project are deleted from the WebContainer filesystem.
2. Files that have the same path and name have their content replaced on the previous step when the files are mounted.
5. The previous project dependencies are compared with the new project dependencies.
1. If there are differences, a `npm install` is triggered, hiding the preview and going to the install loading step.
2. If there are no differences, the project is ready.
6. Some states are reset, for example the "reveal answer" state if the previous project was in the "reveal answer" state.
## Components and services
### [`EmbeddedEditor`](./embedded-editor.component.ts)
The embedded editor is the parent component that holds all the components and services that compose the embedded editor.
#### [`CodeEditor`](./code-editor/code-editor.component.ts)
The component that holds the code editor view and the code editor state.
##### [`CodeMirrorEditor`](./code-editor/code-mirror-editor.service.ts)
[CodeMirror](https://codemirror.net/) is the library used to handle the code editor.
The `CodeMirrorEditor` service manages the CodeMirror instance and all the interactions with the library used to handle the code editor.
- handle the file edits and the CodeMirror view and state
- handle the current project files in the code editor
- handle the file creations and deletions
- handle the file changes
- handle all the CodeMirror specific events and extensions
###### [TypeScript Web Worker](./code-editor/workers/typescript-vfs.worker.ts)
The TypeScript features are provided by the TypeScript web worker, that is initialized by the `CodeMirrorEditor` service.
The TypeScript web worker uses `@typescript/vfs` and the TypeScript language service to provide diagnostics, autocomplete and type features.
#### [`Preview`](./preview/preview.component.ts)
The preview component manages the `iframe` responsible for displaying the tutorial project preview, with the URL provided by the WebContainer API after the development server is started.
While the project is being initialized, the preview displays the loading state.
#### [`Terminal`](./terminal/terminal.component.ts)
[Xterm.js](https://xtermjs.org/) is the library used to handle the terminals.
The terminal component handles the Xterm.js instance for the console and for the interactive terminal.
##### [`InteractiveTerminal`](./terminal/interactive-terminal.ts)
The interactive terminal is the terminal where the user can interact with the terminal and run commands, supporting only commands for the Angular CLI.
##### Console
The console displays the output for `npm install` and `ng serve`.
#### [`NodeRuntimeSandbox`](./node-runtime-sandbox.service.ts)
Responsible for managing the WebContainer instance and all communication with its API. This service handles:
- the WebContainer instance
- all Node.js scripts
- the WebContainer filesystem, mounting the tutorial project files, writing new content, deleting and creating files.
- the terminal session, reading and processing user inputs.
- the tutorial project dependencies, installing the dependencies.
- the processes running inside the WebContainer, being the npm scripts to install the dependencies, run the development server and the user inputs for the `ng` CLI.
##### [`NodeRuntimeState`](./node-runtime-state.service.ts)
Manages the [`NodeRuntimeSandbox`](./node-runtime-sandbox.service.ts) loading and error state.
#### [`EmbeddedTutorialManager`](./embedded-tutorial-manager.service.ts)
Manages the tutorial assets, being responsible for fetching the tutorial source code and metadata.
The source code is mounted in the WebContainer filesystem by the [`NodeRuntimeSandbox`](./node-runtime-sandbox.service.ts).
The metadata is used to manage the project, handle the project changes and the user interactivity with the app.
This service also handles the reveal answer and reset reveal answer feature.
#### [`EditorUiState`](./editor-ui-state.service.ts)
Manages the editor UI state, being responsible for handling the user interactions with the editor tabs, switching between the preview, the terminal and the console.
#### [`DownloadManager`](./download-manager.service.ts)
Responsible for handling the download button in the embedded editor, fetching the tutorial project files and generating a zip file with the project content.
#### [`AlertManager`](./alert-manager.service.ts)
Manage the alerts displayed in the embedded editor, being the out of memory alert when multiple tabs are opened, and unsupported environments alerts.
#### [`TypingsLoader`](./typings-loader.service.ts)
Manages the types definitions for the code editor.
+1 -1
View File
@@ -95,7 +95,7 @@ export class AlertManager {
}
this.snackBar.openFromComponent(ErrorSnackBar, {
panelClass: 'adev-invert-mode',
panelClass: 'docs-invert-mode',
data: {
message,
actionText: 'I understand',

Some files were not shown because too many files have changed in this diff Show More