Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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),
])
// go source with embedded js
let goSource = `
package gotalk
const JSLibSHA1Base64 = "${sha1(jsbuf1, 'base64')}"
const JSLibString = ${bytesToGoString(jsbuf1)}
`.trim().replace(/\n +/g,"\n") + "\n"
await Promise.all([
file.write(config.outfile, jsbuf2),
file.write("../jslib.go", goSource, {log:true}),
])
}