Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Esprima minification corrupts some lambdas #64
referenced this issue
May 9, 2017
Do you have an example of what way they got corrupted? I can't put minification into ES6 mode because Espruino doesn't support the full ES6 spec and the output would almost certainly contain code that Espruino couldn't execute. I guess that might affect the type of code that minification can accept?
If so, this might just be something we have to live with.
I think it works when the exports.connect is lambda, but the arguments are not minified at all.
When the MPR.setThresholds or MPR.touched is lambda the module gets truncated strangely so that it is not functional.
Do we know what are we missing from ES6 that could confuse the minifier? It could be a good idea to complete the Espruinos' ES6 support to whatever level is necessary.
I am not sure about all the requirements. The new kid on the block for ES6 minification appears to be https://github.com/babel/minify. It is quite slow compared to say Uglify, but it should be easy enough to create an Espruino related Babel minify plugin stew.
The closure compiler is reported to work in node as well as in the browsers so once the EspruinoTools lib packaging is resolved it should just be fine. See my experiment working in node.js.
This could be a reasonable solution. Or am I missing something?