I am trying to run the TypeScript compiler from my Java application. To start, I am trying to figure out, whether I can run the compiler from command-line without Node.js:
$ jsc tsc.js
But this way I don't get any errors, nor help.
$ jsc tsc.js myscript.ts
Will get me nowhere.
It is easy to run js code directly from java (and I am hoping to run the compiler in this way), but is it possible to run TypeScript compiler without node.js?
EDIT:
I confirm the same behaviour with rhino.
I have a project, Typescript4j that does precisely this.
It runs the Typescript compiler wrapped within Rhino.
I'm using it successfully within Bakehouse, and a non-trivial Typescript application.
Looking at the source code, the tsc command invokes a JS script tsc.js, which has 2 backends: Node.js and Windows Scripting Host. If any other JavaScript server supports reading and writing to a file system (like Rhino with RingoJS), it should be able to run the TypeScript compiler tsc.js.
Moreover, there is a fork of TypeScript compiler which claims to directly run on Rhino. So you could invoke Rhino directly from Java, without installing node.js.
The TypeScript compiler is implemented in TypeScript, and can be used in any JavaScript host.
You may need to specify the full path to tsc.js