square/es6-module-transpiler — pull request #120 by josh (2014-04-09 21:48:23+00:00)
Title: Spike: Transpile to System module loader

I had this idea recently after talking with @wycats at the Extensible Web Summit (4/4/2014). He mentioned I should get involved here.

Assuming native or [polyfilled](https://github.com/ModuleLoader/es6-module-loader) `System` loader support, we should be able to transpile ES6 module syntax into ES3 syntax compatible `System` loader definitions.

**ES6 syntax**

``` js
// app.js
import $ from "jquery";
import _ from "underscore";

function start() {}

export { start };
```

**System loader output**

``` js
Promise.all([
System.import('jquery'),
System.import('underscore')
].then(function(imports) {
var $ = imports[0];
var _ = imports[1];

function start() {}

System.set('app', new Module({ start: start }));
})
```

I'm not totally sure on which `Loader` APIs this should use (I'm not quite sure I'm reading the latest agreed upon spec). Hopefully the gist of this idea makes sense.

cc @thomasboyt @wycats @guybedford @dherman