I want to use rescript-compiler in node.js, are there some docs that describe how I can use rs-compiler as lib? For some examples,
const code = "let a: number = 1";
const comilerResult = rescript.comiler(code);
Then I can compiler codes are written in rs without rescript cli.
There’s no. It’s one of my project ideas, but probably I won’t have time for it in the next 6 months.
There are some projects you can use as a reference:
There’s also https://sketch.sh/ (https://github.com/Sketch-sh/sketch-sh) (ocaml & reasonml syntax supported) and https://rescript-lang.org/try (https://github.com/rescript-association/rescript-lang.org/blob/master/src/Playground.res). To my knowledge the process to accompish this is quite involved and far more, than just importing a lib and call it’s API. But I never looked into it thoroughly.