Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function processJS(file, data, callback) {
// Preemptively kill the sourcemap published entry
circus.published[file + '.map'] = undefined;
if (options.sourceMap !== false) {
SourceMapResolve.resolveSourceMap(data + '', Path.resolve(buildDir, file), Fs.readFile, function(err, sourceMap) {
if (err) {
return callback(err);
}
// Transform embedded urls using resolve
var ast = recast.parse(data, {sourceFileName: file});
recast.visit(ast, {
visitLiteral: function(path) {
// Replace literal file references
var value = path.value.value;
if (typeof value === 'string' && circus.published.hasOwnProperty(value)) {
path.value.value = circus.published[value];
}
return path.value;
}