I mean the only thing you need to reverse engineer is basically console.log.
Here's a small thing I made:
Ideally you dont want to hack the lang, and instead be specific about the terminal.
P.S. from now on I'll refer to SO as downvote xD because everybody downvotes too much (maybe that includes me lol)
Well, I made something a long time ago that did kinda what you want: