-
Notifications
You must be signed in to change notification settings - Fork 25
[PM-27740] Wrap wasm-bindgen CLI #330
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
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
|
Please rebase this on 29c6158 |
|
What's the status of this? |
52dfc42 to
2a91653
Compare
@brjsp I was waiting for a new wasm-bindgen release that would simplify the CLI wrapping, and then lost track of it. I've updated this PR to be on top of #540. Once that one is merged, I'll update this one and set it up for review. |
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/PM-27727 ## 📔 Objective Update WASM-bindgen and removed `VectorIntoJsValue` implementations, as those types aren't needed anymore and were removed from wasm-bindgen. The TS typings now include `[Symbol.dispose](): void;` for the Client classes, so I've updated the TS check script to include the `esnext.disposable` feature, which we're already using in the clients repo anyway. Prerequisite for #330 ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
2a91653 to
c30858d
Compare
|
Claude finished @dani-garcia's task —— View job Comprehensive PR ReviewThis PR successfully eliminates the manual Changes Since Last ReviewThe author has addressed previous feedback:
Additional changes:
Critical IssuesNone identified. The implementation is sound and achieves its objectives. Suggested Improvements💭 Finding 1: Consider making The test runner in .cargo/config.toml:9 explicitly specifies runner = 'cargo run -p wasm-bindgen-cli-runner --bin wasm-bindgen-test-runner'However, build.sh:50-51 omits the package specifier: cargo run --bin wasm-bindgen-runner -- ...While both work (cargo can infer the package), explicit package specification improves clarity and matches the established pattern. Author previously marked this as resolved, but the code doesn't reflect the change. Suggested changecargo run -p wasm-bindgen-cli-runner --bin wasm-bindgen-runner -- --target bundler --out-dir crates/bitwarden-wasm-internal/${NPM_FOLDER} ./target/wasm32-unknown-unknown/${BUILD_FOLDER}/bitwarden_wasm_internal.wasm
cargo run -p wasm-bindgen-cli-runner --bin wasm-bindgen-runner -- --target nodejs --out-dir crates/bitwarden-wasm-internal/${NPM_FOLDER}/node ./target/wasm32-unknown-unknown/${BUILD_FOLDER}/bitwarden_wasm_internal.wasm🎨 Finding 2: Documentation could more explicitly highlight the improvement. crates/bitwarden-wasm-internal/README.md:14 simply lists requirements without noting the significant simplification this PR introduces. Consider adding a note that clarifies developers no longer need to manually install and maintain Suggested addition### Requirements
- `wasm32-unknown-unknown` rust target.
- `binaryen` installed for `wasm-opt` and `wasm2js`.
**Note:** `wasm-bindgen-cli` is managed as a Cargo dependency and does not require manual installation.🎨 Finding 3: The wrapper crate's Cargo.toml uses a more specific version range than typical workspace dependencies. crates/wasm-bindgen-cli-runner/Cargo.toml:24 specifies Suggested changeenv_logger = "0.11"Good Practices Observed
Action Items
All action items are suggestions for polish rather than required changes. The PR is functionally complete and ready for merge pending maintainer approval. |
🔍 SDK Breaking Change Detection ResultsSDK Version:
Breaking change detection completed. View SDK workflow |
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've tested this and it seems like this file is not needed and it's using the config file at the root, so I've removed it.
| uuid = { version = ">=1.3.3, <2.0", features = ["serde", "v4", "js"] } | ||
| validator = { version = ">=0.18.1, <0.21", features = ["derive"] } | ||
| wasm-bindgen = { version = ">=0.2.105, <0.3", features = ["serde-serialize"] } | ||
| wasm-bindgen = { version = "=0.2.105", features = ["serde-serialize"] } |
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.
Moved this to pin the version consistently, wasm-bindgen versions can sometimes break things for us even on a patch release.
| r##"r#" | ||
| export interface {export_as_identifier} extends Error {{ | ||
| name: "{export_as_identifier}"; | ||
| }}; |
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 semicolon at the end of these is invalid TS syntax which should cause compilation issues, but prettier removes it automatically which means we don't see the issue.
This was reported to me as part of #319, so I've included it here as it's a tiny change, but I can move it to a separate PR.



🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-27740
📔 Objective
Previously devs would need to install a version of
wasm-bindgen-clithat matches with the version ofwasm-bindgenused by the project. This step produces significant friction, specially whenwasm-bindgengets updated, as we need to deal with updating the CI files, and every dev needs to update their environment. It also introduces another avenue for builds to be non-reproducible.This PR tries to do something similar to what
uniffidoes, in that we have a simple wrapper crate around the utility. This means that the crate gets versioned in theCargo.locklike every other dependency.While I was at it, I've also updated the renovate config to group all the wasm-bindgen crates together, and I've also included a small TS formatting error that was reported in #319. The reason we never saw it is that we always run prettier after, which gets rid of the extra semicolon.
Fixes #319.
⏰ Reminders before review
team
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmedissue and could potentially benefit from discussion
:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes