Do I understand correctly? `wasmWasi` is a totally...
# webassembly
r
Do I understand correctly?
wasmWasi
is a totally different target in KMP? Unlike JS/node which is just a different "kind" of
js
target?
👌 1
Can I use libraries compiled for Kotlin/Wasm (the ones working correctly with
wasmJs
like compose, coroutines, serialization, datetime) with
wasmWasi
target?
Just adding
wasmWasi
target to my js/wasmJs project does not work (gradle complains with lots of errors like
No matching variant of org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2-wasm1 was found.
)
s
WASI is a new different KMP target. kotlinx-coroutines does not support it yet
While you can share the common code between
wasmJs
and
wasmWasi
, you can’t mix these libraries to build a single artefact
r
Is it just a matter of recompiling coroutines or other libraries, which currently support
wasmJs
? Or is there more work required to support
wasmWasi
?
s
Its more work. Mostly about designing event loop since we can’t use the one built into JS.
🙏 1
r
Are there any plans supporting
wasmWasi
target with compose multiplatform (at least the compose runtime part)?
s
We don’t have plans to port compose to WASI. WASI would need to provide some graphics and mouse/keyboard/touch input APIs to build the UI, which is not a priority as far as I know. We would be curious to hear more about use-cases for a non-UI compose runtime port.
r
I'm building a compose runtime powered framework, which targets both JS and Wasm and which can render UI both to DOM and to HTML string (I'm thinking about easy SSR and pre-rendering, but there could be other use-cases for this 😉) . Currently I can successfully run this on NodeJS. But I was thinking it would be great to have WASI support as well.
🤔 1
h
Another use-case for compose runtime (not ui) is molecule: https://github.com/cashapp/molecule to use it for business logic on wasi too
👍 1
r
I've just realized I was in fact looking for wasmJs/node and not wasmWasi. Somehow I've missed it's already supported (with a bit of manual versions config) and I can successfully run my wasm code on nodeJS 🙂
🙂 1