deno-musings/transpiler/index.html

27 lines
785 B
HTML
Raw Normal View History

2024-10-11 13:04:47 -04:00
<html>
<head></head>
<body style="display: flex; gap: 30px;">
<textarea id="input"></textarea>
<button style="align-self: center;" id="transpile"></button>
<textarea id="output"></textarea>
<script src="https://cdnjs.cloudflare.com/ajax/libs/typescript/4.5.4/typescript.min.js"></script>
<script type="module">
const domIn = document.getElementById("input");
const domOut = document.getElementById("output");
const domDo = document.getElementById("transpile");
domDo.addEventListener("click", ()=>{
const result = ts.transpileModule(domIn.value, {
compilerOptions: {
module: ts.ModuleKind.ESNext,
target: ts.ScriptTarget.ESNext
}
});
domOut.value = result.outputText
console.log(result);
})
</script>
</body>
</html>