A compiler support for non-Closure transforms (JSX, etc)
Description
There are now a variety of JS dialects, JSX, TypeScript etc. which need to be transformed first into regular JS before module processing. We should devise a standard way to deal with this. As we cannot predict what various dialects may arise in the future it's probably best to provide something like reprocess-module option to cljs.closure/build.
Attached a patch for adding support for foreign libs preprocessing. Users can add support for a JS dialect by implementing the js-transforms function and using the reprocess foreign lib compiler option. Both, js-transforms and convert-js-modules, now take an IJavaScript and return an IJavaScript.
David Nolen
July 2, 2015 at 12:02 AM
I went ahead and looked into this a bit. Looks like getting Babel to work will take some time. Babel has difficulties loading into Nashorn due to code size limits that originate from Lodash usage. JSX while deprecated is still the most widely used option so we have some time yet and the interface supplied by both tools is exactly the same. So we should test this feature with JSX and switch to Babel when the issues are resolved.
David Nolen
June 17, 2015 at 11:20 PM
We should verify with Babel now that React is moving away from JSX.
There are now a variety of JS dialects, JSX, TypeScript etc. which need to be transformed first into regular JS before module processing. We should devise a standard way to deal with this. As we cannot predict what various dialects may arise in the future it's probably best to provide something like
reprocess-module
option tocljs.closure/build
.