mishoo / UglifyJS

JavaScript parser / mangler / compressor / beautifier toolkit
http://lisperator.net/uglifyjs/
Other
13.18k stars 1.25k forks source link

Harmony support #448

Closed ozanmakes closed 7 years ago

ozanmakes commented 10 years ago

I'm trying to use the excellent livenode with a project which uses ES6 features introduced in node v11, but unfortunately UglifyJS's parser chokes when it encounters a let statement or a generator function (function *() { yield true }).

kevyworks commented 10 years ago

Any comment on this?

mgol commented 10 years ago

That would be great to have, ES6 brings a lot of important new features but minification of all of them is still needed.

Martii commented 10 years ago

+1

maranomynet commented 9 years ago

+1

darky commented 9 years ago

:+1:

ben-eb commented 9 years ago

+1

kevinjalbert commented 9 years ago

:+1: just got bit by for...of.

ghost commented 9 years ago

If harmony support were enabled, we could also safely convert functions that don't use this to use the => syntax as well.

fabiosantoscode commented 9 years ago

+1 -- I'm writing a game for future browsers so I don't want to add the overhead of traceur to my code.

I also think converting functions to arrows when this is not used would be pretty nice.

fabiosantoscode commented 9 years ago

Adding harmony support on my fork, https://github.com/fabiosantoscode/UglifyJS2/tree/harmony little by little, to later pull request that back to this project.

Got arrow functions working so far (I think).

rvanvelzen commented 9 years ago

@fabiosantoscode Awesome! It would be super cool if you could submit separate new language features as separate pull requests. That will make reviewing them a lot easier. :)

fabiosantoscode commented 9 years ago

Okay, I'll restructure my commit history to do just that.

I'm writing some tests for the parser, and am thinking of doing so for the output as well, is that okay?

rvanvelzen commented 9 years ago

That is certainly okay! Related tasks: #337, #410.

19h commented 9 years ago

:+1: bump.

simonzack commented 9 years ago

:+1:

RamIdeas commented 9 years ago

:+1:

lewispham commented 9 years ago

:+1:

avdg commented 9 years ago

I hope everyone knows how to find technical information about ecmascript 6 / ecmascript 2015

Some examples:

Note: understanding the structure of the spec, instead of reading it may be more important long term, so its easy to find information about specific items of the spec.

Good luck

niemyjski commented 9 years ago

+1

f0rmat1k commented 9 years ago

:+1:

RevanProdigalKnight commented 9 years ago

:+1:

dgieselaar commented 9 years ago

Please, everyone, don't comment with a 👍 or a +1: they add nothing to the discussion and will only antagonize people who have expressed their interest The Right Way™: with the subscribe button.

darky commented 9 years ago

Like most clearly expressed priority of issue You can even sort by "Most commented"

Martii commented 9 years ago

@plestik Adding a vote for support is always in the best interest of a project and is how it has been done for decades. ES6 syntax is something that this project should support to maintain high standards of quality. I am also subscribed to this thread. As you can see by the community outreach there is a strong interest and it should be taken seriously not complained about. :)

avdg commented 9 years ago

Maybe we should start with this question as we can all learn things from each other:

What is your favorite es6 feature?

avdg commented 9 years ago

Those who want to experiment with es6 can do it here: https://iojs.org/en/es6.html

It's basically a fork of node with many es6 features enabled by default.

Martii commented 9 years ago

What is your favorite es6 feature?

Block level scoping with let statement versus var is a plus. This is the most common entry syntax for ES6.

RevanProdigalKnight commented 9 years ago

I have to agree with @Martii; let will be a huge plus for temporary loop variables.

art-in commented 9 years ago

What is your favorite es6 feature?

generators ftw! co + generators + promises ♡

darky commented 9 years ago

@artin-phares Awesome!

avetisk commented 9 years ago

:+1:

albertorestifo commented 9 years ago

:+1:

arackaf commented 9 years ago

I'm curious if there's some sort of status page tracking which ES6 features are yet implemented. Like this, over at Esprima.

https://github.com/jquery/esprima/issues/1099

sbrl commented 9 years ago

That would be handy not only for the UglifyJS developers, but also for other developers who use this library to minify their code.

On 13/07/2015 02:33am, arackaf wrote:

I'm curious if there's some sort of status page tracking which ES6 features are yet implemented. Like this, over at Esprima.

jquery/esprima#1099 https://github.com/jquery/esprima/issues/1099

— Reply to this email directly or view it on GitHub https://github.com/mishoo/UglifyJS2/issues/448#issuecomment-120780583.

rbozan commented 9 years ago

+1.. At least add the let and const tags as they should act the same as "var", and in the future you could make the let tag name change on every block

Martii commented 9 years ago

Note ECMAScript 6th Edition (ES6 a.k.a Harmony) was finalized relatively recently last month.

See also:

SET001 commented 9 years ago

What is your favorite es6 feature?

Please add support for classes and let!

rbozan commented 9 years ago

By the way for anybody reading this, just use Babel.io before you use Uglify, it would work

mgol commented 9 years ago

use Babel.io before you use Uglify, it would work

This prevents browsers from using their own optimized ES6 implementations; over time it will get faster than transpiled ES5 output. Also, this forces even good, modern browsers to download a lot of polyfills.

ES6 support in a JavaScript minifier is needed. It will get more & more needed in the future.

probins commented 9 years ago

also, some ES6 code, like arrow functions, is more concise than ES5, so a modern minifier should be converting ES5 to ES6 for optimal compression

fabiosantoscode commented 9 years ago

@probins I started work on that, but it currently depends on my pull request for arrow functions being accepted.

rvanvelzen commented 9 years ago

I started work on that, but it currently depends on my pull request for arrow functions being accepted.

Could you point me to that PR? I can't seem to find it?

fabiosantoscode commented 9 years ago

I didn't create it yet after all, it was dependent on whether my other pull request was accepted. I'll send it soon

rbozan commented 9 years ago

@mzgol Atleast it works for now, I don't really see this feature getting added to Uglify soon

g-ortuno commented 9 years ago

@rvanvelzen when is the next release planned? Can't wait to use arrow functions with uglify :smile:

fabiosantoscode commented 9 years ago

It would be great to see "beta" support of ES6 coming out so people can report any issues in our implementation of it before we finish all the features.

g-ortuno commented 9 years ago

@fabiosantoscode +1

84564221 commented 9 years ago

See UglifyJS2/tree/harmony

lewispham commented 9 years ago

@fabiosantoscode Do you have any list of anticipated features?

sbrl commented 9 years ago

@fabiosantoscode Beta releases sound good. I think that the github release system lets you mark a release as a pre-release - perhaps that would work?