Extract, unminify, and beautify ("retidy") each file from a webpack/parcel bundle
npm install -g retidy
retidy \
-i <bundle_file> \
-o <out_dir> \
-t <bundle_type> \
-b <bundle_ast_reference>
see
retidy --help
import retidy from "retidy"
retidy(bundleCode[, options])
retidy(bundleCode: string, options?: Options): Promise<string[]>
If set options.writeFiles = true
(by default), retidy will write extracted code files into the file system (under options.outDir
directory, ./retidy-out/
by default).
see src/options.ts
import retidy from "retidy"
import fs from "fs"
const code = fs.readFileSync("path/to/webpack-bundle.js", "utf-8")
retidy(code, { type: "webpack", outDir: "./out/", bundleAstReferenceKeys: ["body", 0, "expression", "right"] })
MIT
Some companies specify in their terms of service that their code cannot be "reverse engineered".
Hope you understand what you are doing so you don't break any agreements.