mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Convert map files via JSON.parse instead of using string manipulation in minify.js.
Former-commit-id: 185b77d45995f17c586f35d6ad447074d677a6ae
This commit is contained in:
@@ -369,13 +369,12 @@
|
|||||||
if (isMapped) {
|
if (isMapped) {
|
||||||
var mapOutput = fs.readFileSync(mapPath, 'utf8');
|
var mapOutput = fs.readFileSync(mapPath, 'utf8');
|
||||||
fs.unlinkSync(mapPath);
|
fs.unlinkSync(mapPath);
|
||||||
|
output = output.replace(/[\s;]*$/, '\n/*\n//@ sourceMappingURL=' + path.basename(mapPath)) + '\n*/';
|
||||||
|
|
||||||
output = output
|
mapOutput = JSON.parse(mapOutput);
|
||||||
.replace(/[\s;]*$/, '\n/*\n//@ sourceMappingURL=' + path.basename(mapPath)) + '\n*/';
|
mapOutput.file = path.basename(outputPath);
|
||||||
|
mapOutput.sources = [path.basename(filePath)];
|
||||||
mapOutput = mapOutput
|
mapOutput = JSON.stringify(mapOutput, null, 2);
|
||||||
.replace(/("file":)""/, '$1"' + path.basename(outputPath) + '"')
|
|
||||||
.replace(/("sources":)\["stdin"\]/, '$1["' + path.basename(filePath) + '"]');
|
|
||||||
}
|
}
|
||||||
callback(exception, output, mapOutput);
|
callback(exception, output, mapOutput);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user