mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57: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) {
|
||||
var mapOutput = fs.readFileSync(mapPath, 'utf8');
|
||||
fs.unlinkSync(mapPath);
|
||||
output = output.replace(/[\s;]*$/, '\n/*\n//@ sourceMappingURL=' + path.basename(mapPath)) + '\n*/';
|
||||
|
||||
output = output
|
||||
.replace(/[\s;]*$/, '\n/*\n//@ sourceMappingURL=' + path.basename(mapPath)) + '\n*/';
|
||||
|
||||
mapOutput = mapOutput
|
||||
.replace(/("file":)""/, '$1"' + path.basename(outputPath) + '"')
|
||||
.replace(/("sources":)\["stdin"\]/, '$1["' + path.basename(filePath) + '"]');
|
||||
mapOutput = JSON.parse(mapOutput);
|
||||
mapOutput.file = path.basename(outputPath);
|
||||
mapOutput.sources = [path.basename(filePath)];
|
||||
mapOutput = JSON.stringify(mapOutput, null, 2);
|
||||
}
|
||||
callback(exception, output, mapOutput);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user