You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I've started to use ComponentizeJS for a small project and I'm rather excited at the possibility of allowing javascript as a way for wasm plugins in my program.
I have a WIT file where I declare types in one imported interface; those types are part of the imports. There's an exported interface which makes use of those types as function parameters and function return values. (Code below.)
When I try to use ComponentizeJS (or jco, for that matter), it complains when componentizing that the interface I've marked as being imported is, in fact, not present among the imported interfaces.
Error: Import 'trinity:api/types' is not defined by the WIT world. Available imports are: .
The WIT file seems to be valid: wasmtime and Rust guests accept it as is, and create a Rust enumAction for the function's return value.
I tried to not import anything from the types interface, assuming that it might be hard to model static types in JS, with the hope that maybe everything would be dynamically checked at the boundary. So I tweaked the component's code by removing the new Message — just use a plain object.
I've been using componentize-js @ 0.16.0, node v23.6.0.
However, this failed with a wasm trap at runtime (and no error messages, as I'm opting out of WASI for this particular host system), so there's something else. Is there something I'm doing wrong, or any chance there's a bug in there?
The text was updated successfully, but these errors were encountered:
Hi! I've started to use ComponentizeJS for a small project and I'm rather excited at the possibility of allowing javascript as a way for wasm plugins in my program.
I have a WIT file where I declare types in one imported interface; those types are part of the imports. There's an exported interface which makes use of those types as function parameters and function return values. (Code below.)
wit file
guest.js
componentize.mjs
When I try to use
ComponentizeJS
(or jco, for that matter), it complains when componentizing that the interface I've marked as being imported is, in fact, not present among the imported interfaces.The WIT file seems to be valid: wasmtime and Rust guests accept it as is, and create a Rust
enum
Action
for the function's return value.I tried to not import anything from the
types
interface, assuming that it might be hard to model static types in JS, with the hope that maybe everything would be dynamically checked at the boundary. So I tweaked the component's code by removing thenew Message
— just use a plain object.I've been using
componentize-js
@ 0.16.0, node v23.6.0.However, this failed with a wasm trap at runtime (and no error messages, as I'm opting out of WASI for this particular host system), so there's something else. Is there something I'm doing wrong, or any chance there's a bug in there?
The text was updated successfully, but these errors were encountered: