Skip to content

Release v0.3.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 07 Jan 22:04

ZAP Release v0.3.0

Updates

-Dopenssl is back && breaking mustache changes

Thanks to @Vemahk, -Dopenssl=true is back! Apparently, while trying to pass user-defined options from a dependent project to zap, I typoed the working solution, and several people pointed out to me that it's as simple as:

    const zap = b.dependency("zap", .{
        .target = target,
        .optimize = optimize,
        .openssl = false, // set to true to enable TLS support
    });

As a result, we re-introduced -Dopenssl, use it if present, and fall back to the ZAP_USE_OPENSSL env var (set to true to enable) if not.

Aaand: thanks to @chooky (BrookJeynes on GH), we have a new, clean, zig-iomatic, documented Mustache API in Zap now:

    var mustache = try Mustache.fromData("{{some_item}} {{& nested.item }}");
    defer mustache.deinit();

    const b = mustache.build(.{
        .some_item = 42,
        .nested = .{
            .item = 69,
        },
    });
    defer b.deinit();

    if(b.str()) |s| {
        std.debug.print("{s}", .{s});
    };

Checkout mustache.zig and the mustache example to learn more.

Using it

To use in your own projects, put this dependency into your build.zig.zon:

        // zap v0.3.0
        .zap = .{
            .url = "https://github.com/zigzap/zap/archive/refs/tags/v0.3.0.tar.gz",
            .hash = "1220697520f1fc8c511db31bb99d3adae035b83abbc9752de59c3a5ac4f22e7a90fa",
        }

Here is a complete build.zig.zon example:

.{
    .name = "My example project",
    .version = "0.0.1",

    .dependencies = .{
        // zap v0.3.0
        .zap = .{
            .url = "https://github.com/zigzap/zap/archive/refs/tags/v0.3.0.tar.gz",
            .hash = "1220697520f1fc8c511db31bb99d3adae035b83abbc9752de59c3a5ac4f22e7a90fa",
        }
    }
}

Then, in your build.zig's build function, add the following before exe.install():

    const zap = b.dependency("zap", .{
        .target = target,
        .optimize = optimize,
    });
    exe.addModule("zap", zap.module("zap"));
    exe.linkLibrary(zap.artifact("facil.io"));