Allow inSourceMap to be a generated JSON source map instead of just a file name
This commit is contained in:
@@ -92,17 +92,18 @@ exports.minify = function(files, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4. output
|
// 4. output
|
||||||
var map = null;
|
var inMap = options.inSourceMap;
|
||||||
var inMap = null;
|
var output = {};
|
||||||
if (options.inSourceMap) {
|
if (typeof options.inSourceMap == "string") {
|
||||||
inMap = fs.readFileSync(options.inSourceMap, "utf8");
|
inMap = fs.readFileSync(options.inSourceMap, "utf8");
|
||||||
}
|
}
|
||||||
if (options.outSourceMap) map = UglifyJS.SourceMap({
|
if (options.outSourceMap) {
|
||||||
file: options.outSourceMap,
|
output.source_map = UglifyJS.SourceMap({
|
||||||
orig: inMap,
|
file: options.outSourceMap,
|
||||||
root: options.sourceRoot
|
orig: inMap,
|
||||||
});
|
root: options.sourceRoot
|
||||||
var output = { source_map: map };
|
});
|
||||||
|
}
|
||||||
if (options.output) {
|
if (options.output) {
|
||||||
UglifyJS.merge(output, options.output);
|
UglifyJS.merge(output, options.output);
|
||||||
}
|
}
|
||||||
@@ -110,7 +111,7 @@ exports.minify = function(files, options) {
|
|||||||
toplevel.print(stream);
|
toplevel.print(stream);
|
||||||
return {
|
return {
|
||||||
code : stream + "",
|
code : stream + "",
|
||||||
map : map + ""
|
map : output.source_map + ""
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user