richardfuca / react-native-decompiler

Decompile React Native bundles
GNU Affero General Public License v3.0
103 stars 12 forks source link

React Native Decompiler [ALPHA]

Note that the NPM package react-native-decompiler while based off this repo is maintained by someone else.

DOES NOT SUPPORT HERMES/BINARY (FACEBOOK, INSTAGRAM) REACT NATIVE BUNDLES

DOES NOT SUPPORT WEBPACK V5 BUNDLES

Decompiles React Native index.android.bundle JS files. Webpack files too!

Also tries to remove some compilation artifacts (via internal plugins, ESLint, and Prettier) to make it easier to read.

Usage

  1. Download
  2. npm start -- <ARGUMENTS> (the -- is very important!)

Example command: npm start -- -i index.android.bundle -o ./output

Command params:

Valid inputs

The following input formats are currently supported:

Troubleshooting

Out of memory errors

Some files are big enough that Node will run out of memory. You can try disabling various features that might be memory intensive. For example, try the -e, --noEslint, --noPrettier, --unpackOnly flags.

Another option is to give Node more memory. Here is an example command (run this instead of npm start): node -r ts-node/register --max-old-space-size=<MEMORY IN MB> ./src/main.ts <ARGUMENTS>.

Extending

The decompiler operates on a tagger -> editor -> decompiler system.

To add a new plugin, add it into the represpective list.

The plugins are initialized per module, so any data you store in your plugins will only persist for the current module.

If your plugin needs to be run before or after other plugins, adjust the ordering in the list, or modify it's pass position.

Guidelines: