Skip to content

refactor: Nan to node-addons-api/fix for bun compatibility #332

Open
x8BitRain wants to merge 6 commits intostackgl:masterfrom
roomle-dev:master
Open

refactor: Nan to node-addons-api/fix for bun compatibility #332
x8BitRain wants to merge 6 commits intostackgl:masterfrom
roomle-dev:master

Conversation

@x8BitRain
Copy link
Copy Markdown

@x8BitRain x8BitRain commented Apr 8, 2026

Closes #296

This is a major refactor away from nan and towards node-addons-api that we found was necessary in order for headless-gl to work under a Bun runtime, the downside is older node versions <8 will not support this lib without Nan. Our fork works on Bun 1.3.11 and Node v24.13.1 but if this refactor is undesirable for backwards compatibility purposes then please feel free to close.

  • Refactor away from Nan and towards node-addons-api.
  • Refactored into Typescript.
  • Wrapped main export in an .mjs for importing with module syntax.
  • Updated libEGL.dylib and libGLESv2.dylib from latest macos Chrome.

I got libEGL.dylib from ./Contents/Frameworks/Google Chrome Framework.framework/Versions/146.0.7680.178/Libraries/libEGL.dylib and libGLESv2.dylib from ./Contents/Frameworks/Google Chrome Framework.framework/Versions/146.0.7680.165/Libraries/libEGL.dylib in case you wanted to verify authenticity of the binaries.

AI disclaimer: Claude code was used during this refactor.

@dhritzkiv
Copy link
Copy Markdown
Member

I've been meaning to work on this someday. Thanks for contributing this. I'll review this over the next while, but on cursory look, it looks good. Tests passing on their first go is also promising.

When merged, this will likely go into v10 of this project. I'll also have to spend some time reading more about node-addons type packages, and what changes, if any, will need to be made for packaging up the release.

It being re-written in TS will also require some changes from me, such as updating the code linting/formatting, and excluding the derived JS files (I might prefer to exclude them, and only distribute the "built" files to npm)

@dhritzkiv
Copy link
Copy Markdown
Member

This will also close #211

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] BUN error

2 participants