PHPParser: Parses PHP source code into AST.ASTOptimizer:- Replaces
extension_loaded("ext")calls withtrueorfalsebased on engine configuration. - Replaces
defined("CONST")withtrueorfalse. - Prunes
if (false)branches. - Unwraps
if (true)blocks.
- Replaces
JSTranspiler:- Generates async JavaScript code using
ctx.getVar(),ctx.setVar(),ctx.echo(), andawait ctx.callFunction(). - Generates source maps (
.js.map). - Writes compiled outputs to disk cache at
${process.env.JSPHP_CACHE}/${EngineSHA1}/${FilePathSHA1}.js.
- Generates async JavaScript code using