Zigar

repository·main·Indexed 19 days ago

https://github.com/chung-leong/zigar

A bridge toolset enabling the use of Zig code within JavaScript (Node.js, Bun, Electron, NW.js, or WebAssembly) and PHP environments. Zigar provides high-performance interoperability through data type access and bidirectional call marshalling. It includes specific implementations such as bun-zigar for Bun.js, node-zigar-addon for Node.js, php-zigar for PHP, and rollup-plugin-zigar for Rollup build pipelines. Version 0.15.3 is compatible with Zig 0.15.x.

Tokens
13.2K
Snippets
51
Records
81
Agent score
64%

What's inside Zigar

  1. Overview of Zigar

    main
    Zigar is a software toolset designed to enable the use of Zig code within JavaScript or PHP projects. It provides high-performance interoperability by allowing data type access and function call marshalling between Zig and your host language.
  2. Use Zig code in JavaScript projects with rollup-plugin-zigar

    main
    rollup-plugin-zigar is a Rollup plugin that enables the integration of code written in the Zig language into JavaScript projects. This allows you to leverage Zig's performance and low-level capabilities within a standard JavaScript/Rollup build pipeline.
  3. Use Zig functions in Bun.js with bun-zigar

    main
    The bun-zigar package is a Bun.js addon that enables the execution of functions written in the Zig programming language within a Bun environment. This allows you to leverage Zig's performance and low-level capabilities directly from your Bun.js application.
  4. Key features of Zigar

    main

    Zigar provides several advanced capabilities for integrating Zig into web and desktop environments:

    • Data Interop: Access to all Zig data types in JavaScript or PHP.
    • Marshalling: Bidirectional call marshalling (Zig-to-JS/PHP and JS/PHP-to-Zig).
    • Concurrency: Async task management and support for threads in both native code and WebAssembly (including pthread support).
    • Environment Support:
      • Native Execution: Supports Node.js, Bun.js, Electron, and NW.js on MacOS, Linux, and Windows (64-bit and 32-bit).
      • WebAssembly: Supports Webpack, Rollup, and Vite.
    • File System: Emulation of file system operations.
  5. Check Zigar version compatibility with Zig

    main

    Zigar's versioning is tied directly to the Zig compiler version. The major and minor version numbers of Zigar correspond to the version of the Zig compiler it is designed for.

    Current Version: 0.15.3 (Compatible with Zig 0.15.x).