https://github.com/angular/angular

sort by:
Revision Author Date Message Commit Date
b36d531 docs: fix missing security guide in navigation 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. 12 March 2024, 19:18:54 UTC
456f18b 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 12 March 2024, 18:38:59 UTC
db2f9a9 refactor(compiler-cli): cleanup unused code (#54775) The initializer api no longer needs to take care of `ɵoutput`. PR Close #54775 12 March 2024, 18:31:39 UTC
4ff94aa docs: improve in-depth guides information architecture (#54365) PR Close #54365 12 March 2024, 17:25:31 UTC
6a07c0c fix(docs-infra): remove the prerender directory from adev (#54820) Remove the prerender directory as it is entirely unused and unneeded PR Close #54820 12 March 2024, 17:24:04 UTC
1294b9a 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 12 March 2024, 17:21:48 UTC
8735af0 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 12 March 2024, 16:19:14 UTC
87cae55 docs: typo in output documentation (#54773) PR Close #54773 12 March 2024, 16:15:04 UTC
bea7f33 docs: update Angular CLI help [main] (#54815) Updated Angular CLI help contents. PR Close #54815 12 March 2024, 16:13:55 UTC
018f826 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 12 March 2024, 16:08:06 UTC
47f79e7 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 11 March 2024, 23:33:01 UTC
142825d 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 11 March 2024, 23:31:03 UTC
f0a2600 docs: use the right path for first-app images (#54694) PR Close #54694 11 March 2024, 23:30:28 UTC
6ea208e 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 11 March 2024, 22:52:42 UTC
9b424d7 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 11 March 2024, 22:52:41 UTC
83932aa 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 11 March 2024, 22:52:41 UTC
64f870c 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 11 March 2024, 20:46:11 UTC
d714e99 docs: bump to 2024 for copyright text (#54822) Bump copyright text to 2024 PR Close #54822 11 March 2024, 20:39:38 UTC
eaff724 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 11 March 2024, 19:46:16 UTC
280a3a2 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 11 March 2024, 18:12:43 UTC
837016c build: remove AIO related extensions (#54698) With AIO being deprecated those extensions can be removed. PR Close #54698 11 March 2024, 18:04:38 UTC
5ae2bf4 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 11 March 2024, 18:01:43 UTC
ffb9b44 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 11 March 2024, 18:01:42 UTC
fd17b4e 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 11 March 2024, 18:01:42 UTC
6235095 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 11 March 2024, 18:01:42 UTC
f86088f 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 11 March 2024, 18:01:42 UTC
09a2f3d docs: adding signal inputs and model to ADEV. (#54753) Those docs are a copy from AIO. PR Close #54753 11 March 2024, 18:00:49 UTC
55c647b docs: fix typo in tutorial (#54817) PR Close #54817 11 March 2024, 17:59:49 UTC
1c9abb9 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 11 March 2024, 17:59:07 UTC
81ccf5d 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 11 March 2024, 16:17:39 UTC
5b927c0 build: update to TypeScript 5.4 stable (#54743) Updates the repo to the stable version of TypeScript 5.4. PR Close #54743 11 March 2024, 16:16:55 UTC
d269c88 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 11 March 2024, 15:59:55 UTC
fa315d4 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 11 March 2024, 15:59:55 UTC
0bcaa0e 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 11 March 2024, 15:59:55 UTC
484ae23 build: remove non-exisiting target from `test:ci` (#54791) This target doesn't exist any more. PR Close #54791 11 March 2024, 14:06:50 UTC
54340a9 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 09 March 2024, 00:51:01 UTC
ef32b53 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 09 March 2024, 00:51:01 UTC
37d1f71 Revert "fix(core): `ApplicationRef.tick` should respect OnPush for host bindings (#53718)" (#54774) This reverts commit d888da460696ee74bb4c10a19ac49e3fa1948399. 08 March 2024, 13:57:15 UTC
fb189c6 Revert "refactor(compiler): rework defer block analysis (#54700)" (#54758) This reverts commit eee620aa0013cdb6e860f402d2064c50ada46d4e. 08 March 2024, 00:20:09 UTC
8180c39 build: fix size failure (#54756) Fixes a broken size CI check. PR Close #54756 08 March 2024, 00:13:43 UTC
115ee88 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 07 March 2024, 21:07:08 UTC
2787c50 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 07 March 2024, 20:59:10 UTC
d4247af 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 07 March 2024, 20:59:10 UTC
53e7439 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 07 March 2024, 20:59:09 UTC
43ab781 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 07 March 2024, 20:41:43 UTC
eee620a 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 07 March 2024, 20:40:44 UTC
d888da4 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 07 March 2024, 19:13:03 UTC
8bf842d docs: update content readme link (#53763) PR Close #53763 07 March 2024, 19:06:55 UTC
30dccd4 docs: readme from blossom (#53763) PR Close #53763 07 March 2024, 19:06:55 UTC
4f808ad docs: update events (#54721) Generated `events.json` with the latest events retrieved from the Firebase DB. PR Close #54721 07 March 2024, 19:05:36 UTC
e0c1f1e 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 07 March 2024, 19:01:29 UTC
9104c62 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 07 March 2024, 19:00:36 UTC
2258ac7 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 07 March 2024, 19:00:00 UTC
ef39107 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 07 March 2024, 18:49:01 UTC
126879e 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 07 March 2024, 18:49:01 UTC
cd242a1 refactor(core): Remove isInternal flag (#54740) This is not needed any longer since the changes that used it have landed. PR Close #54740 07 March 2024, 17:07:01 UTC
ad045ef 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 06 March 2024, 23:44:09 UTC
ba8e465 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 06 March 2024, 23:43:16 UTC
d9c0a16 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 06 March 2024, 21:34:53 UTC
24bc0ed 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 06 March 2024, 21:33:54 UTC
fc0f47c release: bump the next branch to v18.0.0-next.0 (#54737) 06 March 2024, 21:26:34 UTC
781dbe2 docs: release notes for the v17.3.0-rc.0 release 06 March 2024, 19:44:52 UTC
24a3536 release: bump the next branch to v17.4.0-next.0 06 March 2024, 19:44:52 UTC
4be9632 docs: release notes for the v17.2.4 release 06 March 2024, 19:34:37 UTC
7243c70 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 06 March 2024, 13:41:12 UTC
e5885fa build: update ng-dev to avoid node-fetch usages (#54715) See: https://github.com/angular/dev-infra/pull/1829 PR Close #54715 06 March 2024, 12:16:38 UTC
d4154f9 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 06 March 2024, 11:34:39 UTC
2df8584 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 06 March 2024, 11:34:39 UTC
8a8b682 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 06 March 2024, 11:34:39 UTC
6b1401a test: add compiler ngtsc tests for new `outputFromObservable` API (#54650) Adds additional ngtsc compiler tests for the `outputFromObservable` API. PR Close #54650 06 March 2024, 11:34:39 UTC
ea03104 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 06 March 2024, 11:34:39 UTC
400b739 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 06 March 2024, 11:34:39 UTC
500a13e 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 06 March 2024, 11:34:39 UTC
db7962a test: add runtime tests for `output()` function API (#54650) Adds runtime acceptance tests for `output()` and `outputFromObservable()`. PR Close #54650 06 March 2024, 11:34:39 UTC
866271a 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 06 March 2024, 11:34:39 UTC
30355f6 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 06 March 2024, 11:34:38 UTC
e7ea6c0 test: add compliance generated output tests for `output()` (#54650) This commit adds compliance tests for the new output APIs. PR Close #54650 06 March 2024, 11:34:38 UTC
aff65fd 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 06 March 2024, 11:34:38 UTC
c809069 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 06 March 2024, 11:34:38 UTC
9b51292 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 06 March 2024, 11:34:38 UTC
c687b8f 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 06 March 2024, 11:34:38 UTC
9ce6277 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 06 March 2024, 11:34:38 UTC
2564b45 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 06 March 2024, 11:34:38 UTC
5afa4f0 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 06 March 2024, 11:34:38 UTC
bd60fb1 docs: update Angular CLI help [main] (#54712) Updated Angular CLI help contents. PR Close #54712 06 March 2024, 09:34:11 UTC
4842eed 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 06 March 2024, 09:18:03 UTC
755390a 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 05 March 2024, 18:11:41 UTC
d2ec5b6 docs: fix clipped `docs-code` block in `docs-reference-api-tab` (#54621) PR Close #54621 05 March 2024, 17:35:09 UTC
b5366f2 docs: fix tutorial preview size (#54621) PR Close #54621 05 March 2024, 17:35:06 UTC
40424fc docs: fix label on API link. (#54621) Remove the unecessary double quotes on a @see link. PR Close #54621 05 March 2024, 17:35:04 UTC
70996ed docs(docs-infra): remove unwanted styling on API page. (#54621) `box-sizing: border-box` prevents overflow caused by borders. PR Close #54621 05 March 2024, 17:35:02 UTC
0ecf515 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 05 March 2024, 17:16:30 UTC
b40f1e5 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 05 March 2024, 09:28:45 UTC
33a6fab 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 05 March 2024, 08:21:22 UTC
78e6911 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 04 March 2024, 18:07:39 UTC
5e32a77 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 04 March 2024, 17:15:54 UTC
6531e4c 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 04 March 2024, 16:41:17 UTC
07d5e42 docs: revise documentation for @for control flow, 'track $index' performance issues explanation, and confusing 'trackBy' mention (#53806) PR Close #53806 04 March 2024, 10:37:37 UTC
0ddae16 docs: queries as signals adev guide (#54505) Add a angular.dev version of queries as signals guide. PR Close #54505 04 March 2024, 10:11:16 UTC
07173fd 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 04 March 2024, 09:35:38 UTC
back to top