mirror of
https://github.com/jehna/humanify.git
synced 2026-04-27 17:45:58 +03:00
[GH-ISSUE #22] Error with JSON Parsing and Undefined Property Access When Unminifying JavaScript with Humanify #20
Labels
No labels
bug
enhancement
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/humanify#20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @abdurrahim11 on GitHub (Jul 30, 2024).
Original GitHub issue: https://github.com/jehna/humanify/issues/22
I am facing problem while running one of my big script first everything is fine then after some time it gives below error
my minify js link: https://drive.google.com/file/d/1QHHRw_YKbYwgf7rbT8R8qP6Uh5BxNZ4l/view?usp=sharing
echo "OPENAI_TOKEN=sk-proj-MsUzhNo4jhbzk9zziiKET.............." > .env && npm start -- -o admin.js admin.min.js
export OPENAI_TOKEN="sk-proj-MsUzhNo4jhbzk9zziiKET.............." && npm start -- -o admin.js admin.min.js
OPENAI_TOKEN=sk-proj-MsUzhNo4jhbzk9zziiKET.............. npm start -- -o admin.js admin.min.js
npm start -- --key="sk-proj-MsUzhNo4jhbzk9zziiKET.............." -o admin.js admin.min.js
undefined:351
...
^
SyntaxError: Unexpected token '.', ..."E" },
...
]
}" is not valid JSON
at JSON.parse ()
at codeToVariableRenames (/home/abdurrahimcoder/humanify-main/src/openai/openai.ts:76:59)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at (/home/abdurrahimcoder/humanify-main/src/openai/openai.ts:21:23)
at async Promise.all (index 1)
at mapPromisesParallel (/home/abdurrahimcoder/humanify-main/src/openai/run-promises-in-parallel.ts:17:5)
at client.createChatCompletion.model (/home/abdurrahimcoder/humanify-main/src/openai/openai.ts:20:5)
at (/home/abdurrahimcoder/humanify-main/src/index.ts:68:25)
/home/abdurrahimcoder/humanify-main/src/openai/rename-variables-and-functions.ts:17
const rename = toRename.find((r) => r.name === path.node.name);
^
TypeError: unknown file: Cannot read properties of undefined (reading 'name')
at (/home/abdurrahimcoder/humanify-main/src/openai/rename-variables-and-functions.ts:17:49)
at Array.find ()
at PluginPass.Identifier (/home/abdurrahimcoder/humanify-main/src/openai/rename-variables-and-functions.ts:17:35)
at newFn (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/visitors.ts:292:14)
at _call (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/path/context.ts:35:20)
at call (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/path/context.ts:20:17)
at NodePath.visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/path/context.ts:94:31)
at visitQueue (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:144:16)
at visitMultiple (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:98:17)
at visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:174:19)
at traverseNode (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/traverse-node.ts:40:17)
at NodePath.visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/path/context.ts:101:33)
at visitQueue (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:144:16)
at visitSingle (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:108:19)
at visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:176:19)
at traverseNode (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/traverse-node.ts:40:17)
at NodePath.visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/path/context.ts:101:33)
at visitQueue (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:144:16)
at visitSingle (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:108:19)
at visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:176:19)
at traverseNode (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/traverse-node.ts:40:17)
at NodePath.visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/path/context.ts:101:33)
at visitQueue (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:144:16)
at visitSingle (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:108:19)
at visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:176:19)
at traverseNode (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/traverse-node.ts:40:17)
at NodePath.visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/path/context.ts:101:33)
at visitQueue (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:144:16)
at visitMultiple (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:98:17)
at visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:174:19)
at traverseNode (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/traverse-node.ts:40:17)
at NodePath.visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/path/context.ts:101:33)
at visitQueue (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:144:16)
at visitSingle (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:108:19)
at visit (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/context.ts:176:19)
at traverseNode (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/traverse-node.ts:40:17)
at traverse (/home/abdurrahimcoder/humanify-main/node_modules/@babel/traverse/src/index.ts:82:15)
at transformFile (/home/abdurrahimcoder/humanify-main/node_modules/@babel/core/src/transformation/index.ts:120:13)
at transformFile.next ()
at run (/home/abdurrahimcoder/humanify-main/node_modules/@babel/core/src/transformation/index.ts:47:12)
at run.next ()
at transform (/home/abdurrahimcoder/humanify-main/node_modules/@babel/core/src/transform.ts:29:20)
at transform.next ()
at step (/home/abdurrahimcoder/humanify-main/node_modules/gensync/index.js:261:32)
at /home/abdurrahimcoder/humanify-main/node_modules/gensync/index.js:273:13
at async.call.result.err.err (/home/abdurrahimcoder/humanify-main/node_modules/gensync/index.js:223:11)
at /home/abdurrahimcoder/humanify-main/node_modules/gensync/index.js:50:45
at step (/home/abdurrahimcoder/humanify-main/node_modules/gensync/index.js:287:14)
at /home/abdurrahimcoder/humanify-main/node_modules/gensync/index.js:273:13
at async.call.result.err.err (/home/abdurrahimcoder/humanify-main/node_modules/gensync/index.js:223:11) {
code: 'BABEL_TRANSFORM_ERROR'
}
@jehna commented on GitHub (Jul 30, 2024):
This is very probably the same issue as https://github.com/jehna/humanify/issues/12
@0xdevalias commented on GitHub (Aug 1, 2024):
Potentially related:
@jehna commented on GitHub (Aug 11, 2024):
This should now be fixed in v2 since there's the long awaited JSON mode with the new structured outputs. Please take a look and repoen if anything comes up
@tkreuder commented on GitHub (Sep 16, 2024):
@jehna Thanks a lot for providing that tool!!
I using humanify 2.1.2 but still face the issue.
code: 'BABEL_PARSE_ERROR',
reasonCode: 'UnexpectedToken',
loc: Position { line: 17261, column: 14, index: 542664 },
pos: 542664,
syntaxPlugin: undefined
@0xdevalias commented on GitHub (Sep 17, 2024):
@tkreuder I'm not 100%, but I believe this may be a separate issue to the above. It sounds like the error is happening during the babel parsing of the code, not the JSON parsing. To debug it further, I suspect the code you're trying to to unminify will be needed (or at the very least, tracking down what part of the code is being referenced there as being unexpected. Given it's happening in the babel area of things, there's also a chance that this may be a bug/unsupported edge case in webcrack (which this tool uses for unminification)