A tool for making JavaScript code run faster. Prepack is still in an early development stage and not ready for production use just yet. Please try it out, give feedback, and help fix bugs. Prepack is a tool that optimizes JavaScript source code: Computations that can be done at compile-time instead of run-time get eliminated. Prepack replaces the global code of a JavaScript bundle with equivalent code that is a simple sequence of assignments. This gets rid of most intermediate computations and object allocations. Prepack operates at the AST level, using Babel to parse and generate JavaScript source code. At the core of Prepack is an almost ECMAScript 5 compatible interpreter — implemented in JavaScript! The interpreter closely follows the ECMAScript 2016 Language Specification, with a focus on correctness and spec conformance. You can think of the interpreter in Prepack as a clean reference implementation of JavaScript.
Features
- Abstract Syntax Tree (AST) and integration with React Native tool chain
- Concrete execution and symbolic execution
- Abstract interpretation and heap serialization
- Stabilizing existing feature set for Prepacking of React Native bundles
- Optimize more code and implement further serialization optimizations
- Check and reject two different optimized functions that mutate the same state