Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function addSourcemap(file, enc, callback) {
var srcMap = optResolver.resolve('sourcemaps', file);
if (!srcMap) {
return callback(null, file);
}
sourcemap.add(file, onAdd);
function onAdd(sourcemapErr, updatedFile) {
if (sourcemapErr) {
return callback(sourcemapErr);
}
callback(null, updatedFile);
}
}
function saveSourcemap(file, enc, callback) {
var self = this;
var srcMap = optResolver.resolve('sourcemaps', file);
if (!srcMap) {
return callback(null, file);
}
var srcMapLocation = (typeof srcMap === 'string' ? srcMap : undefined);
sourcemap.write(file, srcMapLocation, onWrite);
function onWrite(sourcemapErr, updatedFile, sourcemapFile) {
if (sourcemapErr) {
return callback(sourcemapErr);
}
self.push(updatedFile);
if (sourcemapFile) {
self.push(sourcemapFile);
}
callback();
}
}