sourcemapper icon indicating copy to clipboard operation
sourcemapper copied to clipboard

Support for data URI source map

Open Techbrunch opened this issue 2 years ago • 5 comments

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

Techbrunch avatar Mar 29 '22 14:03 Techbrunch

Caaaaaaaaan do. Do you have an example JS file with a self-contained source map that you can provide?

denandz avatar May 09 '22 03:05 denandz

@Techbrunch Sorry I don't have an example this was done during a client engagment.

Techbrunch avatar May 09 '22 07:05 Techbrunch

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.

denandz avatar May 09 '22 22:05 denandz

Yeah that would be better I think

Techbrunch avatar May 10 '22 07:05 Techbrunch

@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!

kronicd avatar May 11 '22 01:05 kronicd

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/

jonluca avatar Jun 27 '23 00:06 jonluca

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)

llllvvuu avatar Sep 04 '23 13:09 llllvvuu

Readme now includes information for how to deal with the rfc2397 sourcemaps

denandz avatar Jan 03 '24 05:01 denandz