Jeff Charles has marked this topic as resolved.
My minimum viable working (cli for) component-init is in a branch here https://github.com/dicej/component-init/pull/7
and here is an example of using it: https://github.com/pchickey/jaq-http/blob/main/src/main.rs#L76
i benchmarked using that version of that (very basic) component vs the prior commit which doesnt use component-init, and got 5x the RPS with the init version
when Joel gets time to review it, we can merge and publish to crates.io. I'm going to look into folding it into wizer next, because wizer has already designed and implemented (for preview 1 at least) a handful of things that component-init hasnt wrt allowing use of WASI
componentize-py has its own way of stubbing out wasi while in component-init that i havent fully understood yet
The callback you pass to component_init::initialize is allowed to add whatever host functions it wants to the wasmtime::component::Linker (assuming you're using Wasmtime), including WASI or even custom host functions, which makes them available during pre-init. Note that if the guest does use WASI, it is also responsible for resetting the adapter and wasi-libc state with regards to stdio handles.
componentize-py also supports stubbing WASI so that the resulting component has no WASI imports, but that's somewhat orthogonal to how it uses component-init.
(BTW, I'm reviewing the PR now)
thanks Joel!
I should make a crate, kinda like wasi, that provides the component-init wat glue as a library, and hooks it up to those wasi-libc and adapter bits
what should i call it
Maybe component-init-rt or something? I can't think of anything else.
id like to make a proc-macro crate, itll need an -rt helper crate in the background i think
also i should probably make it work like ctor: https://crates.io/crates/ctor so that you can make any number of annotations and they all happen
so maybe component-init can search for all exports named component-init:run:<unique name, generated from FILE and LINE> and then finally do component-init:final, which would be the libc cleanup
i wonder if, instead of doing name-mangling at the top level, these functions should all be deposited into a component-init interface, in which case we get to use a namespace and package name. bytecodealliance:experimental/component-init ?
and then consider making it a wasi standard once we are satisfied with how it works?
componinit
just throwing that out there
Not to be confused with the linting tool componit
WUT
compo-nit...
I'm just trying to make very good jokes like you Ralph.
Not to be confused with the linting tool
componit
nor the tool that determines if a file is a component, componinnit?
you people
should we rename WAC to compoknit?
I read "componit" as rhyming with "jump on it"
i talked it through with joel and nick in DM, and the existing component-init crate has been renamed component-init-transform, so the guest crate can be named component-init
@Joel Dice want to publish component-init-{transform, wasmtime, cli} at 0.1.0? then ill update the componentize-py PR
I guess since theyre unpublished i could technically do so, if youd prefer me to, but its your repo.
Yup, I'll do that shortly.
my current rough plan is that component-init-cli and -wasmtime will become part of wizer and go away completely, and then component-init-transform will become a dependency of wizer, and itll all probably move over into the wizer repo for ease of maintenance. but i want to prove out a few more ideas before im ready to do those steps
Ok, they're all published
thanks!
Last updated: Dec 06 2025 at 05:03 UTC