What you're describing is basically SES:
https://medium.com/agoric/ses-securing-javascript-in-the-rea...
There's pros and cons to that, most folks don't enjoy being inside such a restricted sandbox.
There's pros and cons to that, most folks don't enjoy being inside such a restricted sandbox.
Intro video[1].
You can also run these same components server-side with Wasmtime.