3a899b304e
We recently changed the Resource base type to have no constructor, rather than a manual empty constructor. This ought to work just fine. The LumiJS compiler indeed generates a constructor, however, it is missing a body and when the interpreter tries to invoke it, we crash with a nil reference panic. The runtime actually tolerates missing constructors entirely, although the way LumiJS binds super calls doesn't tolerate the missing base constructor. This change simply generates such constructors in LumiJS with empty bodies. In addition, I've added an error that will catch the empty body problem during binding, since technically speaking, all functions must have bodies. (Our runtime happens to support the notion of "abstract", however, so we only fire the error on concrete functions.) |
||
---|---|---|
.. | ||
cmd | ||
lib | ||
tests | ||
.gitignore | ||
lumijs | ||
Makefile | ||
package.json | ||
README.md | ||
tsconfig.json | ||
tslint.json | ||
yarn.lock |
LumiJS
This directory contains Lumi's JavaScript compiler.
It implements a subset of JavaScript, with optional TypeScript-style type annotations, and compiles that subset into LumiPack/IL.
Building and Testing
LumiJS is built independent from the overall Lumi toolchain. First clone and cd
to the right place:
$ git clone git@github.com:pulumi/lumi
$ cd lumi/cmd/lumijs
Next, install dependencies, ideally using Yarn:
$ yarn install
(NPM can be used instead, but Yarn offers better performance, reliability, and security, so it's what we use below.)
From there, to build:
$ yarn run build
It's possible to simply run the TypeScript compiler using tsc
, however the Yarn build step performs a couple extra
steps; namely, it runs TSLint and also copies some test baseline files into the right place.
Next, to test, simply run:
$ yarn run test
It will be obvious if the tests passed or failed and, afterwards, code coverage data will be output to the console.
After building, a typical developer setup would be to add cmd/lumijs/
to your $PATH
; there is a lumijs
executable in the root directory that conveniently wraps invocation of the compiler, passing through any arguments.
Libraries
In order to use the Lumi libraries -- including the standard library -- you will need to do a few additional steps to prepare your developer workspace. Please see this document for details on how to do this.