Added support for module systems.

Stripped-down version of #168, which adds support for RequireJS and CommonJS (e.g: node).