Stream: general

Topic: generate component host bindings from command line


view this post on Zulip Abraham White (Sep 12 2025 at 22:24):

Is there a way to generate component host bindings (i.e. equivalent to the wasmtime::component::bindgen macro) using a CLI program instead of a macro? My team likes to have the generated bindings expanded so that changes will be visible in git, and we need to post-process the output a bit (add serde annotations to some generated structs). Doing this with the macro and a build.rs script seems to be difficult, but it would be trivial with a shell script that combines a CLI program and sed/awk.

view this post on Zulip Alex Crichton (Sep 12 2025 at 23:16):

Not currently, but adding such a mode I think would be reasonable (e.g. wasmtime bindgen similar to wit-bindgen rust)

view this post on Zulip Abraham White (Sep 12 2025 at 23:49):

Would wasmtime be open to contributions for this? Earlier today I wrote the a
cli program using wasmtime-internal-wit-bindgen that covered anll of the
macro's options, and it surprisingly wasn't too difficult. Obviously, I would
like to get something like this upstreamed so that we're not relying on an
internal crate.

Thanks!


Last updated: Dec 06 2025 at 05:03 UTC