-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bindgen] Adding prebuild
and configuring it
#5447
Conversation
prebuild
and configuring it
f9c6cf3
to
1e1bdd2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just curious how this avoids importing uv.h
"binary": { | ||
"module_name": "realm", | ||
"module_path": "generated/ts", | ||
"host": "https://static.realm.io", | ||
"package_name": "realm-v{version}-napi-v6-{platform}-{arch}.tar.gz", | ||
"remote_path": "realm-js-prebuilds/{version}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we're leaving out the api_versions
from this object, we signal to cmake-js that we're not targeting napi explicitly, which ensures we get the uv.h in our include path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious how this avoids importing uv.h
@takameyer this is where the magic happens 🪄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 🤩
* bindgen: Implement getAllSyncSessions (#5492) Ensure that Realm enums are accessible (#5484) Apply suggestions from code review [skip ci] Small corrections [skip ci] Added changelog and final corrections Stub add test to validate that foreach throws on a dictionary (#5467) Using `RealmInsertionModel` on `Results#update` Updated "react-native" dev dep to 0.71.0 Bumped lower bound on our RN peer dependency [bindgen] SDK packaging (#5466) Adding "prebuild" and configuring it (#5447) add synthetic private brand fields to TS wrappers for C++ classes, and fix found bug import bindings directly rather than through internal Stub work
What, How & Why?
This adds prebuild of the Node.js native module for separate architectures.
For context, I've included an excerpt from an internal discussion we had on Slack:
I just learned that
uv.h
is not covered by the ABI stability of node-api: https://nodejs.org/dist/latest-v18.x/docs/api/n-api.html#implications-of-abi-stabilityIn our current SDK we use a pre v7 version of cmake-js, which incorrectly assumes we're building for a specific node version and incorrectly expose uv.h to object-store and risking crashes.
I noticed this when I upgraded to cmake-js v7.1.1 on master where it correctly detects that we want to compile for node-api (because of this check) and I start getting:
I believe this means that we're risking crashes of our current native binary, because we're depending on the ABI of libuv, which we can't assume is stable.
I see the following options:
Napi::ThreadSafeFunction
API.This PR takes the latter approach by avoiding to include the