Skip to content

Commit 88bb6e8

Browse files
committed
fix(zone.js): patch entire promise in node
In angular#49144 we introduced a change to only path `Promise.prototype.then` due to Node.js `SafePromise` complaining about `Promise.prototype.then` called on incompatible receiver. This however introduced a number of regressions. This commit reverts this change and re-introduces the changes to patch the entire promise on Node. The original `SafePromise` problem is no longer reproducible as of Node.js version 18.13+ as it was addressed as part of nodejs/node#45175. While the Angular CLI does not yet generate ESM server bundles, users using ESM with dynamic imports will require using Node.js 18.13 or later. Closes angular#50513, closes angular#50457, closes angular#50414 and closes angular#49930
1 parent 9847085 commit 88bb6e8

File tree

6 files changed

+3
-136
lines changed

6 files changed

+3
-136
lines changed

packages/zone.js/bundles.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ BUNDLES_ENTRY_POINTS = {
1414
"entrypoint": _DIR + "mix/rollup-mix",
1515
},
1616
"zone-node": {
17-
"entrypoint": _DIR + "node/rollup-main-node-bundle",
17+
"entrypoint": _DIR + "node/rollup-main",
1818
},
1919
"async-test": {
2020
"entrypoint": _DIR + "testing/async-testing",

packages/zone.js/lib/node/promise.ts

Lines changed: 0 additions & 117 deletions
This file was deleted.

packages/zone.js/lib/node/rollup-main-node-bundle.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/zone.js/lib/node/rollup-test-main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import './rollup-main-node-bundle';
9+
import './rollup-main';
1010
// load test related files into bundle
1111
import '../testing/zone-testing';

packages/zone.js/test/promise/promise-adapter.mjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,4 @@ const rejected = (reason) => {
1818
return Promise.reject(reason);
1919
};
2020

21-
process.on('unhandledRejection', (error) => {
22-
console.log('unhandled', error);
23-
});
24-
2521
export default {deferred, resolved, rejected};

packages/zone.js/test/promise/promise-test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import promisesAplusTests from 'promises-aplus-tests';
22
import adapter from './promise-adapter.mjs';
33

4-
promisesAplusTests(adapter, {reporter: 'dot', timeout: 500}, function (err) {
4+
promisesAplusTests(adapter, {reporter: 'dot'}, function (err) {
55
if (err) {
66
console.error(err);
77
process.exit(1);

0 commit comments

Comments
 (0)