Unpack esbuild bundles
- TypeScript 89.3%
- JavaScript 10.7%
| src | ||
| .gitignore | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
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
- Module exports: never used, so I assume it was a shortcut to create a local variable for minification purposes
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