From a63c5d9653635aecb6b300b8ac5a8a7d12e31d9f Mon Sep 17 00:00:00 2001 From: ZXMushroom63 Date: Sun, 15 Jun 2025 17:23:13 +0800 Subject: [PATCH] fix babel tweaking out on 1.12 cli minification --- cli.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cli.js b/cli.js index c79fdcb..e60d1d3 100644 --- a/cli.js +++ b/cli.js @@ -33,7 +33,15 @@ async function main() { EFI.conf.doMinifyPlus = args.includes("/minify_extras"); EFI.conf.verbose = args.includes("/verbose"); const string = await fs.readFile(inputFile, {encoding: 'utf-8'}); - const res = await EFI.patchClient(string, new DOMParser()); + const bannedEscapeCodes = { //babel added support for every newline escape code in existence. browser javascript code can process these unescaped, but babel-cli can't + "\u2028": "\\u2028", + "\u0085": "\\u0085", + "\u2029": "\\u2029", + } + const res = await EFI.patchClient( + Object.entries(bannedEscapeCodes).reduce((acc, ent)=>acc.replaceAll(ent[0], ent[1]), string), + new DOMParser() + ); if (res) { var output = args[1]; if (!output || !output.endsWith(".html")) {