import re import subprocess from pathlib import Path html = Path("static_space/index.html").read_text(encoding="utf-8") scripts = re.findall(r"", html, re.DOTALL) for i, s in enumerate(scripts): Path(f"/tmp/check_{i}.js").write_text(s, encoding="utf-8") res = subprocess.run(["node", "--check", f"/tmp/check_{i}.js"], capture_output=True, text=True) if res.returncode == 0: print("Syntax check passed!") else: print("Syntax check failed:", res.stderr)