js-confuser icon indicating copy to clipboard operation
js-confuser copied to clipboard

escodegen library related to this project

Open minhdukenguyen opened this issue 1 year ago • 1 comments

escodegen library related to this project

node_modules/escodegen/escodegen.js:2516
        result = this[type](expr, precedence, flags);
                           ^

TypeError: this[type] is not a function
    at CodeGenerator.generateExpression (/node_modules/escodegen/escodegen.js:2516:28)

Version in my package-lock.json: 2.3.0

Config

Config:

{
  target: "node",
  preset: "low",
  renameGlobals: false
}

minhdukenguyen avatar Apr 11 '24 02:04 minhdukenguyen

For anyone else running into this, there's a maintained fork of escodegen which doesn't have this issue: https://www.npmjs.com/package/escodegen-wallaby

Workaround:

  • Fork this repository (example).
  • bun install escodegen-wallaby && bun remove escodegen then find and replace require("escodegen") with require("escodegen-wallaby)".
  • Remove dist from .gitignore.
  • bun run build then commit and push everything.
  • Add to your project with bun install $gh_username/js-confuser.

But it does have other issues related to the output - it's concatenating an identifier somewhere, obfuscated code breaks because there's various [object Object] dotted about. Not sure where to go from there.

shellhazard avatar May 01 '24 05:05 shellhazard

Fixed in 2.0 (Currently 2.0.0-alpha.2). The 2.0 version nows uses Babel's parser and generator and is more suited for modern JavaScript syntax.

MichaelXF avatar Sep 30 '24 15:09 MichaelXF