monai / cc-web-runner

Closure Compiler web runner

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cc-web-runner

Closure Compiler web runner.

Download latest release.

Build

mvn compile package

Produces 2 artifacts:

  • WAR archive that can be deployed on servlet container
  • Standalone executable JAR archive

Run

java -jar target/cc-web-runner-standalone-1.0-SNAPSHOT.jar

Use

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"

Endpoints

Request and response content types are application/json.

GET /status

Returns Closure Compiler version.

Response:

  • compilerVersions String - Closure Compiler version

GET /options

Returns default options with given compilationLevelOptions.

Query parameters:

  • level String - is of type CompilationLevel, compilation level
  • debug Boolean - whether to call setDebugOptionsForCompilationLevel
  • typeBased Boolean - whether to call setTypeBasedOptimizationOptions
  • wrappedOutput Boolean - whether to call setWrappedOutputOptimizations

Response:

GET /externs

Returns default externs.

Response:

  • externs Array - is of type List<SourceFile>, an array of extern files

POST /compile

Request:

  • externs Array - [{ fileName: String, code: String }], array of extern files
  • sources Array - [{ fileName: String, code: String }], array of source files to compile
  • compilationLevelOptions
    • level String - is of type CompilationLevel, compilation level
    • debug Boolean - whether to call setDebugOptionsForCompilationLevel
    • typeBased Boolean - whether to call setTypeBasedOptimizationOptions
    • wrappedOutput Boolean - whether to call setWrappedOutputOptimizations
  • 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 results
  • source String - compiled source
  • status String - SUCCESS|ERROR
  • message String - error message if the status is 'ERROR'
  • exception Object - is of type Throwable, occurred exception

License

ISC

About

Closure Compiler web runner


Languages

Language:Java 100.0%