sorcery0.10.0 • Public • Published
Most compilers don't do that. (UglifyJS is an honourable exception.) So when you fire up devtools, instead of looking at the original source you find yourself looking at the final intermediate step in the chain of transformations.
This is a work-in-progress - suitable for playing around with, but don't rely on it to debug air traffic control software or medical equipment. Other than that, it can't do much harm.
As a node module
Install sorcery locally:
npm install sorcery
var sorcery = ;sorcery;// You can also use sorcery synchronously:var chain = sorcery;var map = chain;var loc = chain;chain;
You can pass an optional second argument to
sorcery.loadSync(), with zero or more of the following properties:
content- a map of
filenamewill be resolved against the current working directory if needs be
sourcemaps- a map of
filename: sourcemappairs, where
filenameis the name of the file the sourcemap is related to. This will override any
sourceMappingURLcomments in the file itself.
Any files not found will be read from the filesystem as normal.
On the command line
First, install sorcery globally:
npm install -g sorcery
Usage: sorcery [options] Options: -h, --help Show help message -v, --version Show version -i, --input <file> Input file -o, --output <file> Output file (if absent, will overwrite input) -d, --datauri Append map as a data URI, rather than separate file -x, --excludeContent Don't populate the sourcesContent array
# overwrite sourcemap in place (will write map to# some/generated/code.min.js.map, and update# sourceMappingURL comment if necessarysorcery -i some/generated/code.min.js# append flattened sourcemap as an inline data URI# (will delete existing .map file, if applicable)sorcery -d -i some/generated/code.min.js# write to a new file (will create newfile.js and# newfile.js.map)sorcery -i some/generated/code.min.js -o newfile.js