New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to disable specific optimizations at will #66

Open
mathiasbynens opened this Issue Apr 1, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@mathiasbynens
Contributor

mathiasbynens commented Apr 1, 2013

It would be cool if there was an boolean option that we could pass to esmangle for each of these optimizations: https://github.com/Constellation/esmangle/blob/c9393254197119a73f92055ee6d1887535cbf47d/lib/esmangle.js#L254-L288

All the options would be true by default, but that way people could disable optimizations they don’t need/want, e.g.:

esmangle.optimize(ast, {
  'pass/hoist-variable-to-arguments': false
});
@michaelficarra

This comment has been minimized.

Show comment
Hide comment
@michaelficarra

michaelficarra Apr 1, 2013

Member

The pipeline is the optional second parameter in optimize. mangle just does name mangling. See this example esmangle usage: https://github.com/Constellation/esmangle/blob/c9393254197119a73f92055ee6d1887535cbf47d/bin/esmangle.js#L66-L69

Member

michaelficarra commented Apr 1, 2013

The pipeline is the optional second parameter in optimize. mangle just does name mangling. See this example esmangle usage: https://github.com/Constellation/esmangle/blob/c9393254197119a73f92055ee6d1887535cbf47d/bin/esmangle.js#L66-L69

@mathiasbynens

This comment has been minimized.

Show comment
Hide comment
@mathiasbynens

mathiasbynens Apr 1, 2013

Contributor

Thanks, @michaelficarra; I’ve edited my code example.

So far, I’ve only seen (and used) examples where null is passed as the second argument (= pipeline) to esmangle.optimize. What should pipeline look like if you only want to remove/avoid one or two optimizations?

Contributor

mathiasbynens commented Apr 1, 2013

Thanks, @michaelficarra; I’ve edited my code example.

So far, I’ve only seen (and used) examples where null is passed as the second argument (= pipeline) to esmangle.optimize. What should pipeline look like if you only want to remove/avoid one or two optimizations?

@michaelficarra

This comment has been minimized.

Show comment
Hide comment
@michaelficarra

michaelficarra Apr 1, 2013

Member

Yeah, unfortunately, it's a "replacement" API where, if you provide a value, it is used as an alternative to the default. If you want to disable just one transformation, you will have to explicitly specify all transformations except the one you'd like to omit. We could probably use an "except" style API.

Member

michaelficarra commented Apr 1, 2013

Yeah, unfortunately, it's a "replacement" API where, if you provide a value, it is used as an alternative to the default. If you want to disable just one transformation, you will have to explicitly specify all transformations except the one you'd like to omit. We could probably use an "except" style API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment