Hey guys,

as you may know, for AeroGear.js 2.1 we are in the middle of refactoring into ES6 module syntax, so finally we will be able to use following in ES6 based projects:

import Authorization from 'aerogear.authorization;


I've finished a prototype of how ES6 (JavaScript.tomorrow) module transpilation to ES5 (JavaScript.today) could work., the code and sample lives here:

https://github.com/aerogear/aerogear-js/pull/154


It basically takes ES6 classes and compiles them to AMD module syntax (which is a browser-oriented module system, implemented e.g. in RequireJS module loader).





These AMD modules can already be consumed by end-user who uses AMD in his project:

require(['aerogear.authorization'], function( Authorization ) {
   ...
});

(Note that similarly we could compile to CommonJS module syntax, that could be leveraged in Browserify projects today, but we agree with Luke to do not dive into that atm).
 




We take it even further by allowing to leverage globally accessible API AeroGear.Authorization without any module loader in your project. This way you will be able to use AeroGear.js 1.3/2.0-like API as it is with no code modifications.

AeroGear.Authorization

This is made to work by taking all the AMD modules, concatenating them and wrapping them into minimal loader ("microlib") that exposes all the modules on global AeroGear object.


Cheers,

~ Lukas