Name: esmangle
Owner: node_modules
Description: esmangle is mangler / minifier for Mozilla Parser API AST
Created: 2015-10-21 13:41:26.0
Updated: 2015-10-21 13:46:12.0
Pushed: 2015-10-29 03:52:47.0
Homepage: https://estools.github.io/esmangle/
Size: 1410
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
esmangle (esmangle) is mangler / minifier for Parser API AST.
esmangle can be used in a web browser: Download
ipt src="esmangle.js"></script>
Node.js application via the package manager:
install esmangle
If you would like to use latest esmangle in a browser, you can build build/esmangle.min.js
:
run-script build
A simple example: the program
ast = esprima.parse(code);
result = esmangle.mangle(ast); // gets mangled AST
ole.log(escodegen.generate(result)); // dump AST
Or you can simply use this esmangle
command in the shell.
mangle file.js
Get more compressed result: (in Node.js)
ast = esprima.parse(code);
et optimized AST
optimized = esmangle.optimize(ast, null);
ets mangled AST
result = esmangle.mangle(optimized);
ole.log(escodegen.generate(result, {
format: {
renumber: true,
hexadecimal: true,
escapeless: true,
compact: true,
semicolons: false,
parentheses: false
}
// dump AST
Slide is here. This resolution algorithm is based on my bytecode compiler iv / lv5 / railgun.
Copyright © 2012 Yusuke Suzuki (twitter: @Constellation) and other contributors.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL