From ff3a19f25f32e77e76b69320c19687a09c156b9c Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Mon, 9 Jun 2025 23:35:50 +0700 Subject: [PATCH] chore(scripts/build): actually put sourceURL correctly --- scripts/build.ts | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/scripts/build.ts b/scripts/build.ts index 44c4c26..212fcb5 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -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',