2 ms·
Blog post on how it works: http://www.mattzeunert.com/2018/05/27/dynamic-dataflow-analysis-for-javascript-how-fromjs-2-works.html http://www.mattzeunert.com/201
by btown 8y ago
Blog post on how it works: http://www.mattzeunert.com/2018/05/27/dynamic-dataflow-analysis-for-javascript-how-fromjs-2-works.html http://www.mattzeunert.com/2018/05/27/dynamic-dataflow-analy...
This is really, really neat. Never would have thought that Babel could be used for instrumentation, though after a bit of digging it looks like https://istanbul.js.org/ https://istanbul.js.org/ uses a similar trick!
Is there a way to integrate this into a local dev environment without needing to run the MITM proxy? (For instance, if you know you're loading everything through a single bundle.) Could be a really popular dev tool if so.
Also, have you considered using IndexedDB to store the logs client-side, further removing the need for a backend? Storage should be practically unlimited if you have free drive space on desktop Chrome.
- mostlystatic 8y agoI've not considered using IndexedDB before! Loading a large app generates several GB of data, and extracting that data from the tab is actually a big performance issue. Instrumenting a single bundle is possible, but it's common to have some dependency on third-party JS or script tags in the page HTML. Chrome has an experimental request interception API for extensions that allows rewriting the response. I think that would be ideal UX-wise. I'm a bit wary though because that's how I started initially and I ran into a bunch of problems. One issue is running out of memory, the Babel compilation can often take several GB of RAM, and the default V8 memory limit in Chrome is too low.