-
Notifications
You must be signed in to change notification settings - Fork 41
Enable entrypoint and ts bindings directory to be customized for wasm #259
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
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.
Pull Request Overview
Enables customization of the WASM entrypoint and TypeScript bindings directory via ubrn.config.yaml or package.json settings.
- Introduce
ts_bindingsandentrypointinWasmConfigand wire them through code generation and templates - Update CLI config parsing (
ProjectConfig) and add path‐normalization helpers - Extend tests and fixtures to cover distinct bindings/output directory and overridden entrypoint
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/ubrn_cli/src/wasm/config.rs | Add ts_bindings and entrypoint fields to config |
| crates/ubrn_cli/src/config/mod.rs | Add path‐normalization helpers and wasm_bindings_ts_path |
| crates/ubrn_cli/templates/wasm/index.web.ts | Switch to wasm_bindings_ts_path for template paths |
| crates/ubrn_cli/src/wasm/codegen.rs | Use new entrypoint path for generated file |
| crates/ubrn_cli/src/wasm/bindings.rs | Use new wasm_bindings_ts_path in binding logic |
| crates/ubrn_cli/tests/web_variants.rs | Add tests for custom bindings directory and entrypoint |
| crates/ubrn_cli/fixtures/distinct-bindings | New fixtures for distinct bindings and custom entrypoint |
Comments suppressed due to low confidence (1)
crates/ubrn_cli/tests/web_variants.rs:188
- [nitpick] This
shim_pathcall forlibarithmetical.ais duplicated; you can remove one of the identical blocks to clean up the test setup.
shim_path("libarithmetical.a",
| #[serde(default = "WasmConfig::default_runtime_version")] | ||
| pub(crate) runtime_version: String, | ||
|
|
||
| #[serde(alias = "ts", alias = "typescript")] |
Copilot
AI
May 26, 2025
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.
The YAML key tsBindings won’t deserialize into ts_bindings without a rename_all = "camelCase" or an alias for tsBindings. Add #[serde(rename_all = "camelCase")] to WasmConfig or include #[serde(alias = "tsBindings")] so the custom directory setting is applied.
| #[serde(alias = "ts", alias = "typescript")] | |
| #[serde(alias = "ts", alias = "typescript", alias = "tsBindings")] |
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.
I mean yes, but is that a problem? Why do you think that's a problem?
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.
Yeah, the fact I'm specifically testing for this case might suggest co-pilot has this wrong.
zzorba
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
# 0.29.3-0 ## ✨ What's New ✨ ### 🌏🕸️ WASM! After 6 months of development, we are releasing the first version of `uniffi-bindgen-react-native` for use with WASM: - Different fixtures running: - Fixtures `chronological` and `gc-callbacks-crasher` (#238) - Fixture `async-callbacks` (#237) - Configuration file and `ubrn` command line: - Enable entrypoint and ts bindings directory to be customized for wasm (#259) - Add `ubrn build web --and-generate` command (#253) - Add CLI testing for `uniffi-bindgen-react-native` command. (#257) - Refactor of ubrn_cli into config and commands modules (#251) - `uniffi-runtime-javascript` runtime, now on `crates.io`: - Add runtimeVersion to vary version of uniffi-runtime-javascript (#256) - Prepare uniffi-runtime-javascript crate for release (#248) ## 🦊 What's Changed - Add default value for the --config option in all ubrn commands (#265) - Change Windows path separators in CMakeLists.txt (#261) - Bump `uniffi-rs` version to 0.29.3 (#267) - Bump bob & RN versions (#242) and (#260) - Run yarn pack as part of compatibility tests (#250) - Add to "who is using" section of readme (#239) - Fix wrong key name of `manifestPath` in docs (#240) ##⚠️ Breaking Changes - Bump Typescript version to 5.8, affecting `ArrayBuffer` (#271) **Full Changelog**: 0.29.0-0...0.29.3-3
This PR allows customization of entrypoint and ts bindings directory:
By default, the entrypoint is taken from the
browserentry of the package.json file.