Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

contego

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contego - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

30

index.js

@@ -8,3 +8,2 @@

const uglifyES = require('uglify-es')
const uglifyJS = require('uglify-js')

@@ -58,16 +57,23 @@ function getAllFiles(sourcePath, destPath, debug = false, ignoreRegex = undefined) {

}
let ast = esprima.parse(contents)
let obfuscated = confusion.transformAst(ast, confusion.createVariableName)
let confused = escodegen.generate(obfuscated)
if (typeof (es) === 'boolean') {
let resp = null;
if (es === true) {
resp = uglifyES.minify({ [filepath]: confused }, { warnings: true })
} else {
resp = uglifyJS.minify({ [filepath]: confused }, { warnings: true })
if (es === true) {
let opts = {
warnings: debug,
debug: debug,
beautify: false,
bracketize: true,
compress: {
drop_debugger: true,
dead_code: true,
passes: 2
}
}
let resp = uglifyES.minify({ [filepath]: confused })
if (resp.error) {
throw resp.error
} else if (resp.warnings) {
console.warn(resp.warnings)
console.warn(resp.warnings, filepath)
}

@@ -100,3 +106,3 @@ return resp.code

}
console.warn(`error while converting file ${file}`)
console.warn(`error while converting file ${file} ${e.message}`)
fs.copyFileSync(file, dpath)

@@ -122,3 +128,3 @@ }

.option('-e, --error [type]', 'throw error [true|false]', 'false')
.option('-u, --uglify [type]', 'Use uglify, define type of js syntax [js|es|null]', 'es')
.option('-u, --uglify [type]', 'Use uglify [true|false]', 'true')
.option('-d, --debug [type]', 'Run in debug mode type of debug [false|true]', 'false')

@@ -130,5 +136,5 @@ .option('-r, --ignore [ignoreRegexString]', 'Regex value to ignore files like ^[a-zA-Z0-9_]+\.js', '')

.action(function (src, dest) {
if (program.uglify == 'es') {
if (program.uglify == 'true') {
program.uglify = true;
} else if (program.uglify == 'js') {
} else {
program.uglify = false;

@@ -135,0 +141,0 @@ }

17

package.json
{
"name": "contego",
"version": "0.0.4",
"description": "simple code protect for javascript files",
"version": "0.0.5",
"description": "Simple code protect for javascript files",
"main": "index.js",

@@ -24,10 +24,9 @@ "scripts": {},

"dependencies": {
"commander": "^2.14.1",
"confusion": "^0.1.1",
"escodegen": "^1.9.1",
"esprima": "^4.0.0",
"fs-extra": "^5.0.0",
"uglify-es": "^3.3.9",
"uglify-js": "^3.3.13"
"commander": "2.14.1",
"confusion": "0.1.1",
"escodegen": "1.9.1",
"esprima": "4.0.0",
"fs-extra": "5.0.0",
"uglify-es": "3.3.9"
}
}

@@ -14,4 +14,4 @@

- dest dir = destination directory
- -u = use uglify, es for es6 files, js for es5 or below and null for skipping uglify
- -d = debug mode, for extra logging
- -u = use uglify, true or false
- -d = debug mode,true or false for extra logging
- -i = ignore regex string, provide regex to ignore any files define by user

@@ -18,0 +18,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc