Don't publish globals unless absolutely necessary

I've added support for nodejs-style modules and AMD, and have removed the global from environments which support such functionality.