richardfuca / react-native-decompiler

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

Cannot read property '<X>' of undefined #243

Open ronytesler opened 2 years ago

ronytesler commented 2 years ago

I ran: ts-node ./src/main.ts -i c:\test\smali\assets\index.android.bundle -o ./output got errors like: Reading file... Parsing JS... Finding modules... Took 103757.12750002742ms Pre-parsing modules... ████████████████████████████████████████ 100% | ETA: 0s | 6279/6279 Took 30503.019600003958ms Tagging... ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 0% | ETA: 12889s | 1/6279 Took 2057.680599987507ms Filtering out modules only depended on ignored modules... 5784 remain to be decompiled Took 37001.79580000043ms Decompiling... ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 0% | ETA: 0s | 0/5784An error occured parsing module 132, it will be outputted as is! TypeError: Cannot read property 'scope' of undefined at DefaultInteropEvaluator.bindingTraverse (C:\react-native-decompiler\src\plugin.ts:144:13) at VariableDeclarator (C:\react-native-decompiler\src\decompilers\evaluators\defaultInteropEvaluator.ts:38:16) at C:\react-native-decompiler\src\router.ts:148:29 at Array.forEach () at C:\react-native-decompiler\src\router.ts:148:13 at NodePath._call (C:\react-native-decompiler\node_modules\@babel\traverse\lib\path\context.js:55:20) at NodePath.call (C:\react-native-decompiler\node_modules\@babel\traverse\lib\path\context.js:42:17) at NodePath.visit (C:\react-native-decompiler\node_modules\@babel\traverse\lib\path\context.js:92:31) at TraversalContext.visitQueue (C:\react-native-decompiler\node_modules\@babel\traverse\lib\context.js:115:16) at TraversalContext.visitMultiple (C:\react-native-decompiler\node_modules\@babel\traverse\lib\context.js:79:17)

ronytesler commented 2 years ago

Also this: TypeError: Property expression of JSXExpressionContainer expected node to be of a type ["Expression","JSXEmptyExpression"] but instead got "JSXExpressionContainer"

giuliohome commented 2 years ago

Also this: TypeError: Property expression of JSXExpressionContainer expected node to be of a type ["Expression","JSXEmptyExpression"] but instead got "JSXExpressionContainer"

Same issue here: any update or comment about it?

This seems related, but I'm not sure what changes have to be done here in this repo or what kind of workaround could alleviate the issue.

Thanks

giuliohome commented 2 years ago

Aside from a spread object or similar things (see the pull request related to the issue linked in my above comment in babel-plugin-styled-components), another doubt I have is that a JSXExpressionContainer wrapped inside itself could be a misinterpratation of a string interpolation, e.g. in a translation i18next resource like in the example linked here, that I also report below:

export const TRANSLATIONS_EN = {
 welcome:"Welcome to the tutorial",
 date_format_one: "{{-date, YYYY/MM/DD}}",
 date_format_two: "{{date, DD-MM-YYYY}}",
};