Simple example of embedding Kiesel in Zig code
Find a file
Linus Groh 3d7a16d4da
All checks were successful
CI / lint (push) Successful in 51s
CI / test (push) Successful in 59s
Add CI
2025-11-23 17:50:18 +00:00
.forgejo/workflows Add CI 2025-11-23 17:50:18 +00:00
src Update to Zig 0.15.2 2025-11-23 17:45:21 +00:00
.gitignore zig-cache -> .zig-cache 2024-06-01 18:02:04 +02:00
build.zig Update kiesel 2025-06-16 00:47:24 +02:00
build.zig.zon Update to Zig 0.15.2 2025-11-23 17:45:21 +00:00
LICENSE Initial commit 2024-01-26 19:35:11 +00:00
README.md Update kiesel 2025-06-16 00:47:24 +02:00

Kiesel Zig Example

This repository contains a minimal example of how to embed the Kiesel JS engine in Zig code.

The basic steps are:

  1. Declare dependency in build.zig.zon:

    .{
        // ...
        .dependencies = .{
            // ...
            .kiesel = .{
                .url = "https://codeberg.org/kiesel-js/kiesel/archive/<commit hash>.tar.gz",
                .hash = "<package hash>",
            },
        },
    }
    
  2. Add the module to your executable or library in build.zig:

    const kiesel = b.dependency("kiesel", .{
        .target = target,
        .optimize = optimize,
        // Enabled by default, reduces size if you don't need `Intl` or `Temporal`
        .@"enable-intl" = false,
        .@"enable-temporal" = false,
    });
    
    // ...
    exe.root_module.addImport("kiesel", kiesel.module("kiesel"));
    
  3. Use it! See src/main.zig for a basic example, run zig build run to try it out.