I am working on a project where I have to statically analyse JavaScript code. However, for a few libraries, I only have access to a minified version of the file and the corresponding source-map. Is there a method/technique with which I can generate the original file using these files?
Asked
Active
Viewed 6,890 times
13
-
1Why can't you statically analyze them in their minified state? – WiredPrairie Nov 22 '13 at 21:58
-
I can analyse the code. But I need to retrieve the names of the properties of a few objects. – Sid Nov 22 '13 at 22:03
-
minifiers generally don't mess with property names of objects unless they're extremely aggressive as it's difficult to analyze how they're being used. – WiredPrairie Nov 22 '13 at 22:07
3 Answers
10
I found a node.js library that can help do this: Maximize Corresponding github repo

Sid
- 331
- 3
- 10
-
-
It works well. Although, it expects the input as a URL. You would have to make changes to input a file. – Sid Dec 05 '13 at 00:49
-
4I **don't know Node JS** but I rewrote Maximize to work with local files (and actually work at all). Maybe someone who knows node-js would like to make this not horrible: https://github.com/timmc/unsourcemap – Tim has moved to Codidact Jan 21 '17 at 06:53
1
This command line tool is really easy to use
npx uglify-js ugly.js -b --source-map "filename='ugly.js.map'" -o beauty.js

James Baird
- 97
- 1
- 9