Wisdom of hindsight
Despite SkookumJS being a failure, I learned a lot. I learned CMake, the Duktape API (very close to the Lua API apparently) but most importantly I discovered how not to build that runtime I was dreaming about.
My main takeaways:
- If the runtime is not going to be Node compatible it must be browser compatible (API wise)
- Relying on external tools (like Node) to prepare the core JS bundle simplify things a lot, since you can transpile the code to whatever your JS engine supports
- With ES6 and promises a runtime that does not incorporate the concept of an event loop seems unattainable
- C and CMake are still solid choices, we can wrap anything!
txiki.js is born
It’s fair to say txiki.js would not have materialized without QuickJS. It supports ES2020, ES modules, comes with a sample standard library, the C API is incredibly easy to use, and it’s extremely easy to embed in other projects, it’s just a handful of C files. It had it all.
So I got to work. I chose libuv for the event loop and ported the little standard library QuickJS came with to it. This gave me the confidence I was on the right path.
By this time Deno had already made an appearance in the scene. Some of its propositions sounded really appealing to me, specially the fact that it targets browser APIs and there is no require, just ESM modules. The people behind Deno definitely know what they are doing, and that further cemented some of the ideas I wasn’t sure about.
It’s now pretty functional, and I realized I forgot to actually post about it here, so I guess it’s time to “announce” it.
A couple of weeks ago FOSDEM took place, virtually. It’s one of my favorite conferences and when the call for papers opened I thought to myself “let’s use this as an opportunity to get txiki.js in better shape and tell the world”. Thankfully my talk proposal was accepted and I talked about my journey from SkookumJS to txiki.js. You can check it here.
I plan on continuing the journey I outlined in the talk with this new found enthusiasm. You can follow along on GitHub.