Comments (11)
Any news on this, or pointers to get me started on a PR? (:
from browserify-deoptimizer.
No news really... a PR would be amazing. @thlorenz has some ideas, I know, but I forgot most of them.
The new browserify v2 flow is pretty amenable to this sort of thing, I think, although I'm not 100% sure it exposes the right hooks...
from browserify-deoptimizer.
Technically you could pull the entire source of the bundle along with paths from the source maps. mold-source-map and/or convert-source-map would help you with that.
Then add routes for each to a server and add script tags that pull'em in.
Of course this only works with the --debug
option.
The other thing that may help is that browserify now has an option to list all files (last advanced option) that are being bundled.
from browserify-deoptimizer.
Awesome info @thlorenz! That helps a lot. I'll see what I can do. Thanks!
from browserify-deoptimizer.
There's also this b.on('file', ...)
thing, I've never used it but it seems possibly relevant.
@thlorenz any ideas on where in the process we can hook in? It sounds like source map work would be done after the conversion to a string; is there anywhere earlier in the process that you think would work well? (But the source map idea is pretty compelling I think, since it means the source map-creator has already done most of the work for us.)
from browserify-deoptimizer.
I've been working on this. So far the most reliable option has been through the source map, but I'll try the new advanced option too.
The file and package events won't fire for browserify's special shims, so you get an incomplete tree of files doing that.
from browserify-deoptimizer.
b.on('file'...
may work, but I'm not sure how well it plays with transforms, since you'd need to run them manually if you use the original file content. This btw would also be the case with the 'list all files' approach.
The source map approach may be simpler here since the source map will point you to the exact lines in the bundle to find the source code after all the modifications, including transforms.
from browserify-deoptimizer.
Of course the next problem is what the output format should be, given browserify v2's new super-compact thing.
Honestly at this point the best idea I have is a bunch of amd modules, plus a massive require.config
that uses the browserify data to create per-file mappings. Combine this with almond or something and you'd be good to go.
Hopefully someone has a better idea :P
from browserify-deoptimizer.
Just a small progress update, i've managed to reliably extract a dependency map (correctly, with transforms that add require
) from browserify thanks to @thlorenz's info on the advanced option.
from browserify-deoptimizer.
This is awesome, I'm really excited :D.
from browserify-deoptimizer.
Another possibility:
- Use
browserify --list
to get a list of all files - Create a separate bundle for each file
- For each bundle, use browserify's
external()
option to exclude all other files
This approach has the potential to be faster than using source maps. When used in conjunction with watchify, only the affected single-file bundle would need to be updated when a source file is changed.
Thoughts?
from browserify-deoptimizer.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from browserify-deoptimizer.