[DAEMON-268] appcd-util: Add support for Node.js 11
|Appc Daemon 2.0.0
In Node.js 11, they've removed
timer_wrap which we use in
appcd-util to get the
Timer prototype and detect active timers.
Node.js 11 has also deprecated
process.binding() (https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V11.md#notable-changes-3), so we won't be able to get
fs_event_wrap to get a ref to the
It's probably also a matter of time before
process._getActiveHandles() is removed too.
A potential solution is to use [async hooks](https://nodejs.org/api/async_hooks.html) (introduced in Node.js 8.1.0). However, since async hooks must be explicitly enabled, we need to API.
This ticket proposes a new class
HandleWatcher that lives in
appcd-util. It would use async hooks as well as
process._getActiveHandles() when either are available. This class would be created by the
Server instance and facilitate the closing of any open handles.
getActiveHandles() will likely need to be deprecated.
Note that since the core process runs as Node.js 10.13.0, we have some time to figure this out.
Also, Node.js 11 changed
setImmediate() and caused
tailgate() to not work correctly. Simply need to stop forcing asynchronous execution of the tailgate callback.
- Chris Barber 2018-12-01
- Chris Barber 2018-12-07
It's also worth noting this is preventing the AMPLIFY CLI from supporting Node.js 11.