The argument that the way this new runtime is constructed is very different from the existing nodejs one, seems a strong one in my opinion to consider a dedicated repo.
The unclear part to me is whether it would make sense to consider applying the “action loop” pattern to the existing NodeJs Runtime. Are there any thoughts on this ? On Wed, Jan 8, 2020 at 12:43 PM Michele Sciabarra <mich...@sciabarra.com> wrote: > Hello, > I developed a new openwhisk runtime with native support for typescript as > part of my work at Nimbella and I intend to donate this code the Apache > Openwhisk project. The new runtime works for node/javascript as well. Since > typescript is compiled, I reused the compilation support from the "action > loop" proxy. This runtime is intended as a new action kind, which can > support both node and typescript. > This email is to solicit feedback for the next 48 hrs on the question of > new repo vs reuse the existing repo for node.js. I will decide based on > community feedback and follow up with the next steps. > Features of the new runtime: > - supports precompilation, meaning you use the runtime as a compiler to > "precompile" the sources. Compilation here means translating typescript to > javascript, resolve the package.json downloading all the node_modules and > producing a zip that includes everything ready to run. > You do this with a command like: > > docker run openwhisk/action-typescript-v3.7 <src.zip >bin.zip > > then you can create the action using bin.zip. > - supports on the fly compilation, so that an action made up of typescript > sources will also work. > - supports debugging, but in a different way than adobe/wskdebug. If you > set an environment variable __OW_DEBUG_PORT it will start the runtime > listening on a port for a debugger to attach. > > - an action must always "export" the main function. So in typescript you > need to do: `export function main(args) { .. }' and in javascript > `export.main = function args(...)`. I did manage to make sure a single file > with 'function main(args)' works but it does not work when there are > multiple files zipped. I think the current apache openwhisk nodejs runtime > uses eval, I use a `require` to import action code. > > Since this is a new language runtime (typescript) and also differs in the > node.js support from the existing apache openwhisk nodejs runtime, I am > proposing a new apache repo to host this code. It's possible to include the > new sources in the existing node.js runtime repo to avoid adding yet > another repository, but may be confusing since the code base is very > different. > > -- > Michele Sciabarra > mich...@sciabarra.com >