Hey all! I am currently doing some investigation i...
# webassembly
r
Hey all! I am currently doing some investigation into the feasibility of compiling
ktlint
wrapped up into a wasm file for a formatting framework, see this. I figure before I do too much deep diving it might be good to ask the experts if this is possible 🙂. From the brief investigation I have done so far it looks like using kotlin native might be the best option but I still haven’t determined how complete that is and if it would work for this use case.
s
Hey! Kotlin/Native Wasm target currently relies on having a JavaScript environment to run. This probably won’t change in the near future, as it’s no longer being actively developed. After having a quick look at dprint plugin system, a native plugin, that bridges Rust <=> C <=> Kotlin/Native (w/o Wasm) could be an option.
Also, porting a big JVM-only project to a different Kotlin platform can be a challenge.
r
Thanks @Svyatoslav Kuzmich [JB]! Yeah my fallback was to process/native plugin but I am worried that starting up a new JVM for each format would be pretty slow. I might see if I can do the
C
bridge like you pointed out rather than trying to keep a JVM running over an extended period.
s
It seems that ktlint heavily depends on Kotlin compiler, which is not ported to Kotlin/Native. “C” bridge is probably not an option after all
r
Ah damn, that means my only option is running it as an daemon/server and communicating via a bitstream or something. I was hoping to not have to do that