chore(scripts/build): actually put sourceURL correctly

This commit is contained in:
PalmDevs 2025-06-09 23:35:50 +07:00
parent 5987473580
commit ff3a19f25f
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -75,7 +75,6 @@ export default async function build(dev = false, log = true) {
}),
importGlobPlugin(),
swcPlugin(),
sourceURLPlugin(),
hermesCPlugin({
flags: [
dev ? '-Og' : '-O',
@ -110,7 +109,9 @@ export default async function build(dev = false, log = true) {
})
await bundle.write({
minify: {},
minify: {
mangle: true,
},
file: 'dist/revenge.js',
format: 'iife',
})
@ -123,18 +124,6 @@ export default async function build(dev = false, log = true) {
)
}
function sourceURLPlugin() {
return {
name: 'footer',
renderChunk(code) {
return {
code: `${code}\n//# sourceURL=Revenge`,
map: null,
}
},
} satisfies RolldownPlugin
}
function swcPlugin() {
return {
name: 'swc',
@ -214,6 +203,9 @@ function hermesCPlugin({
const file = bundle['revenge.js'] as OutputChunk
if (!file || !file.code) throw new Error('No code to compile')
// TODO(scripts/build): Remove this when we have a better way to add sourceURL
file.code += `//# sourceURL=Revenge`
const cmdlist = [
`./node_modules/@unbound-mod/hermesc/${process.platform}/${binPath}`,
'-emit-binary',