Commit graph

612 commits

Author SHA1 Message Date
arturovt
eddca4280b fix(zone.js): allow draining microtasks in Promise.then (through flag)
These changes are essentially the same as those introduced in
angular#45273, but they include backward compatibility
for applications that explicitly rely on the order in which microtasks are drained.

This is critically important for our code and other third-party code, which is
beyond our control, to work properly. If a microtask is scheduled within an event
listener to be executed "later", it should indeed be executed later and not synchronously,
as this would break the expected flow of code execution.

The simple code that reproduces the behavior that exists now:

```ts
Zone.current.fork({name: 'child'}).run(() => {
  const div = document.createElement('div');
  div.style.height = '200px';
  div.style.width = '200px';
  div.style.backgroundColor = 'red';
  document.body.appendChild(div);

  function listener() {
    Promise.resolve().then(() => {
      div.style.height = '400px';
    });
  }

  div.addEventListener('fakeEvent', listener);
  div.dispatchEvent(new Event('fakeEvent'));
  console.log(div.getBoundingClientRect().height); // 400
});
```

The code above logs 400 as the height, but it should actually log 200 because the
height is updated in a microtask within the event listener.

When using Angular with microfrontend applications, especially when other apps might be
using React, zone.js can disrupt the classical order of operations. For example, when using a
`react-component/trigger`, it schedules a microtask within an event listener using
`Promise.resolve().then(...)` to determine whether the event needs to be re-dispatched.
The event is re-dispatched when the layout has changed, which is why a microtask is used.

With this change, we introduce a global configuration flag,
`__zone_symbol__enable_native_microtask_draining`, to allow consumers to enable
microtask draining within a browser microtask.

This flag is necessary to prevent any breaking changes resulting from this modification.
The previous attempt to address this issue caused a significant number of failures in g3.
Therefore, we are hiding that fix behind the configuration flag.

Closes angular#44446
Closes angular#55590
Closes angular#51328

(cherry picked from commit fc6a7eea68)
2026-04-15 10:31:33 -04:00
Angular Robot
a3048f231c build: update cross-repo angular dependencies
See associated pull request for more information.
2026-03-25 12:59:42 -07:00
Angular Robot
d0481860bf build: update cross-repo angular dependencies
See associated pull request for more information.
2026-03-20 15:23:08 -07:00
Angular Robot
f39896da99 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-03-13 16:25:45 -06:00
Alan Agius
7907e982ee test: remove duplicate tests
These tests are duplicate and have been removed.
2026-03-11 13:35:26 -07:00
Alan Agius
adda6c5c10 build: update aspect_rules_js to 3.0.2
This updates the major version of `aspect_rules_js`.
2026-03-11 13:35:26 -07:00
Kristiyan Kostadinov
da57d1af73 build: use TypeScript 5.9 for patch builds
Partially rolls back to using TypeScript 5.9 for the builds on the patch branch, because we bundle our TypeScript version with the language service which can introduce unexpected breakages for users.

Note that we still allow users to install TypeScript 6.
2026-03-04 07:59:23 -08:00
Angular Robot
a25f74238e build: update jasmine dependencies to v6.1.0
See associated pull request for more information.
2026-02-25 07:57:47 -08:00
Andrew Scott
f58f9c892e release: cut the zone.js-0.16.1 release
(cherry picked from commit ac8b5ff938)
2026-02-18 16:26:41 -08:00
Andrew Scott
98610aabaf docs(zone.js): update release and publish commands in DEVELOPER.md 2026-02-18 08:47:53 -08:00
Andrew Scott
d99e336a03 docs(zone.js): update build command in DEVELOPER.md 2026-02-18 08:47:53 -08:00
Andrew Scott
c2f7eaa833 docs(zone.js): update instructions to use pnpm 2026-02-18 08:47:53 -08:00
Andrew Scott
fc557f0276 fix(zone.js): support passthrough of Promise.try API
When Zone patches Promise, it uses ZoneAwarePromise. The new Promise.try API was undefined on ZoneAwarePromise, making it unavailable when zone was present. This change gracefully passes through Promise.try to the native Promise implementation, if available, without patching it to execute in the right zone (our stance is not to add new patches but avoid destructively making new APIs unavailable).

