I'm working in a project to run WASM and JS on IOT devices. We want to use WASM components in our project, but our WASM runtime has no component model support. We tried JCO but it doesn't work on our project, because our WASM API dose not support cross module imports, but JCO often generates multiple modules even if there's only one input component.
Since the only way to create a compnent now is creating a core module with wit-bindgen and clang, and convert this core module to a component. There's nothing special with this core module except it uses components' ABI. As a workaround in a transition stage, we want to run this core module directly on our runtime, instead of converting it to a component and transpiring it back to core module with JCO.
So I want to extend wit-bindgen to generate JS bindings for this core module from a WIT file. This may sound weird, but the same mechanism that wit-bindgen use to generate ABI bridge is suitable for generating JS bindings to a core module. The README of wit-bindegn suggests me to reach out the authors here. So I'm here to get some further information.
THANKS.
@Guy Bedford could give you some insights as he's the author of jco.
@foobat it may be possible for JCO to convert the internal adapter Wasm modules into JS, and this is something we may need to explore for other reasons
if so, it sounds like that might enable your use case, provided the component does not use component composition internally
that said, a lot of interesting components just do use composition anyway, so there would still be quite a strong restriction on the environment
if you are interested in that overall direction, we definitely need help updating JCO to convert the internal "core adapters" into JS
that sounds very similar to the work you're interested in, so we could pick it up on github if you're keen - https://github.com/bytecodealliance/jco/issues/116.
Last updated: Dec 23 2024 at 12:05 UTC