1.0.0 • Published 5 years ago
@tessin/closure-compiler v1.0.0
Google Closure Compiler
This package uses the Google Closure Compiler (written in Java) to launch the compiler in a hosting process. So that the compiler can be asked to compile individual files in parallel without having to restart the Java Runtime in between.
https://github.com/google/closure-compiler/wiki/FAQ
Usage
import { ClosureCompilerHost } from "@tessin/closure-compiler"
async function main() {
const jscomp = new ClosureCompilerHost()
try {
// you can call "compile" as many times as you like and in parallel
const result = await jscomp.compile(JSON.stringify("use strict"), {
language_out: "ECMASCRIPT_2017"
})
ok(result.success)
console.log(result.output)
} finally {
// when you are done with the compiler it is important to call ".end" to shutdown the compiler process
jscomp.end()
}
}
1.0.0
5 years ago