Fixes #67057
2026-02-17 11:32:49 -08:00
Kristiyan Kostadinov
81cabc1477 feat(core): add support for TypeScript 6
Updates the project to support TypeScript 6 and accounts for some of the breakages.
2026-02-17 08:40:38 -08:00
Angular Robot
11767cabe4 build: update Jasmine to 6.0.0
Jasmine enables `forbidDuplicateNames: true` by default. So we also need to desambiguate duplicate spec names.
2026-02-09 12:15:57 -08:00
Shuaib Hasan Akib
0c6604f478 refactor(common): update copyright to Google LLC
Replaces outdated Google Inc copyright headers with Google LLC to align with current licensing standards.
2026-02-09 07:51:36 -08:00
Angular Robot
df3258cfc4 build: update all non-major dependencies
See associated pull request for more information.
2026-01-29 12:22:40 -08:00
Angular Robot
9989c5fb78 build: update dependency @csstools/css-color-parser to v4
See associated pull request for more information.
2026-01-16 10:30:20 -08:00
Kristiyan Kostadinov
52bc0208f9 build: move zone.js build off deprecated flag
The Zone.js build was depending on the `--outFile` flag from TypeScript which is deprecated. These changes switch to using `--outDir` and copying the files out of the directory instead.
2026-01-16 09:28:47 -08:00
Angular Robot
54fc393d27 build: update dependency @csstools/css-calc to v3
See associated pull request for more information.
2026-01-16 09:20:05 -08:00
Angular Robot
ebc52ff434 build: update all non-major dependencies
See associated pull request for more information.
2026-01-15 10:52:48 -08:00
SkyZeroZx
85ce5f3ce7 docs: update copyright year 2026-01-07 12:28:34 -05:00
Matthieu Riegler
6270bba056 ci: reformat files
This is after we've slightly changed a rule in #66056
2025-12-16 14:44:19 -08:00
Matthieu Riegler
af77b89e2a ci: reformat files
This is after we've slightly changed a rule in #66056
2025-12-16 09:24:36 -08:00
Joey Perrott
349133374f build: update repository to use node 22.21.1 in bazel
The repository was updated to use node 22.21.1 via nvm, but bazel had not been updated to match
2025-12-09 09:19:13 -08:00
Matthieu Riegler
9d1d742f1b build: enable angular formatting on all html files
This should also be safe on any html file that isn't an angular template
2025-12-08 10:19:45 -08:00
Angular Robot
009ca4bc70 build: update all non-major dependencies
See associated pull request for more information.
2025-12-04 11:31:29 -08:00
Angular Robot
e681c871d3 build: update all non-major dependencies
See associated pull request for more information.
2025-11-26 13:08:42 -05:00
Jessica Janiuk
58014cb01a release: cut the zone.js-0.16.0 release 2025-11-19 12:38:52 -08:00
Angular Robot
d99b7437d1 build: update all non-major dependencies
See associated pull request for more information.
2025-11-17 08:04:29 -08:00
Angular Robot
3cde920ecf build: update all non-major dependencies
See associated pull request for more information.
2025-11-07 07:43:44 -08:00
Alan Agius
26fed34e0e
build: format md files
This commit configures prettier to format markdown files.
2025-11-06 10:03:05 -08:00
Angular Robot
2b71181288 build: update all non-major dependencies
See associated pull request for more information.
2025-11-05 15:13:37 -08:00
Andrew Scott
48abe007d9 fix(zone.js): Support jasmine v6
This fixes the jasmine patch to ensure we are patching the private APIs
off of the right location, which changed in v6.

see 168ff0a751
2025-10-24 18:46:04 +02:00
Angular Robot
77ead34cc7 build: update dependency vitest to v4 (#64635)
See associated pull request for more information.

PR Close #64635
2025-10-24 09:35:52 +02:00
Andrew Scott
ced2fa5253 refactor(zone.js): Improve missing proxy zone error for jest imported (#64497)
test functions

This improves the fakeAsync error message when importing it, describe,
etc from jest

We will not be further expanding the ZoneJS patches to support
additional use-cases.

fixes #47603

PR Close #64497
2025-10-22 23:26:23 +00:00
Angular Robot
fad6e1351e build: update all non-major dependencies (#64514)
See associated pull request for more information.

PR Close #64514
2025-10-20 16:13:17 +00:00
Angular Robot
10aa4f9cf3 build: update all non-major dependencies (#64488)
See associated pull request for more information.

PR Close #64488
2025-10-17 14:37:21 +00:00
Matthieu Riegler
2e4659648a refactor(zone.js): remove legacy browser support (#63511)
This commit removes the support for legacy browsers.

BREAKING CHANGE: IE/Non-Chromium Edge are not supported anymore.

PR Close #63511
2025-10-16 14:58:45 +00:00
Angular Robot
e77d3fb064 build: update all non-major dependencies (#64460)
See associated pull request for more information.

PR Close #64460
2025-10-16 14:34:51 +00:00
Angular Robot
cb6f8d4228 build: update all non-major dependencies (#64265)
See associated pull request for more information.

PR Close #64265
2025-10-09 05:23:34 -07:00
Angular Robot
e0b9d9b437 build: update all non-major dependencies (#64218)
See associated pull request for more information.

PR Close #64218
2025-10-03 07:51:33 -07:00
Angular Robot
e23815bb7d build: update dependency typescript to v5.9.3 (#64207)
See associated pull request for more information.

Closes #64192 as a pr takeover

PR Close #64207
2025-10-02 20:48:42 +00:00
Angular Robot
851c07bd7a build: update all non-major dependencies (#64148)
See associated pull request for more information.

PR Close #64148
2025-10-01 13:26:44 -04:00
Angular Robot
508090aaed build: update all non-major dependencies (#64111)
See associated pull request for more information.

PR Close #64111
2025-09-29 10:14:09 -04:00
Joey Perrott
422a3b9ae6 test(zone.js): refactor tests to remove usage of shelljs (#64042)
Remove shelljs from zone.js tests

PR Close #64042
2025-09-26 13:14:08 -04:00
Rahul Kamat
a943e7cb05 refactor(core): Update async-test.ts to use globalThis polyfill (#57505)
This updates async-test to use globalThis instead of what it was using.

PR Close #57505
2025-09-16 15:10:04 +00:00
Angular Robot
7569da13b7 build: update all non-major dependencies (#63661)
See associated pull request for more information.

Closes #63504 as a pr takeover

PR Close #63661
2025-09-10 07:11:54 -07:00
Alan Agius
af55552284 build: update @types/node to version ^20.18.8 (#63611)
Version 18 is quite old and no longer supported.

PR Close #63611
2025-09-05 13:48:16 -07:00
Joey Perrott
fe349827ef build: separate zone.js dependencies into their own directory (#63425)
Separate out zone.js dependencies

PR Close #63425
2025-09-05 12:52:55 -07:00