tylerflint
Using Deno runtime as a v8 isolate runner
Deno is awesome, not just the end product but also the core runtime. I've spend the past couple of weeks off-and-on diving into the codebase and learning how the system works. It's fantastic.
I have a rust application and I would like to run arbitrary javascript code within v8 isolates. The challenge is that I would need to implement and provide all of the web runtime APIs (Fetch, Stream, etc) to support the javascript code. So I began to wonder if I could use Deno for this?
As I have ascertained thus far, the core runtime is structured to bootstrap a worker and then run a javascript module within. I'm hoping someone could simply point me in the direction for how I might do the following:
1 - Initialize a v8 isolate with the Deno runtime + ops, from a snapshot
2 - Inject javascript into the isolate that exports one or more functions
3 - Call one or more of those functions from within rust
4 - Retrieve the response
5 - Shut down the isolate
Perhaps this is already possible with the Worker api, I'm just trying to wrap my head around it.
Also, I'm not looking for this to be a supported feature and I understand that the core runtime API will change from time-to-time, use at my own risk, etc.
Much appreciation in advance!
4 replies