We wrote a custom language, only it's javascript. We built a very simple module/class system that compiles to javascript, in javascript. It consists of functions called 'Module', 'Class', 'Static' and such, that generate javascript code. This has had so much value for us. It allowed us to abstract some patterns into 'compiler extensions' for things like scoping, timeouts and cancellation, etc. And more recently, it allowed us to add typechecking by outputting typescript instead of javascript. I think it was a great idea and would do it again, but it's only been 6 years, so perhaps ask me again in 4 years :)