Zigar is a tool kit that lets you use Zig code in a JavaScript project. The latest version is a significant upgrade from the initial release. A variety of shortcomings were addressed:
- Pointer handling was completely overhauled. The new system is more performant and has fewer limitations. It’s capable of correctly representing recursive structures, for instance.
- Old C++ addon based on node-gyp was jettisoned in favor of one based on Node-API. It’s now built using the Zig compiler itself, both eliminating unnecessary dependencies and allowing you to cross-compile for multiple platforms.
- Support for Windows. The new version is also designed to work with Electron and NW.js. The issue that kept Zigar from working on Node.js 20+ has been resolved.
- Support for the newly released Zig 0.12.0.
- Support for obscure Zig types such as enum literal. Problems with error sets were fixed.
- A proper user guide, complete with tutorials, is now available.
Zigar 0.11.1 is basically a second-gen effort. It’s less proof-of-concept in nature and more like a product you can actually use. I hope you’ll take it for a spin!
Project page: GitHub - chung-leong/zigar: Enable the use of Zig code in JavaScript project