Skip to content
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

Minify options #54

Closed
boopathi opened this issue Jul 19, 2016 · 3 comments
Closed

Minify options #54

boopathi opened this issue Jul 19, 2016 · 3 comments

Comments

@boopathi
Copy link
Member

Since it is a preset, there won't be any options passed to the minifier.

for example,

  • mangle topLevel names
  • mangle eval accessible bindings - don't deopt because of the presense of eval
  • apply unsafe optimizations like - !== to !=, >= to <
  • drop debugger & console statements or just one of them
  • preserve fn args and fn name for code depending on fn.length & fn.name

etc...

How to support these as options to be passed to the minifier - when used as a CLI or a Preset?

@hzoo
Copy link
Member

hzoo commented Jul 20, 2016

we could land babel/babel#3331 before that (options for presets)?

@boopathi
Copy link
Member Author

boopathi commented Aug 4, 2016

Yay! It's merged now - babel/babel#3331. We could start discussion about the list of options.

mangle : bool | {
  keepFnames: bool, // overrides keepFnames in root
  eval: bool,
  blacklist: [string]
},
deadcode: bool | {
  keepFnames: bool, // overrides keepFnames in root
  keepFargs: bool,
},
keepFnames: bool, // passed to DCE and Mangler
unsafe: bool | {
  flipComparisons,
  typeConstructors,
  simplifyComparisons,
  guardedExpr,
},
evaluate: bool, // constant folding,
simplify: bool, // simplify, undef to void, 
booleans: bool,
properties: bool,

@jacott
Copy link

jacott commented Oct 7, 2016

I would much appreciate a keepClassNames option

boopathi added a commit that referenced this issue Nov 3, 2016
+ (Close #54)
boopathi added a commit that referenced this issue Nov 20, 2016
+ (Close #54)

Extract OptionsManager to a separate file

Update keepFnName and snapshots

Add regexp constructors
boopathi added a commit that referenced this issue Nov 22, 2016
+ (Close #54)

Extract OptionsManager to a separate file

Update keepFnName and snapshots

Add regexp constructors

rewrite options manager

Fix lint

Remove deadcode
boopathi added a commit that referenced this issue Nov 22, 2016
+ (Close #54)

Extract OptionsManager to a separate file

Update keepFnName and snapshots

Add regexp constructors

rewrite options manager

Fix lint

Remove deadcode
@boopathi boopathi mentioned this issue Nov 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants