feat(wasm): support extra_dev_dependencies in the generated binding Cargo.toml#182
Merged
Goldziher merged 1 commit intoJul 19, 2026
Merged
Conversation
…argo.toml The wasm backend supports hand-written modules in the binding crate via custom_rust_modules, but the generated Cargo.toml had no way to carry dev-dependencies, so hand-written test files could not compile: an in-crate #[wasm_bindgen_test] suite needs wasm-bindgen-test, and the only routes were hand-editing a DO-NOT-EDIT manifest or shipping test-only crates as real dependencies through extra_dependencies. Adds [crates.wasm.extra_dev_dependencies], mirroring the per-language extra_dependencies table. The cargo generator emits a [dev-dependencies] section between [dependencies] and the target-specific block when the table is non-empty: sorted, string values quoted, structured values passed through. An empty table emits nothing, so existing projects regenerate byte-identically.
Member
Author
|
@jamon8888 tagging you here too. This closes the generator gap that kept your wasm-bindgen test suites out of xberg-io/xberg#1259. Once it ships, they move back into the crate. |
Goldziher
approved these changes
Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #181.
Problem
The wasm backend supports hand-written modules in the binding crate through
custom_rust_modules, but the generated Cargo.toml cannot carry[dev-dependencies]. Hand-written test files don't compile: an in-crate#[wasm_bindgen_test]suite needswasm-bindgen-test, and the only routes were hand-editing a DO-NOT-EDIT manifest or shipping test-only crates as real dependencies throughextra_dependencies.In xberg-io/xberg#1259 this forced the contributed wasm-bindgen suites out of the crate and into the JS e2e harness.
Solution
A new
[crates.wasm.extra_dev_dependencies]table, mirroring the per-languageextra_dependencies. When it is non-empty, the cargo generator emits a[dev-dependencies]section between[dependencies]and the target-specific block: sorted, string values quoted, structured values passed through.An empty table emits nothing, so existing projects regenerate byte-identically.
Verification
A unit test covers both value shapes and the empty-table case (
cargo test -p alef --lib backends::wasm::gen_bindings::tests, 9 passed).cargo clippy --lib --tests -- -D warningsandcargo fmt --checkare clean.