JS开源:Prepack-非死book 出品的 JS 混淆压缩工具

mr.jiang 7年前
   <h2>Prepack</h2>    <p>Prepack is a partial evaluator for JavaScript. Prepack rewrites a JavaScript bundle, resulting in JavaScript code that executes more efficiently. For initialization-heavy code, Prepack works best in an environment where JavaScript parsing is effectively cached.</p>    <p>See the official <a href="/misc/goto?guid=4959748303360339816" rel="nofollow,noindex">prepack.io</a> website for an introduction and an <a href="/misc/goto?guid=4959748303438832328" rel="nofollow,noindex">interactive REPL playground</a> .</p>    <h2>Status</h2>    <ul>     <li><a href="/misc/goto?guid=4959748303525321179" rel="nofollow,noindex">test262 status on master branch</a></li>     <li><a href="/misc/goto?guid=4959748303601870473" rel="nofollow,noindex">code coverage report for serialization tests</a></li>     <li>To see the status for a pull request, look for the message <em>All checks have passed</em> or <em>All checks have failed</em> . Click on <em>Show all checks</em> , <em>Details</em> , <em>Artifacts</em> , and then <em>test262-status.txt</em> or <em>coverage-report-sourcemapped/index.html</em> .</li>    </ul>    <h2>How to get the code</h2>    <ol start="0">     <li>Clone repository and make it your current directory.</li>     <li>git submodule init</li>     <li>git submodule update --recursive --remote</li>     <li>Get npm and node, then do npm install</li>    </ol>    <h3>How to build, lint, type check</h3>    <ol start="0">     <li>Get the code</li>     <li>npm run build<br> You can later run npm run watch in the background to just compile changed files on the fly.</li>     <li>npm run lint</li>     <li>npm run flow</li>    </ol>    <h3>How to run tests</h3>    <ol start="0">     <li>Get the code</li>     <li>Make sure the code is built, either by running npm run build or npm run watch</li>     <li>npm test</li>    </ol>    <p>You can run individual test suites as follows.</p>    <ul>     <li>npm run test-serializer<br> This tests the interpreter and serializer. All tests should pass.</li>     <li>npm run test-test262<br> This tests conformance against the test262 suite. Not all will pass, increasing conformance is work in progress.</li>    </ul>    <h2>How to run the interpreter</h2>    <ol start="0">     <li>Get the code</li>     <li>Make sure the code is built, either by running npm run build or npm run watch</li>     <li>npm run repl<br> This starts an interactive interpreter session.</li>    </ol>    <h2>How to run Prepack</h2>    <ol start="0">     <li> <p>Get the code</p> </li>     <li> <p>Make sure the code is built, either by running npm run build or npm run watch .</p> </li>     <li> <p>Have a JavaScript file handy that you want to prepack, for example:</p> <p>echo "function hello() { return 'hello'; } function world() { return 'world'; } s = hello() + ' ' + world();" >/tmp/sample.js</p> </li>     <li> <p>npm run prepack /tmp/sample.js<br> Try --help for more options.</p> </li>    </ol>    <h2>How to validate changes</h2>    <p>Instead of building, linting, type checking, testing separately, the following does everything together:</p>    <p>npm run validate</p>    <h2>How to edit the website</h2>    <p>The content for <a href="/misc/goto?guid=4959748303360339816" rel="nofollow,noindex">prepack.io</a> resides in the <a href="/misc/goto?guid=4959748303692385478" rel="nofollow,noindex">gh-pages branch</a> of this repository. To make changes, submit a pull request, just like for any code changes. In order to run the website locally at <a href="/misc/goto?guid=4958969671911503219" rel="nofollow,noindex">localhost:8000</a> , run python -m SimpleHTTPServer from the cloned gh-pages branch.</p>    <p>At this time, a particular bundled version of Prepack is checked in to the gh-pages branch at js/prepack.min.js . To update the bundle, run npm run build-bundle from the master branch, and copy the resulting prepack.min.js file into the gh-pages branch into the js directory, and submit a pull request for that change.</p>    <h2>How to contribute</h2>    <p>For more information about contributing pull requests and issues, see our <a href="/misc/goto?guid=4959748303810423853" rel="nofollow,noindex">Contribution Guidelines</a> .</p>    <h2>License</h2>    <p>Prepack is BSD-licensed. We also provide an additional patent grant.</p>    <p> </p>    <p>项目主页:<a href="http://www.open-open.com/lib/view/home/1493886817028">http://www.open-open.com/lib/view/home/1493886817028</a></p>    <p> </p>