gulp-javascript-obfuscator
Advanced tools
Comparing version 1.0.0 to 1.1.0
15
index.js
@@ -7,2 +7,6 @@ var through = require('through2'), | ||
module.exports = function gulpJavaScriptObfuscator(options) { | ||
if(!options) { | ||
options = {} | ||
} | ||
return through.obj(function (file, enc, cb) { | ||
@@ -18,3 +22,12 @@ var obfuscationResult; | ||
file.contents = new Buffer(obfuscationResult.getObfuscatedCode()); | ||
cb(null, file); | ||
this.push(file); | ||
if(options.sourceMap && options.sourceMapMode !== 'inline') { | ||
this.push(new gutil.File({ | ||
cwd: file.cwd, | ||
base: file.base, | ||
path: file.path + '.map', | ||
contents: new Buffer(obfuscationResult.getSourceMap()) | ||
})) | ||
} | ||
cb(); | ||
} | ||
@@ -21,0 +34,0 @@ catch (err) { |
{ | ||
"name": "gulp-javascript-obfuscator", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Gulp plugin for javascript-obfuscator Node.JS package.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/wain-pc/gulp-javascript-obfuscator", |
@@ -1,3 +0,3 @@ | ||
gulp-js-obfuscator | ||
============= | ||
gulp-javascript-obfuscator | ||
========================== | ||
@@ -20,6 +20,7 @@ Gulp plugin for [javascript-obfuscator](https://github.com/javascript-obfuscator/javascript-obfuscator). | ||
gulp.src('file.js') | ||
.pipe(javascriptObfuscator({})) | ||
.pipe(javascriptObfuscator()) | ||
.pipe(gulp.dest('dist')); | ||
``` | ||
## Options | ||
@@ -29,3 +30,12 @@ | ||
**Please note:** Source maps output is not supported yet. Pull requests are welcome! | ||
```javascript | ||
gulp.src('file.js') | ||
.pipe(javascriptObfuscator({ | ||
compact:true | ||
sourceMap: true | ||
})) | ||
.pipe(gulp.dest('dist')); | ||
``` | ||
Using **sourceMap** option with value set to **true** will also output a _.map_ file to Gulp stream. | ||
Sorry, the diff of this file is not supported yet
22080
35
40