Skip to content

Latest commit

 

History

History
70 lines (44 loc) · 1.57 KB

README.md

File metadata and controls

70 lines (44 loc) · 1.57 KB

Retidy

GitHub stars npm npm downloads license

Extract, unminify, and beautify ("retidy") each file from a webpack/parcel bundle

⚠️ No Unit Tests, may have unexpected side effects ⚠️

Installation

npm install -g retidy

Usage

CLI

retidy \
    -i <bundle_file> \
    -o <out_dir> \
    -t <bundle_type> \
    -b <bundle_ast_reference>

see

retidy --help

API

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).

Options

see src/options.ts

Example

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"] })

License

MIT

Legal note

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.