add optional AMD and CommonJS support

This patch adds optional support ADM & CommonJS.