Request: Provide an Explicit Public API for NodeJS Module / Compilation Access

Topics: General, Language Specification
Oct 5, 2012 at 5:09 PM

After a recent post on StackOverflow, I thought I would repost here as I believe this is more of a feature request than a question about how to access a feature.  Please see this thread for the responses and work-arounds ( or review the below or the original question reproduced in its entirety:  

From within a node app I would like to do:

var typeScript = require('typescript'); 


I'm looking to implement the compiler into a build system but without access to a public API (typescript.compile, etc) this is impossible, or hacky.

Here's a more complete example of what I would like to do, though the below is for LiveScript, not TypeScript, utilitized in a plugin written for the build-system:

LiveScript = require 'LiveScript'
sysPath = require 'path'

module.exports = class LiveScriptCompiler
  brunchPlugin: yes
  type: 'javascript'
  extension: 'ls'

  constructor: (@config) ->

  compile: (data, path, callback) ->
      result = LiveScript.compile data, bare: yes
    catch err
      error = err
      callback error, result

  include: [
    (sysPath.join __dirname, '..', 'vendor', 'prelude-browser-0.6.0.js')


I believe something like this is very important for growing the language and its integration outside of the Visual Studio environment.  Thoughts?

Oct 5, 2012 at 6:19 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.