Fix syntax errors in perfis-catalog.js for Vite compatibility

This commit is contained in:
Marcos
2026-03-22 20:33:09 -03:00
parent 44aa8a0a36
commit 0d4499f338
37 changed files with 1250 additions and 13116 deletions

22
unwrap_scripts.js Normal file
View File

@@ -0,0 +1,22 @@
const fs = require('fs');
const path = 'm:/OFICIAIS E FUNCIONANDO/STEELBASE/js/sections/perfis-catalog.js';
let c = fs.readFileSync(path, 'utf8');
// Unescape some mangled ones
c = c.replace(/\\`/g, '`');
// Match <script> tags inside functions and Extract them out of the return ` ... `
// but after the function.
// 1. Find 'return ` ... <script> ... </script> ... `;'
// 2. Replace with 'return ` ... ... `; <script logic> ...'
// But a simpler way: just REMOVE the <script> and </script> tags ONLY if they are inside return ` ... `;
// and keep the content.
c = c.replace(/return\s+`([\s\S]*?)<script>([\s\S]*?)<\/script>([\s\S]*?)`;/gs, (match, before, script, after) => {
return 'return `' + before + after + '`; \n\n' + script + '\n\n';
});
fs.writeFileSync(path, c);
console.log('Unwrapped scripts in perfis-catalog.js');