Skip to content

Conversation

@jhugman
Copy link
Owner

@jhugman jhugman commented May 26, 2025

This PR allows customization of entrypoint and ts bindings directory:

web:
  tsBindings: bindings/web
  entrypoint: entrypoints/web.ts

By default, the entrypoint is taken from the browser entry of the package.json file.

@jhugman jhugman requested a review from Copilot May 26, 2025 18:16
Copy link
Contributor

Copilot AI left a 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_bindings and entrypoint in WasmConfig and 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_path call for libarithmetical.a is 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")]
Copy link

Copilot AI May 26, 2025

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.

Suggested change
#[serde(alias = "ts", alias = "typescript")]
#[serde(alias = "ts", alias = "typescript", alias = "tsBindings")]

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

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?

Copy link
Owner Author

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.

@jhugman jhugman requested a review from zzorba May 26, 2025 22:39
Copy link
Collaborator

@zzorba zzorba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jhugman jhugman merged commit 1bc6b46 into main May 27, 2025
12 of 20 checks passed
@jhugman jhugman deleted the jhugman/wasm/integration-week-2 branch May 27, 2025 19:38
@jhugman jhugman mentioned this pull request Jun 11, 2025
jhugman added a commit that referenced this pull request Jun 12, 2025
# 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
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