rescript-lang.org icon indicating copy to clipboard operation
rescript-lang.org copied to clipboard

Evaluate code in playground

Open tom-sherman opened this issue 4 years ago • 2 comments

The TypeScript playground has this great feature where you can run the generated JS code, would you accept a PR to add a similar UI to the ReScript Playground?

tom-sherman avatar Jul 11 '21 10:07 tom-sherman

I've started hacking around on this, my approach right now is:

  • Create an Eval module that uses a Worker under the hood
  • Eval exposes a state machine for evaluating code
  • Figure out some way of bundling the whole of rescript std lib and including it in the worker file

tom-sherman avatar Jul 11 '21 11:07 tom-sherman

would you accept a PR to add a similar UI to the ReScript Playground?

Yes I would!

Figure out some way of bundling the whole of rescript std lib and including it in the worker file

That will be the most interesting part. I could take over the pipeline for bundling the right stdlib / compiler files, but I am not sure if we need to generate worker files for each compiler version, or if there's a way to point to a specific bundle file via one single entry point?

ryyppy avatar Jul 12 '21 15:07 ryyppy