txiki.js is a small and powerful JavaScript runtime. It targets the latest ECMAScript spec and implements many web platform features.
It’s built on the shoulders of giants: it uses QuickJS-ng as its JavaScript engine, libuv as the platform layer, wasm3 as the WebAssembly engine and curl as the HTTP / WebSocket client.
Earlier this week I released version 24.12.0 featuring standalone executables, namespace reorganization, more web platform features, initial binary releases, more filesystem APIs, REPL updates and more! Check here for the full changelog, and read-on for some highlights.
Standalone executables
All modern JavaScript runtimes (Node, Deno, Bun) support bundling some JS code with the runtime executable into a new executable. This is a very simple way to deploy small utilities, and maybe even whole server applications.
Starting with version 24.12.0 txiki.js can do it too! The current implementation is a bit naive, it doesn’t support code bundling so an external tool like esbuild is necessary to bundle the code, but it’s a start!
# Bundle the app code
npx esbuild my-app/index.js \
--bundle \
--outfile=bundle.js \
--external:tjs:* \
--minify \
--target=es2023 \
--platform=neutral \
--format=esm \
--main-fields=main,module
# Create a standalone executable
tjs compile bundle.js myexe
tjs
namespace cleanup
After trying out a few ways I settled in using a single global variable (tjs
) and putting all APIs there, as a flat namespace. While simple to understand (everything is in The One And Only Place) it can be a bit chaotic, so with some encouragement I sat to make some changes.
The new API is fully documented here. This PR shows all the changes, but basically there is now a tjs.engine
“sub-namespace” and tjs.system
which provide some grouping. In addition, many functions like hostname()
became getters (hostName
and so on).
Hopefully this was the last time I made such a large / disruptive chance. Sometimes you have to try stuff out…
More web platform features
Being close to web APIs is a goal txiki.js has. To that end, this release added some more web APIs and refined some existing ones.
postMessage
support transfers- Transferring
SharedArrayBuffer
objects is now supported ObjectURL
API support was addedstructuredClone
is now implementednavigator
is now more spec compliant
Initial binary releases
Thanks to a contributor binaries for macOS and Windows (64bits) are made with each new release. You can find them here.
That’s all for tonight!