jlongster / es6-macros

A collection of sweet.js macros that implement ES6 features for ES5
BSD 2-Clause "Simplified" License
238 stars 18 forks source link

Add module support #18

Open valpackett opened 10 years ago

valpackett commented 10 years ago

This patch adds support for latest ES6 module syntax, which is compiled to CommonJS. It uses the same convention for default as Square's es6-module-transpiler, ie. module.exports['default'] / require('something')['default'].

valpackett commented 10 years ago

@jlongster?

nmn commented 10 years ago

Any updates on this??

jlongster commented 10 years ago

Sorry guys. I meant to come back to this and think hard about it. Initially I wasn't going to include module support, and leave that to other transpilers.

Since you've committed code though... I'll think about it. Modules are a big feature. I'm almost inclined to split it off into a separate project so that es6-macros focuses on the smaller features that we can simulate almost 100%.

Compiling modules this way is only getting at part of the ES6 features. You don't get live bindings and other stuff. But that's how all ES6->CJS compilers work, so it might be worth having. Let me get back to this in 1-2 weeks. Thanks!

valpackett commented 10 years ago

Well, if you think it belongs in a separate project, I should be the one doing it, because I wrote the code ;-)