-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JavaScript evaluation support #39
Comments
Thanks for putting this together @jsjoeio!
I think we should def look into this & see what are the benefits of compiling it to Wasm. Anything we learn from there will probably help us get a clearer picture of what Wasm actually does & how it is being used in this project. |
Agreed! Someone on Twitter mentioned Wasmer and I found this tutorial:
It's almost like we want:
I think that would be the best thing to have rather than having these one-off clients which understand 1-2 languages. |
To clarify, we're talking about TS -> wasm, right? I was recently catching up via this old chat with some of the Mozilla team where they call out some downfalls of JS -> wasm (grep for "One of the biggest issues there is to get strings from WebAssembly to JavaScript, and the other way around") |
Wasmer seems very cool but from what I can tell it's a wasm runtime for many different languages. Which is different than "a way to run many languages via wasm" So it basically would let you interact and run wasm based tools not only on the browser, but in a go or Python program. (Though I may be wrong about it's full capabilities). I'd say that flow you stated is pretty close to what we're looking for. My mental model:
|
You might want to have a look at this for JS evaluation! (& TS) |
Just wanted to chime in and say that there is not any current way to compile js to wasm, you can read about why that it is here. If we wanted to go the wasm route we would have to compile a JavaScript interpreter to wasm, here's an extensive list of the ones we could use. Most already have build configurations for wasm too! |
Talking to @dwwoelfel and @sgrove about JS evaluation and they said they use
|
I think a solid first step, before #13 (at least the way I'm thinking about it), is to add support for JavaScript since it's relatively straightforward since JS <-> Browser === ❤️
How it works
At a high-level, it works similarly to the current implementation for Python:
How to Implement
JavaScriptClient
<RunJSCode />
component which comes with an<iframe />
<Editor />
Resources
Additional Notes
Once we have this implemented, I think adding TypeScript support would be relatively straightforward. All we would need to do is add an extra step to compile the TS -> JS using swc.
(Though there may be a desire to compile it to WASM though and use the
WasmClient
)Contributors
We figured this out as a team on a livestream, thanks to:
The text was updated successfully, but these errors were encountered: