Skip to content

Commit 77c7b94

Browse files
committed
chore: release 0.2.4
1 parent 524f128 commit 77c7b94

9 files changed

Lines changed: 25 additions & 13 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-decompiler",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "react native decompile apk and ipa(soon)",
55
"main": "./out/index.js",
66
"author": "richardfuca",
@@ -50,7 +50,7 @@
5050
"eslint-plugin-react-hooks": "4.2.0",
5151
"jest": "26.6.3",
5252
"patch-package": "^6.4.7",
53-
"ts-node": "10.4.0",
53+
"ts-node": "10.9.1",
5454
"typescript": "4.1.3"
5555
},
5656
"bugs": {

src/decompilers/cleaners/cleanReturns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default class CleanReturns extends Plugin {
3030
path.insertBefore(path.node.argument);
3131
path.get('argument').replaceWith(path.node.argument.left);
3232
}
33-
}
33+
},
3434
};
3535
}
3636
}

src/editors/converters/babelInlineConverters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default class BabelInlineConverters extends Plugin {
9494
this.debugLog('removed inline babel interopRequireDefault inline:');
9595
this.debugLog(this.debugPathToCode(path));
9696

97-
this.mergeBindings(path as any, node.id.name, moduleSourcePath.node.id.name);
97+
this.mergeBindings(path, node.id.name, moduleSourcePath.node.id.name);
9898

9999
path.scope.bindings[test.left.left.name].path.remove();
100100
}

src/fileParsers/reactNativeFolderParser.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ export default class ReactNativeFolderParser extends PerformanceTracker implemen
3838
try {
3939
const fileNames = await fs.readdir(args.in);
4040

41-
return fileNames.some((fileName) => fs.readFileSync(path.join(args.in, fileName), 'utf8').includes('__d(function(g,r,i,a,m,e,d)'));
41+
return fileNames.some((fileName) => {
42+
const file = fs.readFileSync(path.join(args.in, fileName), 'utf8');
43+
return /__d\(function\([a-z],[a-z],[a-z],[a-z],[a-z],[a-z],[a-z]\)/.test(file)
44+
|| /__d\(function\([a-z],[a-z],[a-z],[a-z],[a-z],[a-z]\)/.test(file)
45+
|| /__d\(function\([a-z],[a-z],[a-z],[a-z],[a-z]\)/.test(file);
46+
});
4247
} catch (e) {
4348
return false;
4449
}

src/fileParsers/reactNativeSingleParser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export default class ReactNativeSingleParser extends PerformanceTracker implemen
3535
try {
3636
const file = await fs.readFile(args.in, 'utf8');
3737

38-
return file.includes('__d(function(g,r,i,a,m,e,d)');
38+
return /__d\(function\([a-z],[a-z],[a-z],[a-z],[a-z],[a-z],[a-z]\)/.test(file)
39+
|| /__d\(function\([a-z],[a-z],[a-z],[a-z],[a-z],[a-z]\)/.test(file)
40+
|| /__d\(function\([a-z],[a-z],[a-z],[a-z],[a-z]\)/.test(file);
3941
} catch (e) {
4042
return false;
4143
}

src/main.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ async function start() {
9292

9393
fsExtra.ensureDirSync(argValues.out);
9494

95+
if (!fsExtra.existsSync(argValues.in)) {
96+
console.error(`${chalk.red('[!]')} "${argValues.in}" does not exist!"`);
97+
process.exit(1);
98+
}
99+
95100
console.log('Reading file...');
96101

97102
const fileParserRouter = new FileParserRouter();
@@ -101,8 +106,9 @@ async function start() {
101106
console.error(`${chalk.red('[!]')} No modules were found!`);
102107
console.error(`${chalk.red('[!]')} Possible reasons:`);
103108
console.error(`${chalk.red('[!]')} - The React Native app is unbundled. If it is, export the "js-modules" folder from the app and provide it as the --js-modules argument`);
104-
console.error(`${chalk.red('[!]')} - The bundle is a binary/encrypted file (ex. Facebook, Instagram). These files are not supported`);
109+
console.error(`${chalk.red('[!]')} - The bundle is a Hermes/binary file (ex. Facebook, Instagram). These files are not supported`);
105110
console.error(`${chalk.red('[!]')} - The provided Webpack bundle input is not or does not contain the entrypoint bundle`);
111+
console.error(`${chalk.red('[!]')} - The provided Webpack bundle was built from V5, which is not supported`);
106112
console.error(`${chalk.red('[!]')} - The file provided is not a React Native or Webpack bundle.`);
107113
process.exit(1);
108114
}

src/plugin.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ export abstract class Plugin {
5555
return `react-native-decompiler:${this.name ?? 'plugin'}-${this.module.moduleId}`;
5656
}
5757

58-
protected debugLog(...args: unknown[]): void {
59-
if (args.length === 0) throw new Error('no args');
60-
debug(this.getDebugName())({ ...args });
58+
protected debugLog(formatter: unknown, ...args: unknown[]): void {
59+
debug(this.getDebugName())(formatter, ...args);
6160
}
6261

6362
/**
@@ -153,7 +152,7 @@ export abstract class Plugin {
153152
* @param from The name of the variable to be removed
154153
* @param to The name of the variable to merge into
155154
*/
156-
protected mergeBindings(path: NodePath, from: string, to: string): void {
155+
protected mergeBindings<T>(path: NodePath<T>, from: string, to: string): void {
157156
const oldBinding = path.scope.bindings[to];
158157
path.scope.rename(from, to);
159158
path.remove();

src/util/bindingArrayMap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default class BindingArrayMap<V> implements Map<Binding, V[]> {
6565
delete(_key: Binding): boolean {
6666
throw new Error('Method not implemented.');
6767
}
68-
forEach(_callbackfn: (value: V[], key: Binding, map: Map<Binding, V[]>) => void, _thisArg?: any): void {
68+
forEach(_callbackfn: (value: V[], key: Binding, map: Map<Binding, V[]>) => void, _thisArg?: unknown): void {
6969
throw new Error('Method not implemented.');
7070
}
7171
has(_key: Binding): boolean {

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
"**/*.js",
2727
"**/*.android.bundle"
2828
]
29-
}
29+
}

0 commit comments

Comments
 (0)