Unpack esbuild bundles
  • TypeScript 89.3%
  • JavaScript 10.7%
Find a file
Coolchickenguy ef8e48f5b6 Update readme
2026-01-19 12:28:28 -07:00
src Remove junk 2026-01-19 12:25:59 -07:00
.gitignore Messy and buggy but "works" with esm support, use typescript 2026-01-19 12:23:10 -07:00
package-lock.json Messy and buggy but "works" with esm support, use typescript 2026-01-19 12:23:10 -07:00
package.json Messy and buggy but "works" with esm support, use typescript 2026-01-19 12:23:10 -07:00
README.md Update readme 2026-01-19 12:28:28 -07:00
tsconfig.json Messy and buggy but "works" with esm support, use typescript 2026-01-19 12:23:10 -07:00

Escrack

Decompile bundles containing commonjs made by esbuild. Each file ends up in it's own file in the output.

Requires the function used to create a module as a cli arg

Regex for finding the module function:

h\s*\(\s*\([^\s\)\(,]*\s*,\s*[^\s,\)\(]*\s*\)\s*=>\s*\{

How it works

The main module wrapper

The main module wrapper is the function that is called to emulate a module system internally to the bundle. It takes the following parameters:

The module initialization function

The module initialization function is used to initialize the module, as per its name. It takes the following params

  • Module exports: module.exports
  • Module: just the plain module object

ESM

defineGetters = (t, e) => { for (var n in e) Object.defineProperty(t, n, { get: e[n], enumerable: !0, }); }, creates a module. t is the module object. n is like this:

{
    export1: () => export1value
}

the exports are not used via the module object always. DUDE WHY