diff --git a/README.md b/README.md index f72de74..6c22a0d 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ The only exception is obfuscator's `sourceMap` option which must not be set, as ## Source Maps -With version `1.1.6` onwards, gulp-javascript-obfuscator can be used in tandem with [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) in order to generate source maps for your javascript files. +`gulp-javascript-obfuscator` can be used in tandem with [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) in order to generate source maps for your javascript files. You will need to initialize gulp-sourcemaps prior to running gulp-javascript-obfuscator and write the source maps after, as such: @@ -72,7 +72,3 @@ gulp.src('file.js') .pipe(sourcemaps.write()) .pipe(gulp.dest('dist')); ``` - -### Alternative source maps method - -For backwards compatibility, if `gulp-sourcemaps` is not used and obfuscator's **sourceMap** option is set to **true**, a _.map_ file will be thrown to Gulp stream. ([This method is _deprecated_ and not recommended for future use.](https://github.com/javascript-obfuscator/gulp-javascript-obfuscator/pull/18#backwards-compatibility)) diff --git a/index.js b/index.js index 2a7dd71..7edb040 100644 --- a/index.js +++ b/index.js @@ -17,20 +17,10 @@ module.exports = function gulpJavaScriptObfuscator (options = {}) { try { const obfuscationResult = JavaScriptObfuscator.obfuscate(String(file.contents), options); file.contents = new Buffer(obfuscationResult.getObfuscatedCode()); - if (options.sourceMap && options.sourceMapMode !== 'inline') { - if ( file.sourceMap ) { - const sourceMap = JSON.parse(obfuscationResult.getSourceMap()); - sourceMap.file = file.sourceMap.file; - applySourceMap(file, sourceMap); - } - else { - this.push(new Vinyl({ - cwd: file.cwd, - base: file.base, - path: file.path + '.map', - contents: new Buffer(obfuscationResult.getSourceMap()) - })) - } + if (file.sourceMap) { + const sourceMap = JSON.parse(obfuscationResult.getSourceMap()); + sourceMap.file = file.sourceMap.file; + applySourceMap(file, sourceMap); } return cb(null, file); } catch (err) { diff --git a/package.json b/package.json index fe270bb..3b47950 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-javascript-obfuscator", - "version": "1.1.6", + "version": "2.0.0", "description": "Gulp plugin for javascript-obfuscator Node.JS package", "homepage": "https://github.com/javascript-obfuscator/gulp-javascript-obfuscator", "repository": {
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: