[ENHANCEMENT] Support Bun#10701
Conversation
|
Do you know if booting an app is any faster with bun? |
|
node bin/ember version 0.28s user 0.09s system 98% cpu 0.376 total Bun initializes faster for sure. |
|
for using the version of ember-cli that this code is on, you'll need a git reference, as it'll be a bit before this makes it out to stable release. Example: thank you for exploring this! |
| } | ||
|
|
||
| function isEventEmitterCompatible(obj) { | ||
| return ( |
There was a problem hiding this comment.
Shouldn't we have kept the test with instanceof, out of safety?
const isValidInstance = obj instanceof EventEmitter;
const isDuckTyped = /* your Boolean & typeof checks */;
return isValidInstance || isDuckTyped;There was a problem hiding this comment.
This "if" was not necessary, as it limited the compatibility.
So I don't think we need to check more for an exception.
When using Bun, the process (outerProcess) is not an instance of EventEmitter but an object with the same methods. So, to make it more compatible with other runtimes, we should duck type check the object.
Should fix #10371 and #10444.
% node bin/ember version ember-cli: 6.5.0-beta.0-bun-support-e37f6d1f5d node: 20.18.1 os: darwin arm64 % bun --bun bin/ember version ember-cli: 6.5.0-beta.0-bun-support-e37f6d1f5d node: 22.6.0 os: darwin arm64 % deno --unstable-detect-cjs bin/ember version ✅ Granted all sys access. ✅ Granted all env access. ✅ Granted all read access. ember-cli: 6.5.0-beta.0-bun-support-e37f6d1f5d node: 22.14.0 os: darwin arm64Tested on
Bun 1.2.12
Deno 2.3.1
Node 20.18.1
macOS 15.4.1