POC/WIP: port to CommonJS

Working proof-of-concept to have a look at. All tests pass.