Code coverage report for lib\minify.js

Statements: 32.14% (9 / 28)      Branches: 50% (1 / 2)      Functions: 0% (0 / 5)      Lines: 32.14% (9 / 28)      Ignored: none     

All files » lib\ » minify.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47  1   1   1   1 1                       1       1 1                       1                  
'use strict';
var UglifyJS, csso, debug, error;
 
csso = require("csso");
 
debug = require("debug")("piler:minify");
 
try {
  UglifyJS = require("uglify-js");
} catch (_error) {
  error = _error;
  debug("no uglify", error);
  exports.jsMinify = function(code) {
    return code;
  };
  exports.jsBeautify = function(code) {
    return code;
  };
}
 
exports.cssMinify = function(code) {
  return csso.justDoIt(code);
};
 
Eif (UglifyJS != null) {
  exports.jsMinify = function(code) {
    var ast, compressed_ast, compressor;
    ast = UglifyJS.parse(code);
    ast.figure_out_scope();
    compressor = UglifyJS.Compressor();
    compressed_ast = ast.transform(compressor);
    compressed_ast.figure_out_scope();
    compressed_ast.mangle_names();
    return compressed_ast.print_to_string({
      beautify: false
    });
  };
  exports.jsBeautify = function(code) {
    var ast;
    ast = UglifyJS.parse(code);
    ast.figure_out_scope();
    return ast.print_to_string({
      beautify: true
    });
  };
}