stephenmathieson / node-obfuscator

maintainer wanted → Obfuscate your node packages because your boss says so!
216 stars 36 forks source link

Request for an option to output the concatenated source so uglifyjs warning can be taken care of more easily #31

Open shiwanlin opened 8 years ago

shiwanlin commented 8 years ago

Not a high priority but a nicety to have an option to output the concatenated source so uglifyjs warning can be taken care of more easily, say, in utils.js,

exports.uglify = function (js, opts, cb) {
...
    return cb(null,  stream.toString(), js);
...
}

with the source output, the line number from the uglifyjs warning can be easily found:

WARN: Non-strict equality against boolean: != true [null:3470,6]

BTW, obfuscator is a great tool!

catdad commented 8 years ago

I took a quick look at the source, and this is already possible, as such:

var options = {}; // build options as per documentation
var obfuscator = require('obfuscator').obfuscator;
var concatenate = obfuscator.concatenate;

concatenate(options, function(err, concatenated) {
    if (err) { throw err; }

    fs.writeFileSync('concatenated.js', concatenated);
    // or, you know, do whatever you like
});
shiwanlin commented 8 years ago

That's cool - thanks!