-
Notifications
You must be signed in to change notification settings - Fork 1
Add JS bindings using napi-rs #23
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
base: main
Are you sure you want to change the base?
Conversation
- Added `napi`, `napi-derive`, and `napi-build` dependencies. - Added `node` feature to `Cargo.toml`. - Created `src/js_api.rs` with `formatFlag`, `formatFlagFromContext`, and `getSeedOrNull`. - Added `build.rs` for napi setup. - Created `package.json`, `index.js` and `test.js`. Co-authored-by: ixe013 <1418338+ixe013@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Cargo.toml
Outdated
| md5 = "*" | ||
| tracing = "*" | ||
| pyo3 = { version = "*", features = ["extension-module", "abi3-py37"], optional = true } | ||
| napi = { version = "2", default-features = false, features = ["napi4"], optional = true } |
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.
Make this a YOLO as the other packages with "*" for the 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.
Done! Updated versions to * to match the YOLO style.
- Updated `package.json` to include `--features node` in build script and use local binary name. - Updated `index.js` to load `ctflags.node`. - Added `build-node` job to `.github/workflows/build-and-test.yml` to verify Node.js bindings in CI. - Updated `Cargo.toml` dependencies to `*` as requested. Co-authored-by: ixe013 <1418338+ixe013@users.noreply.github.com>
- Rewrote `.github/workflows/build-and-test.yml` to ensure correct syntax and consistent indentation. - Renamed CI job to `node-binding` to reset state. - Removed `node_modules` and `ctflags.node` from the repository. - Added `node_modules/` and `*.node` to `.gitignore`. Co-authored-by: ixe013 <1418338+ixe013@users.noreply.github.com>
Added JavaScript bindings to the Rust library using
napi-rs.This allows the library to be used in Node.js environments, such as Playwright scripts.
Changes:
Cargo.tomlto includenapidependencies and anodefeature.src/js_api.rsimplementing the JS interface mirroring the Python API.build.rsto configure the build.package.jsonwith build scripts and dependencies.index.jsto load the compiled binary (index.node).test.jsfor verification.To build the JS bindings:
npm installnpm run build(requires environment with Rust and N-API support)OR
cargo build --features nodeand rename the output shared library toindex.node.PR created automatically by Jules for task 8542869337485304367 started by @ixe013