Skip to main content

JavaScript optimization

jxscout ships with an optional optimizer that runs during the beautification process. The optimizer is not enabled by default, as it slightly slows down the beautification pipeline and it changes the original JS files. However, if a slight delay in the beautification process is okay for you, optimization can bring a lot of value.

The jxscout optimizer supports the following transformations:

  • JSON parse optimization - jxscout will automatically replace JSON.parse("...") expressions with the actual result. This is often used by bundlers and could uncover things like package.json structs.
  • Variable inliner - jxscout will automatically inline variable references for primitive values, so static analysis can find more relevant results specially for paths.
  • String concatenation resolver - jxscout will automatically resolve string concat expressions. This is useful to find paths in a format like "/api".concat("/users")

To enable the optimizer, you can update your project settings with:

{
// ...
"beautifier": {
"transformations": {
"iterations": 3,
"transformers": ["json_parse", "variable_inliner", "string_concat"]
}
}
}

If you want to keep this enabled for all projects, you should update ~/.jxscout-pro/shared_project_settings.jsonc with these settings.

To see this in action, checkout this lab: https://labs.jxscout.app/labs/js-optimization/