Instead of updating the current JScript with is installed on Windows by default, the folks at Microsoft
have instead developed TypeScript which is a superset of JavaScript with support of the latest ECMAScript standards (ES 2015-2017) and optional static typing. Therefore, all existing JavaScript code should work in TypeScript (in theory) whose compiler can be configured to trans-compile to ES 5, 6…you name it. One idea, is that the Run Script plugin could support TypeScript but we would have to install TypeScript via NPM (given the Workflow installs NodeJS anyway) on Windows just like we currently install Perl or Python manually.
If this is too much to ask, could the Workflow or the Run Script gives instead the user the ability to select a different JavaScript engine (NodeJS, TypeScript,…etc) and configure the options for that engine in the Workflow preferences?
We are actively working on this. I can’t yet share the details of the implementation, but we are hoping to have something new for the Fall version of Connect.
We weren’t able to implement a fully ECMASCRIPT 2016-compliant JS engine in time for the Fall version, but we did implement a huge series of Polyfills inside our current engine that will allow you to use most of the standard ECMASCRIPT-2016 methods and objects (trim(), btoa(), array.filter(), maps, sets, etc). This should make developing scripts much less painful. Some syntactic elements are still missing because they can’t be polyfilled (const, let, async, class, etc.) but it’s still a huge improvement.
We are now planning to implement the new scripting engine for version 2020.1. This time, the feature should make it because we’ve already done most of the work for it (we just ran out of time to implement it fully).
Great work Phil. We really appreciate the efforts you put into developing the products to make it relevant and compatible with new standards. A modern JavaScript engine is long overdue. The new improvements are certainly welcome though.
I was talking to your support team the other day and one of the question I asked was the possibility to interface the Run Script plugin with NodeJS that is installed by default with Workflow so it is used as the JavaScript engine.
I don’t know if it is at all feasible but if it is, you wouldn’t have to develop new polyfills; although perhaps would still need to develop a new Watch API for the new engine. Just a thought!
What’s the state of the art on the subject? Is there any “Connect” way to run a script with the built-in node engine? Or do we need to rely on “Run external program” pointing to the node executable?
No there isn’t. You need to run an external program, but even then, you won’t have access to the native objects that are available inside Workflow’s scripting engine.