turn generic javascript into AMD / commonJs loadable modules