Class NodeTypeScriptProcessor

java.lang.Object
ro.isdc.wro.extensions.processor.js.NodeTypeScriptProcessor
All Implemented Interfaces:
ResourcePostProcessor, ResourcePreProcessor, SupportAware

@SupportedResourceType(JS) public class NodeTypeScriptProcessor extends Object implements ResourcePreProcessor, ResourcePostProcessor, SupportAware

Important node: this processor is not cross platform and has some pre-requesites in order to work.

Installation instructions: Install the typescript node package module (Unix OS)

    npm install -g typescript
 
It is possible to test whether the tsc utility is available using isSupported()
Since:
1.5.0
Author:
Alex Objelean
  • Field Details

  • Constructor Details

    • NodeTypeScriptProcessor

      public NodeTypeScriptProcessor()
  • Method Details

    • process

      public void process(Resource resource, Reader reader, Writer writer) throws IOException
      Specified by:
      process in interface ResourcePreProcessor
      Throws:
      IOException
    • onException

      protected void onException(Exception e, String content)
      Invoked when a processing exception occurs. Default implementation wraps the original exception into WroRuntimeException.
      Parameters:
      e - the Exception thrown during processing
      content - the resource content being processed.
    • process

      public void process(Reader reader, Writer writer) throws IOException
      Specified by:
      process in interface ResourcePostProcessor
      Throws:
      IOException
    • isSupported

      public boolean isSupported()
      Specified by:
      isSupported in interface SupportAware
      Returns:
      true if the processor is supported on this environment. The implementation check if the required shell utility is available.
    • getCommandLine

      protected String[] getCommandLine(String filePath, String outFilePath)
      Creates the platform specific arguments to run the tsc shell utility. Default implementation handles windows and unix platforms.
      Returns:
      arguments for command line. The implementation will take care of OS differences.