Show HN: Esperanto – Convert ES6 modules to AMD, CommonJS
rich-harris.co.uk
rich-harris.co.uk
See the test case here:
https://github.com/thomasboyt/es6-cycles-comparison
The es6-module-transpiler output functions correctly, while the Esperanto output does not. This means that while Esperanto can translate the syntax of ES6 modules for you, it doesn't currently match semantics like es6-module-transpiler does.
This was a weekend project, using the examples from http://jsmodules.io/ as a starting point. Not finished yet :-)
There's lots of other good test cases here that should be adaptable: https://github.com/esnext/es6-module-transpiler/tree/master/...
I've written some more about why to use Esperanto instead of the alternatives here: https://github.com/Rich-Harris/esperanto#why-not-use-existin...
Esperanto will have plugins for those build tools soon! Oh, and I second your recommendation for the Sublime JavaScriptNext package.
I'm a bit confused by the Named imports example though. What is the signifance of the __imports_0 variable in both the AMD and CommonJS conversions?
I plan to make this a bit friendlier in a future version of Esperanto: https://github.com/Rich-Harris/esperanto/issues/3