How to use the terser.AST_Node function in terser

To help you get started, we’ve selected a few terser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emscripten-core / emscripten / tools / acorn-optimizer.js View on Github external
AJSDCE: AJSDCE,
  applyImportAndExportNameChanges: applyImportAndExportNameChanges,
  emitDCEGraph: emitDCEGraph,
  applyDCEGraphRemovals: applyDCEGraphRemovals,
  minifyWhitespace: function() { minifyWhitespace = true },
  noPrint: function() { noPrint = true },
  dump: function() { dump(ast) },
  growableHeap: growableHeap,
};

passes.forEach(function(pass) {
  registry[pass](ast);
});

if (!noPrint) {
  var terserAst = terser.AST_Node.from_mozilla_ast(ast);
  var output = terserAst.print_to_string({
    beautify: !minifyWhitespace,
    indent_level: minifyWhitespace ? 0 : 1,
    keep_quoted_props: true, // for closure
  });
  print(output);
}

terser

JavaScript parser, mangler/compressor and beautifier toolkit for ES6+

BSD-2-Clause
Latest version published 1 month ago

Package Health Score

92 / 100
Full package analysis