-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make tsc runnable on Nashorn #1789
Comments
👍 |
Looks like someone's done the basic work here: https://github.com/coudy/typescript . We can discuss whether or not taking a PR on this would be appropriate. |
First, before anyone tries to work with that directly, that Nashorn system implementation is for the old compiler. Still should be easy enough to rewrite. Second, note the following from the somewhat recent Nashorn announcement:
Not that this should dissuade contributions, but something we should consider discussing further. |
My suspicion is that even when TS code is directly runnable on Nashorn that we would still need a Nashorn-specific IO module for tsc, so that tsc itself is also runnable. |
@markelliot I suspect you will inevitably need node for some other project that does something useful with your JavaScript/CSS |
Or a Node-compatible interface exposed from Java. |
The linked blog post mentions: |
I was able to run tsc on Avatar.js without much trouble, though I have not tested it thoroughly. You might be interested in a proof-of-concept Maven plugin that I put together this week: Maven TypeScript Compiler Plugin |
thanks @wmono for sharing. You mention in your description you mention
Actually tsc on node supports --watch mode that allows for that. just wanted to make sure you know about it. |
Thanks @mhegazy I've added a tsc:watch goal to run with that option and it does seem to work on Avatar.js. |
That would enable Typescript Gradle Plugin to run the compiler without having nodejs installed on the system. |
👍 I also need to use Nashorn instead of Node to run TypeScript, in Gradle as well. Does the situation has changed since the Nashorn announcement? |
@basarat not necessarily - alot of people (especially on the enterprise) are using JS for their frontend stuff only. Yet we'd like to use Typescript in our stack - which in turn requires the compiler to be a bit more agnostic about the environment in which he runs. |
This would be great to see! It would be nice to get contacts at Oracle to see if they still plan on open sourcing their Nashorn TypeScript. Otherwise, Apigee's rowboat project is set to use Nashorn instead of Rhino for the JavaScript Engine like trireme does. It may be worth trying out. |
Just for your information, I have implemented ternjs server to consume it in Java context with tern.java with several JavaScript engine (node.js, J2V8, Nashorm and Rhino) and the performance is not very good with Nashorn (I have not benchamrk, but when I consume ternjs with Nashorm (like open completion with a lot of JS files), Eclipse freezes a little although with node.js it is very fast) In other words with ternjs, for performance I have : node.js > J2V8 > Nashorm > Rhino. |
Thanks @angelozerr! Looking at the J2V8 docs, it looks similar to Edge.js, but for Java instead of .NET. I think that will work. |
I usually run TypeScript compiler using But I also wanted to allow users to customize my Java application using TypeScript expressions, snippets, plugins... For this feature I need to run TypeScript compiler inside Java VM so I created PR. With this PR it should be possible to implement for Java something like typescript-simple. |
@vojtechhabarta for embedded scripting can you just load |
@vladima I was thinking that TypeScript services also need
Thanks |
Given the perf characteristics of running the compiler on nashorn (see more in #8565 (comment)), and the support requirements on the core ts team, we will have to decline this request in the time being. we can revisit this in the future if any of these assumptions change. |
The purpose of this project is not just to Make tsc runnable on Nashorn. Just wanna make JDK and Maven libraries actually programmable in TypeScript (without quirky hacking). |
Would be useful to be able to use gradle+jvm to run tsc directly to reduce complexity in our build system (today we use gradle to run node to run grunt to run tsc).
Some recent improvements in the JDK suggest this is likely now a fast enough environment (1). Others have tried in the past, so it is definitely possible (2,3).
The text was updated successfully, but these errors were encountered: