gulp-obfuscate icon indicating copy to clipboard operation
gulp-obfuscate copied to clipboard

Obfuscator brakes the code

Open LKay opened this issue 10 years ago • 8 comments

Obfuscator brakes working code after processing and not working correctly with gulp-sourcemaps. My task looks like the following:

return gulp.src(paths.src.js)
        .pipe(gulpif((process.env.ENV !== "production"), sourcemaps.init()))
            .pipe(concat("all.js"))
            .pipe(obfuscate({
                replaceMethod: obfuscate.ZALGO
            }))
            .pipe(uglify())
        .pipe(gulpif((process.env.ENV !== "production"), sourcemaps.write()))
        .pipe(gulp.dest(paths.dist.js));

Uglify is optional of course and the same thing happens without it. First of all sourcemaps are not supported, but it's not the most important case.

There are a lot of broken code reporting errors such as undefined is not a function or cannot access property of undefined. For example this happens for Object.keys method and other core javascript methods as well as global variables and variables inside clojures. Tried to add such keywords to exclude but can't get rid of all errors.

LKay avatar Jan 08 '15 07:01 LKay

+1

daldegam avatar Apr 01 '15 11:04 daldegam

same here. one example for all: function test(){} alert('test') is changed to functionಠ_ಠ727() {} alert("ಠ_ಠ727") as you can see, string inside alert was changed because there was a function named test. correct output should be alert('test') (its the same with single or double quotes) also a space between function and a changed function name ಠ_ಠ727 was removed. correct output should be function ಠ_ಠ727() {}

gondo avatar Jul 16 '15 13:07 gondo

+1

pickworth avatar Sep 16 '15 09:09 pickworth

This also breaks an AngularJS application. Meaning: [ "$http", function($http) { has to always be: [ "$http", function( ಠ_ಠ727 ) { instead of: [ "ಠ_ಠ727", function( ಠ_ಠ727 ) {

koox00 avatar Jan 11 '16 07:01 koox00

The same issue, seems the owner is no longer developing it.

dangquang1020 avatar May 24 '16 03:05 dangquang1020

The same with nodejs module.exports gets broken. I use gulp-uglify which worked for me.

360disrupt avatar May 19 '17 10:05 360disrupt

it still happening?

ronaldohoch avatar May 23 '17 16:05 ronaldohoch

Same problems for me, changing the replaceMethod: obfuscate.ZALGO is giving me errors also.

ghost avatar Mar 06 '18 15:03 ghost