Making Wasmtime for Deno


16th June 2023

17.2 Minutes

LePichu
A Few days ago, I published an article called Portable CLIs with Rust and WebAssembly, which was a tiny introduction to using WASM and WASI for CLI Applications powered by Rust. At the end, I mentioned how WASM has its perks and what-nots but I also some "gotchas", I forgot to mention that Deno's implementation of WASI is very incomplete and that it does not support a lot of basic things like std::thread::sleep
. I also mentioned that a sequel of said blog post will come which will show me leveraging a good chunk of Rust Crates to build a real-world example of a CLI with complex functions, but to do that we either need to rebuild the WASM execution context in Rust via Wasmtime or we could alternatively bind Wasmtime to Deno and not do double Rust building, for well, obvious reasons. This isn't the sequel to that article, it is a tiny filler episode if you will, going into detail how I got Wasmtime binded to Deno and made it a drop-in replacement for the Standard Library WASI Runner.