sourcemapper
sourcemapper copied to clipboard
Support for data URI source map
Sometime the source map is self contained:
...
}();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ...
It would be nice if sourcemapper would handle such case automatically.
A workaround currently is:
cat base64.txt | base64 -d > map.json
python3 -m http.server 1337
sourcemapper -url http://localhost:1337/map.json -output main
Caaaaaaaaan do. Do you have an example JS file with a self-contained source map that you can provide?
@Techbrunch Sorry I don't have an example this was done during a client engagment.
All good, I can try dig up an example. This got me thinking that maybe a better upgrade for sourcemapper would be if you feed it JS URIs directly, it figures out whether there is a sourcemap URI comment and handles it automatically :thinking:
Would make a using this a bit more methodical. Copy all the JS URI out of your intercept proxy, feed them into sourcemapper in a loop, get all-the-things.
Yeah that would be better I think
@Techbrunch thanks so much for your workaround, I'm currently on an engagement where it is needed. You just saved me a lot of time!
I just found this project after working on https://github.com/jonluca/source-map-cloner, something similar but in node. Theres a few examples in there that should help I believe
Otherwise should be easy to spin up a dummy webpack site and then iterate over all the source map output options here https://webpack.js.org/configuration/devtool/
I've made my own version as well: https://github.com/llllvvuu/dl-webapp-sources . It takes a list of .js or .js.map (can be URIs or local filepaths)
Readme now includes information for how to deal with the rfc2397 sourcemaps