-
Notifications
You must be signed in to change notification settings - Fork 4
Add wasm binding for values #214
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
Conversation
|
@CodiumAI-Agent /review |
PR Reviewer Guide 🔍(Review updated until commit 26a168c)Here are some key observations to aid the review process:
|
…t use serde field alias
jhlee525
left a comment
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.
Great work 👍 Thank you
|
Persistent review updated to latest commit 26a168c |
grf53
left a comment
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.
LGTM!
|
Persistent review updated to latest commit 26a168c |
This PR adds WebAssembly (WASM) bindings for the core components in the
valuemodule, as outlined in #210.While complete parity between the generated type definitions for WASM and Node.js is not possible due to binding library limitations, this implementation aims to make them as consistent as possible.
Implementations
Valuecan be converted to and from any primitive JavaScript value, and is typed asany.tsifyto take advantage ofserde-wasm-bindgen’s type generation support.wasm-pack build --out-dir ./bindings/web/src --out-name ailoy-web --no-pack. Note that this command creates a .gitignore file that must be manually removed afterward. (There’s an ongoing request to disable this behavior: wasm-pack#1408, though it hasn’t been addressed by maintainers.)Changes
Vec<u8>toserde_bytes::ByteBuf, which is natively supported bytsifyandserde-wasm-bindgen."constEnum": falsein the NAPI configuration so that simple string enums are generated as string literals for both WASM and Node.js.FinishReasonandGrammarenums from tuple variants to struct variants to ensure their generated types align across WASM and Node.js targets.header.d.tsin nodejs binding.