Class JSXWithBabelTranspiler

java.lang.Object
org.nustaq.kontraktor.webapp.transpiler.JSXWithBabelTranspiler
All Implemented Interfaces:
TranspilerHook

public class JSXWithBabelTranspiler extends Object implements TranspilerHook
Created by ruedi on 30.06.17.
  • Constructor Details

    • JSXWithBabelTranspiler

      public JSXWithBabelTranspiler()
  • Method Details

    • opts

      public JSXWithBabelTranspiler opts(BabelOpts opts)
    • getOpts

      public BabelOpts getOpts()
    • transpile

      public byte[] transpile(File f) throws TranspileException
      Description copied from interface: TranspilerHook
      indicates a file is being accessed. in dev mode this is called always (so its up to the implementation to check for filedate/modification). In order to run an external transpiler, just run transpilation synchronous such that the given file is updated and return null. Alternatively an implementation might choose to just transpile dynamically and directly return byte[]. NOTE: transpilation is static. this means in production mode it will be called once on first resource access.
      Specified by:
      transpile in interface TranspilerHook
      Parameters:
      f - - the file being accessed (after resourcepath resolvment)
      Returns:
      either (transpiled) file content or null. Should throw an exception in case an error occured during transpile.
      Throws:
      TranspileException