Socket
Socket
Sign inDemoInstall

grunt-javascript-obfuscator

Package Overview
Dependencies
171
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

8

package.json
{
"name": "grunt-javascript-obfuscator",
"description": "Obfuscates JavaScript files using amazing javascript-obfuscator.",
"version": "1.1.0",
"version": "1.2.0",
"main": "tasks/javascript_obfuscator.js",
"files": ["tasks"],
"files": [
"tasks"
],
"homepage": "https://github.com/tomasz-oponowicz/grunt-javascript-obfuscator",
"author": {
"name": "Tomasz Oponowicz",
"email": "tomasz.oponowicz@zaxo.biz"
"email": "tomasz@zaxo.biz"
},

@@ -12,0 +14,0 @@ "repository": {

@@ -42,3 +42,3 @@ # grunt-javascript-obfuscator

..._javascript-obfuscator_ is defined as a peer dependency. In other words you can experiment with every version above `0.7.2`.
..._javascript-obfuscator_ is defined as a peer dependency. In other words you can experiment with every version above `0.7.2`.

@@ -136,2 +136,3 @@ Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

* 2019-08-15 / v1.2.0 / Added source map support.
* 2016-12-23 / v1.1.0 / Obfuscate and overwrite files without destination.

@@ -138,0 +139,0 @@ * 2016-11-11 / v1.0.4 / Updated README.

@@ -12,2 +12,3 @@ /*

var JavaScriptObfuscator = require('javascript-obfuscator');
var path = require('path');

@@ -24,6 +25,34 @@ function concat(grunt, paths) {

function sourceMap(grunt, obfuscated, destFile, options) {
if (!options.sourceMap || options.sourceMapMode !== 'separate') {
return false;
}
var sourceMap = obfuscated.getSourceMap();
var sourceMapFileName = destFile + '.map';
if (options.sourceMapFileName) {
sourceMapFileName = path.normalize(
path.dirname(destFile) +
'/' +
options.sourceMapFileName +
'.js.map'
);
}
var obfuscatedSource = obfuscated.getObfuscatedCode();
obfuscatedSource += '\n//# sourceMappingURL=' + sourceMapFileName;
grunt.file.write(destFile, obfuscatedSource);
grunt.file.write(sourceMapFileName, sourceMap);
grunt.log.writeln('File "' + sourceMapFileName + '" saved as source map.');
}
function obfuscate(grunt, originalSource, destFile, options) {
var obfuscatedSource = JavaScriptObfuscator.obfuscate(originalSource, options).getObfuscatedCode();
var obfuscated = JavaScriptObfuscator.obfuscate(originalSource, options);
var obfuscatedSource = obfuscated.getObfuscatedCode();
grunt.file.write(destFile, obfuscatedSource);
grunt.log.writeln('File "' + destFile + '" obfuscated.');
sourceMap(grunt, obfuscated, destFile, options);
}

@@ -30,0 +59,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc