Foundational work for generating JS stubs

I'm just starting on outputting JS but expect that to go fairly quickly.