esnext / es6-module-transpiler

Tomorrow’s JavaScript module syntax today
http://esnext.github.io/es6-module-transpiler/
Other
1.21k stars 85 forks source link

Add support for exporting ES6 classes. #182

Closed eventualbuddha closed 9 years ago

eventualbuddha commented 9 years ago

@caridy @domenic

This should allow the module transpiler to work properly when classes are exported. I believe the three cases @caridy added are tested in this PR.

Closes #176.

caridy commented 9 years ago

:beers:

matthewrobb commented 9 years ago

@caridy Should this fix all the issues or do the formatters need updated to support?

caridy commented 9 years ago

no, I don't think we need to change any formatter. They should just work. You can try it, and report back :)

matthewrobb commented 9 years ago

Yeah I am getting an error, hold on a sec

EDIT: Object #<SystemFormatter> has no method 'processClassDeclaration'

eventualbuddha commented 9 years ago

In most cases formatters can probably just implement processClassDeclaration with the same body as processFunctionDeclaration, with the exception that class declarations don't hoist.

caridy commented 9 years ago

@eventualbuddha can we make that the default behavior for all formatters? my assumption is that most formatters will just do nothing but retain the declaration.

eventualbuddha commented 9 years ago

Discussed on #esnext-infrastructure. We're going to leave the es6-module-transpiler as-is and ask formatters to implement processClassDeclaration.