Closure Compiler web runner.
Download latest release.
mvn compile packageProduces 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.jarRequest:
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:
compilerVersionsString - Closure Compiler version
Returns default options with given compilationLevelOptions.
Query parameters:
levelString - is of type CompilationLevel, compilation leveldebugBoolean - whether to callsetDebugOptionsForCompilationLeveltypeBasedBoolean - whether to callsetTypeBasedOptimizationOptionswrappedOutputBoolean - whether to callsetWrappedOutputOptimizations
Response:
optionsObject - is of type CompilerOptions, compiler options
Returns default externs.
Response:
externsArray - is of type List<SourceFile>, an array of extern files
Request:
externsArray -[{ fileName: String, code: String }], array of extern filessourcesArray -[{ fileName: String, code: String }], array of source files to compilecompilationLevelOptionslevelString - is of type CompilationLevel, compilation leveldebugBoolean - whether to callsetDebugOptionsForCompilationLeveltypeBasedBoolean - whether to callsetTypeBasedOptimizationOptionswrappedOutputBoolean - whether to callsetWrappedOutputOptimizations
optionsObject - is of type CompilerOptions, compiler options
Query parameters:
?debugBoolean - whether to return error messages
Response:
resultObject - is of type Result, compilations resultssourceString - compiled sourcestatusString - SUCCESS|ERRORmessageString - error message if the status is 'ERROR'exceptionObject - is of type Throwable, occurred exception
ISC