Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function postProcess(config, diagnostics) {
let jsbuf = await file.read(config.outfile)
// find sourceMappingURL
let sourceMappingURLBuf = Buffer.from("//# sourceMappingURL")
let i = jsbuf.indexOf(sourceMappingURLBuf)
if (i == -1) { throw new Error("could not find '//# sourceMappingURL' in gotalk.js") }
// js without sourcemap url
let jsbuf1 = jsbuf.subarray(0, i)
// js with nodejs compat code added
let jsbuf2 = Buffer.concat([
jsbuf.subarray(0, i),
Buffer.from(`if(typeof module!="undefined")module.exports=gotalk;\n`),
jsbuf.subarray(i),
])