From 8e88af5f8c0874da0576bb32e23f25d5095be3c7 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:14:43 +0700 Subject: [PATCH] Set indent of built scripts to 1 space --- build.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.ts b/build.ts index 95fab32..37c0f5a 100644 --- a/build.ts +++ b/build.ts @@ -87,6 +87,15 @@ const postProcess = (str: string): string => { return p1.toUpperCase(); }); + // Replace " (e) =>" to " e =>" + // str = str.replaceAll(/ \(([^\s,.$()]+)\) =>/g, ' $1 =>'); + + // Set indent to 1 space + str = str.replaceAll(/\n(\s+)/g, (match, p1) => { + const len = p1.length / 2; + return '\n' + ' '.repeat(len); + }); + assert(str.includes('/* ADDITIONAL CODE */')); assert(str.includes('window.BX_EXPOSED = BxExposed')); assert(str.includes('window.BxEvent = BxEvent'));