{"id":19826884,"url":"https://github.com/estools/esmangle","last_synced_at":"2025-10-10T23:41:44.011Z","repository":{"id":4477861,"uuid":"5616845","full_name":"estools/esmangle","owner":"estools","description":"esmangle is mangler / minifier for Mozilla Parser API AST","archived":false,"fork":false,"pushed_at":"2016-03-02T19:29:25.000Z","size":1324,"stargazers_count":294,"open_issues_count":32,"forks_count":35,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-30T00:09:03.488Z","etag":null,"topics":["ast","ecmascript","estree","javascript"],"latest_commit_sha":null,"homepage":"https://estools.github.io/esmangle/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/estools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.BSD","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-30T15:29:25.000Z","updated_at":"2025-03-06T18:16:00.000Z","dependencies_parsed_at":"2022-08-22T11:00:29.349Z","dependency_job_id":null,"html_url":"https://github.com/estools/esmangle","commit_stats":null,"previous_names":["constellation/esmangle"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estools%2Fesmangle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estools%2Fesmangle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estools%2Fesmangle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estools%2Fesmangle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/estools","download_url":"https://codeload.github.com/estools/esmangle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419860,"owners_count":20936012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","ecmascript","estree","javascript"],"created_at":"2024-11-12T11:11:53.365Z","updated_at":"2025-10-10T23:41:38.959Z","avatar_url":"https://github.com/estools.png","language":"JavaScript","readme":"# esmangle [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-url]][daviddm-image]\n\nesmangle ([esmangle](http://github.com/estools/esmangle)) is\nmangler / minifier for [Parser API](https://developer.mozilla.org/en/SpiderMonkey/Parser_API) AST.\n\n### Install\n\nesmangle can be used in a web browser: \u003ca href=\"http://constellation.github.com/esmangle/javascripts/esmangle.js\" target=\"_blank\"\u003eDownload\u003c/a\u003e\n\n```html\n\u003cscript src=\"esmangle.js\"\u003e\u003c/script\u003e\n```\n\n\nNode.js application via the package manager:\n\n```sh\nnpm install esmangle\n```\n\nIf you would like to use latest esmangle in a browser, you can build `build/esmangle.min.js`:\n\n```sh\nnpm run-script build\n```\n\n\n### Usage\n\nA simple example: the program\n\n```js\nvar ast = esprima.parse(code);\nvar result = esmangle.mangle(ast);  // gets mangled AST\nconsole.log(escodegen.generate(result));  // dump AST\n```\n\nOr you can simply use this `esmangle` command in the shell.\n\n```sh\n$ esmangle file.js\n```\n\nGet more compressed result: (in Node.js)\n\n```js\nvar ast = esprima.parse(code);\n// Get optimized AST\nvar optimized = esmangle.optimize(ast, null);\n// gets mangled AST\nvar result = esmangle.mangle(optimized);\nconsole.log(escodegen.generate(result, {\n    format: {\n        renumber: true,\n        hexadecimal: true,\n        escapeless: true,\n        compact: true,\n        semicolons: false,\n        parentheses: false\n    }\n}));  // dump AST\n```\n\n\n### Design\n\nSlide is [here](https://speakerdeck.com/constellation/escodegen-and-esmangle-using-mozilla-javascript-ast-as-an-ir).\nThis resolution algorithm is based on my bytecode compiler [iv / lv5 / railgun](https://github.com/Constellation/iv/tree/master/iv/lv5/railgun).\n\n### License\n\nCopyright (C) 2012 [Yusuke Suzuki](http://github.com/Constellation)\n (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n  * Redistributions of source code must retain the above copyright\n    notice, this list of conditions and the following disclaimer.\n\n  * Redistributions in binary form must reproduce the above copyright\n    notice, this list of conditions and the following disclaimer in the\n    documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL \u003cCOPYRIGHT HOLDER\u003e BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n[npm-url]: https://npmjs.org/package/esmangle\n[npm-image]: https://badge.fury.io/js/esmangle.png\n[travis-url]: https://travis-ci.org/estools/esmangle\n[travis-image]: https://travis-ci.org/estools/esmangle.png?branch=master\n[coveralls-url]: https://coveralls.io/r/estools/esmangle\n[coveralls-image]: https://coveralls.io/repos/estools/esmangle/badge.png\n[depstat-url]: https://david-dm.org/estools/esmangle\n[depstat-image]: https://david-dm.org/estools/esmangle.png\n[daviddm-url]: https://david-dm.org/estools/esmangle.png?theme=shields.io\n[daviddm-image]: https://david-dm.org/estools/esmangle\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festools%2Fesmangle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Festools%2Fesmangle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festools%2Fesmangle/lists"}