Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let source = await fs.readFile(filename, 'utf8');
let sourceMap;
if (this.options.sourceMaps) {
sourceMap = await fs.readFile(filename + '.map', 'utf8');
sourceMap = JSON.parse(sourceMap);
sourceMap.sources = [this.relativeName];
sourceMap.sourcesContent = [this.contents];
// remove source map url
source = source.substring(0, source.lastIndexOf('//# sourceMappingURL'));
}
// delete temp directory
await fs.rimraf(dir);
return [
{
type: 'js',
value: source,
sourceMap,
},
];
}
}