https://kotlinlang.org logo
#webassembly
Title
# webassembly
r

Robert Jaros

10/21/2023, 12:13 PM
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

Svyatoslav Kuzmich [JB]

10/21/2023, 4:22 PM
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

Robert Jaros

10/21/2023, 4:37 PM
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

Svyatoslav Kuzmich [JB]

10/21/2023, 4:39 PM
Its more work. Mostly about designing event loop since we can’t use the one built into JS.
🙏 1
r

Robert Jaros

10/21/2023, 4:41 PM
Are there any plans supporting
wasmWasi
target with compose multiplatform (at least the compose runtime part)?
s

Svyatoslav Kuzmich [JB]

10/21/2023, 5:27 PM
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

Robert Jaros

10/21/2023, 5:35 PM
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

hfhbd

10/21/2023, 11:21 PM
Another use-case for compose runtime (not ui) is molecule: https://github.com/cashapp/molecule to use it for business logic on wasi too
r

Robert Jaros

10/27/2023, 4:05 PM
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
12 Views