LEGEND OF THE TOWERFUCKER

Sadly, both Purescript and js_of_ocaml are pretty heavy solutions, then. Purescript is basically 99% Haskell, with a few experimental type level features and differences to accommodate (or attempt to) the panoply of side effects that are present in a browser. Ocaml of JS is 100% ocaml except for a few small differences in the built in data types, which are backed by JS types instead of the somewhat unusual Ocaml versions.

Neither sounds like what you are looking for.

You might be way past this point, but it could be you could get most of what you want by adopting a few JS conventions.

I don’t know much about how RPG Maker integrates JS - is it its own engine with weird quirks or is it a standard js runtime?