beautifier / js-beautify

Beautifier for javascript
https://beautifier.io
MIT License
8.64k stars 1.39k forks source link

debundle webpack & browserify to files #1196

Open jimmywarting opened 7 years ago

jimmywarting commented 7 years ago

Now that everyone is using some sort of bundler i think it would be useful to debundle them to separate files

we can see the filename in the source... foo=require("./initializer")

bitwiseman commented 7 years ago

@jimmywarting - Please be more specific about what you want to be able to do. Are you looking at the master branch? It's not released yet, but I think I've already started doing what you're suggesting.

jimmywarting commented 7 years ago

I found this useful tool browser-unpack This is kind of what i wanted but for it to also save all sources to files instead of dumping it to stdout

so i found this: browserify-unpack

Theres readme explains pretty much what i want


It wasn't the best output since all files then had t.export instead of module.export But it didn't mather since i was not going to recompile it, just snoop around someone's else code

bitwiseman commented 7 years ago

I still don't understand what you want, sorry.
In 1.6.14, webpack was not used, so it can't be unbundled. 1.7.0 will be the first version to use webpack. When 1.7.0 is released, it will have the bundled files and the unbundled files in the npm package.

jimmywarting commented 7 years ago

not talking about your project. I wanted to take this js file run it thought jsbeautifier browserify-unpack and Tada:

skarmavbild 2017-05-23 kl 21 39 16

From having just one bundle-minifed js file i was able to export all the dependencies in a nice file tree hierarchy If you could do something similar on your website with a nice gui then that would be awesome! a way to debundle someones else's bundle and download all files as a archive

Bowserify unpack cuts a browserify bundle into multiple files and writes them to an output directory in their original, pre-bundled, structure

bitwiseman commented 7 years ago

Oh! What you want is for the beautifier to include an option to unbundle a single input file into multiple files via the tool and or website.

jimmywarting commented 7 years ago

Yes, if it was on the website then that would be enough :)

jimmywarting commented 7 years ago

ofc if a sourcemap is found or could be entered manually then that would be more awesome Taken angular for example

The last line is //# sourceMappingURL=angular.min.js.map it can be absolute path or inlined base64 i found this tool that revers them: https://github.com/paazmaya/shuji

weituotian commented 6 years ago

@bitwiseman Hope it can be achieved