Add AMD and CommonJS compatibility.