Closure Compiler web runner.
Download latest release.
mvn compile package
Produces 2 artifacts:
- WAR archive that can be deployed on servlet container
- Standalone executable JAR archive
java -jar target/cc-web-runner-standalone-1.0-SNAPSHOT.jar
Request:
curl -X POST -H "Content-Type: application/json" -d '{
"compilationLevelOptions": {
"level": "SIMPLE_OPTIMIZATIONS"
},
"sources": [{
"fileName": "bar.js",
"code": "(console.log(function(){return 42-9;}));"
}]
}
' "http://localhost:8080/compile"
Request and response content types are application/json
.
Returns Closure Compiler version.
Response:
compilerVersions
String - Closure Compiler version
Returns default options with given compilationLevelOptions.
Query parameters:
level
String - is of type CompilationLevel, compilation leveldebug
Boolean - whether to callsetDebugOptionsForCompilationLevel
typeBased
Boolean - whether to callsetTypeBasedOptimizationOptions
wrappedOutput
Boolean - whether to callsetWrappedOutputOptimizations
Response:
options
Object - is of type CompilerOptions, compiler options
Returns default externs.
Response:
externs
Array - is of type List<SourceFile>, an array of extern files
Request:
externs
Array -[{ fileName: String, code: String }]
, array of extern filessources
Array -[{ fileName: String, code: String }]
, array of source files to compilecompilationLevelOptions
level
String - is of type CompilationLevel, compilation leveldebug
Boolean - whether to callsetDebugOptionsForCompilationLevel
typeBased
Boolean - whether to callsetTypeBasedOptimizationOptions
wrappedOutput
Boolean - whether to callsetWrappedOutputOptimizations
options
Object - is of type CompilerOptions, compiler options
Query parameters:
?debug
Boolean - whether to return error messages
Response:
result
Object - is of type Result, compilations resultssource
String - compiled sourcestatus
String - SUCCESS|ERRORmessage
String - error message if the status is 'ERROR'exception
Object - is of type Throwable, occurred exception
ISC