-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Esprima minification corrupts some lambdas #64
Comments
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. |
Same issue opichals/EspruinoDocs@d859be3 |
I'm open to suggestions for workarounds. Sadly even Esprima (the tool used for offline minification in the Web IDE) doesn't seem capable of handling them :( |
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? |
There's the online closure minifier that should work then? My problem is that while I could drag it into EspruinoTools, the chances of actually getting that running in the browser for the graphical IDE seem slim? |
It should just work IMO. They use GWT which produces browser compatible JS output. I'll try to do a proper PR in this direction. |
This should not be a problem as there is |
The #58 (or espruino/Espruino#1078) seems to be a duplicate of this. @gfwilliams I'd suggest deprecating the |
Closing this - Esprima fixed anyway with a1493a2 - and yes, I will finally try and merge the rollup stuff too but there are PRs open for that :) |
Please have a look at the espruino/EspruinoDocs@25dc728 MPR121 sensor module commit for the workarounds (removed the use of lambdas in favor of functions) that had to be made for the module to get minified correctly.
The text was updated successfully, but these errors were encountered: