4 ms·
I don't know if you could hide it from competition - it can be unminified ex with: http://jsbeautifier.org/ http://jsbeautifier.org/ I have tried this before an
by qCOVET 11y ago
I don't know if you could hide it from competition - it can be unminified ex with: http://jsbeautifier.org/ http://jsbeautifier.org/ I have tried this before and it worked.
- emidln 11y agoGoogle Chrome also does this out of the box (and has for awhile).
- leeoniya 11y agoit depends on how you minify. if you use Closure Compiler in Advanced mode it will rename and rescope pretty much everything except native methods and strings (making lots of globals cause it assumes you're compiling all page's code at once), it will eliminate unused code even from third party libs like jquery and do all sorts of stuff that make the beautified code very expensive to understand, follow and reverse and even then you may end up with only half a library that does only one specific task and the rest of the code would be missing. you have to do a bit of JSDoc annotations in some places to fix some breakages and restructure the code a tiny bit to get it to rename absolutely everything but the results are excellent.
- kuschku 11y agoSo, run http://www.jsnice.org/ http://www.jsnice.org/ over it?
- leeoniya 11y agotried it out and got an error saying it doesnt support ES5 getters/setters unless i change the language_in option. is there a way to do this? even so, there's nothing it can do to bring back eliminated code, meaningfully extract inlined functions and scope everything appropriately to help a reverser understand context. it would still take an immense amount of effort only to get back something very specific. the only thing you can probably get out of it is some largely mathematical chunks that cannot be restructured much, eg: rgbToHsv.
- tomjen3 11y agoYou can also just click the {} icon in Chromes debugger. All you will get is a lot of function a with arguments z d and f calling eq on z and passing it d, then returning the qln value of the result. Slightly more readable, yes, but still like debugging assembler.
- deleted 11y ago[deleted]
- kuschku 11y agoIt actually provides meaningful names, here is more about it: https://news.ycombinator.com/item?id=7836092 https://news.ycombinator.com/item?id=7836092
- weinzierl 11y ago> it will eliminate unused code even from third party libs like jquery and do all sorts of stuff that make the beautified code very expensive to understand To have that sort of optimisation you'll have to run the Closure compiler with ADVANCED_OPTIMIZATIONS enabled. Last time I checked that mode of compilation didn't work with JQuery and not with most other libraries. To use it with your own code you'll have to follow certain rules. I think most people just use uglify or the Closure compiler in SIMPLE_OPTIMIZATIONS, neither of which does the very advanced stuff of ADVANCED_OPTIMIZATIONS.
- arihant 11y agoTools like this become increasingly useless as your codebase gets larger. For example, unminify React and try mapping functions to unminified code. There is a lot to minification, these tools just undo cosmetic minification.
- kuschku 11y agohttp://www.jsnice.org/ http://www.jsnice.org/ can do that – giving everything meaningful names, checking types, etc.
- bpicolo 11y agoIt can't give "meaningful names" without real context, which it doesn't have. Slightly longer names that are easier to read? Sure.
- kuschku 11y agoYes, it can: https://news.ycombinator.com/item?id=7836092 https://news.ycombinator.com/item?id=7836092
- bpicolo 11y agoHere's part of google homepage js thrown at it (In reality tossed a whole file, but pastebin wont fit it all for free). It's still entirely unreadable. http://pastebin.com/VvEGZ8a3 http://pastebin.com/VvEGZ8a3 If it can infer most of it from OSS? Sure. But big web apps do a lot more.