After a few months of more work I’m happy to announce a new txiki.js release, version 23.1.0, quite possibly the biggest release I’ve made, and one that paves the way for the future. Let’s dive right in!
Standard library refactor
I’ve actually gone back and forth on this one. The standard library modules started being importable as
@tjs/ modules, but I later switched to having it all bundled together in
@tjs/stdlib. While easier to work with, that was a mistake. It’s slower to load and the churn due to the bundles being in the repo is just annoying.
It’s also important to look around and see what others are doing. Both Node and Bun seem to have settled in using
namespace:module naming for builtins, so that’s what I went with. All standard library modules are now imported like so:
These modules are now documented too, so you can see the full API at a glance.
The CLI also got some much needed love on this one. Generally speaking the CLI allowed one to either launch a file or eval an expression, plus some modifiers for each. After giving it some though, the idea of using subcommands sounded the most appealing, so now you can do
tjs run foo.js and
tjs eval ”console.log(42)”
But there is more. There is a also a builtin test runner now so
tjs test is a thing too!
Last, running WASI binaries directly was too easy not to do, so you can also
tjs run foo.wasm now and it works as expected.
Top level await
Just when I was about ready to cut the release I noticed zamfofex had sent a patch adding top level await support to QuickJS to the mailing list. That was too good to pass so I quickly incorporated it, and it worked beautifully!
This makes writing simple scripts (and tests!) so much more pleasant! So off I went and migrated the test suite to use TLA, the examples too, and added some initial support to the REPL while I was at it!
There is even more!
While these are the highlights, there are a lot more fixes that went into the release. Please checkout the full release notes here.