Skip to content

Conversation

@anlavandier
Copy link
Contributor

@anlavandier anlavandier commented Sep 19, 2025

Closes #2310

This PR adds a --features argument to wasm-tools component new using the model of wasm-tools validate. This is done by parsing the --features arguments and propagating the features down to ValidatedModule::new which is the function responsible for initializing the Validator used when parsing the provided Wasm Module

This PR enables all of the features supported by wasm-tools in the Validator used when parsing the provided Wasm Module in wasm-tools component new

This PR is trying to be as targeted as possible but I would argue that --features should be a argument global to wasm-tools and forwarded to every validator used when parsing .wasm modules.

@anlavandier anlavandier requested a review from a team as a code owner September 19, 2025 14:24
@anlavandier anlavandier requested review from alexcrichton and removed request for a team September 19, 2025 14:24
@alexcrichton
Copy link
Member

Thanks for the PR! In situations like this thought I've often found it easiest to avoid passing features around and instead just turn on all the features. That way it's a bit easier since there's much less plumbing and it's not really less-wrong since wasm-tools component new isn't really a load-bearing validation function anyway. What do you think about that approach instead?

@anlavandier
Copy link
Contributor Author

I'm completely fine with this. I'll change the PR title, comment and code to reflect this. Once this is merged, will this directly affect newer releases of wasm-component-ld or will a similar PR need to be raised in that repo as well ?

Signed-off-by: Antoine Lavandier <antoine.lavandier@inria.fr>
@anlavandier anlavandier force-pushed the feat/features-for-components branch from 0ed41c2 to 9648e14 Compare September 19, 2025 15:15
@alexcrichton
Copy link
Member

To update wasm-component-ld the process is (a) merge the PR here, (b) make a crates.io release from this repo, (c) update the wasm-component-ld source, (d) make a crates.io release of wasm-component-ld, and (e) update rust-lang/rust and wasi-sdk to the new versions. I'm able to help out with these parts too and it's fine to make a release for this.

Would you be up for adding a test here as well? For example something in crates/wit-component/tests/components I think would work. Something small is fine, but it'd be good to verify that everything works with a proposal like custom-page-sizes.

Signed-off-by: Antoine Lavandier <antoine.lavandier@inria.fr>
@anlavandier
Copy link
Contributor Author

Done in the latest commit.

@alexcrichton alexcrichton added this pull request to the merge queue Sep 19, 2025
Merged via the queue into bytecodealliance:main with commit bb94daf Sep 19, 2025
34 checks passed
@anlavandier anlavandier changed the title Support --features CLI arguments for wasm-tools component new Use WasmFeature::all to support every feature by default in wasm-tools component new Sep 22, 2025
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.

Support --features CLI arguments for wasm-tools component new

2 participants