mwaylabs / Espresso

The-M-Projects build tools using node.js.
www.the-m-project.org
Other
84 stars 28 forks source link

DCE using AST (generated by JSLINT) #7

Closed 4z3 closed 13 years ago

4z3 commented 13 years ago

This patch adds file-based dead code elimination (DCE) by analyzing the abstract syntax tree (AST) of the JavaScript files.

The AST gets generated by an adapted version of JSLINT. The mutilation of JSLINT was necessary in order to get the AST more often than not. There may be cases where JSLINT still won't produce an AST because it it so picky about the source code. In that case more modifications will be required or no DCE will be performed.

This patch reduces the average application size of the mwaylabs/The-M-Project-Sample-Apps by solid 20%

This patch has only be tested with mwaylabs/The-M-Project-Sample-Apps, which seem to work...^_^