Skip to content

Conversation

@ixe013
Copy link
Owner

@ixe013 ixe013 commented Feb 2, 2026

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:

  • Modified Cargo.toml to include napi dependencies and a node feature.
  • Added src/js_api.rs implementing the JS interface mirroring the Python API.
  • Added build.rs to configure the build.
  • Added package.json with build scripts and dependencies.
  • Added index.js to load the compiled binary (index.node).
  • Added test.js for verification.

To build the JS bindings:

  1. npm install
  2. npm run build (requires environment with Rust and N-API support)
    OR
    cargo build --features node and rename the output shared library to index.node.

PR created automatically by Jules for task 8542869337485304367 started by @ixe013

- 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>
@google-labs-jules
Copy link
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

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 }
Copy link
Owner Author

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.

Copy link
Contributor

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.

google-labs-jules bot and others added 2 commits February 2, 2026 22:37
- 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>
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.

2 participants