Skip to content

feat: Add wasm module build#12

Open
timfish wants to merge 15 commits intonodejs:mainfrom
timfish:feat/wasm
Open

feat: Add wasm module build#12
timfish wants to merge 15 commits intonodejs:mainfrom
timfish:feat/wasm

Conversation

@timfish
Copy link
Contributor

@timfish timfish commented Apr 29, 2025

This PR is built on top of #10 and #11 so they would need to be merged first for the full diff here to be reduced.

You can see the diff from the previous PR here.

This PR:

  • Adds a wasm feature so that consumers of the Rust library don't need to bring in all those dependencies if they don't need them
  • Adds a transform function to InstrumentationVisitor - this was moved from the test utils with unwrap() removed
  • Adds annotations to the config types which creates conversion code between rust<->javascript and typescript types
  • Adds a wasm module in the library that is only enabled with the wasm feature
  • In the wasm module, add functions and types that are exposed from wasm via #[wasm_bindgen]
  • InstrumentationVisitor lifetimes had to be removed because they're not supported across rust<->js boundary
  • Adds a package.json

You can npm install && npm run build to build the module.
You can run npm test to run a single JavaScript test of the wasm and asserts the output matches what's expected.

@cit-pr-commenter
Copy link

PR Security Update

All commits in this PR up to and including 19b4ae3 have been reviewed and marked safe by SDLC security. For any questions, please reach out to #ci-for-external-contributors-collab on Slack.

@timfish
Copy link
Contributor Author

timfish commented May 27, 2025

So I've split the additions into 2 features, serde and wasm. The wasm feature enables serde too.

If you don't enable any features you get the basic Rust library.
Enable the serde feature and you can serialise/deserialise the config types.
When building the npm module, the wasm feature is enabled.

timfish added a commit to timfish/orchestrion-js that referenced this pull request Jun 30, 2025
@timfish timfish closed this Jul 2, 2025
@timfish timfish deleted the feat/wasm branch July 2, 2025 13:12
@timfish
Copy link
Contributor Author

timfish commented Jul 2, 2025

Oh no, I deleted this branch forgetting this was still open here!

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.

Potential JavaScript API

2 participants