Feature request: Write output to stdout

Topics: General
Oct 3, 2012 at 7:33 PM

It would be nice to have an option which controls whether the output is written to a single file (which already exists) or to stdout stream.

Oct 3, 2012 at 7:35 PM

+1 , I actually assumed there must be a way to do this already that I'm just missing or so.

This helps when trying to call the compiler from another process, integrate it with some asset pipeline manager like ASP.NET bunlding or so.

Oct 4, 2012 at 6:19 AM

+1 - would be a great compiler feature.

I just checked - the IIO interface (in src/compiler/io.ts) supports streaming to stderr but not stdio.

Oct 4, 2012 at 4:40 PM
Edited Oct 4, 2012 at 4:40 PM
jasondenizac wrote:

+1 - would be a great compiler feature.

I just checked - the IIO interface (in src/compiler/io.ts) supports streaming to stderr but not stdio.

Have you looked at the two print() (one is for Windows and the other for native NodeJS) functions?
I've just done a quick research in the code. Here is my current and probably uncomplete list of things which have to be changed:

  • src/compiler/io.ts
    • Add 'stdout' as ITextWriter to the IIO interface. Line #24
    • Add 'stdout' property as 'WScript.StdOut' to the IO object for Windows. Line #203.
    • Add 'stdout' property to the IO object for native NodeJS:
       stdout: {
        Write: function(str) { process.stdout.write(str); },
        WriteLine: function(str) { process.stdout.write(str + '\n'); },
        Close: function() { }
      },
      
      Line #363
  • src/compiler/typescript.ts
    • This file have to be refactored so the containing functions do not assume the output to be a file.
      We probably need a more abstract interface for the output.
Coordinator
Oct 5, 2012 at 4:12 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.