Lightpanda: the headless browser designed for AI and automation
Fix build
Karl Seguinf4544da758d7
diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.ymlindex 631db155a..2fb1bfe5a 100644--- a/.github/actions/install/action.yml+++ b/.github/actions/install/action.yml@@ -13,7 +13,7 @@ inputs:zig-v8:description: 'zig v8 version to install'required: false- default: 'v0.5.8'+ default: 'v0.5.9'v8:description: 'v8 version to install'required: falsediff --git a/.github/actions/v8-snapshot/action.yml b/.github/actions/v8-snapshot/action.ymlindex 53a0c8b2a..89b9ae06d 100644--- a/.github/actions/v8-snapshot/action.yml+++ b/.github/actions/v8-snapshot/action.yml@@ -13,7 +13,7 @@ inputs:zig-v8:description: 'zig-v8 release tag the prebuilt lib came from'required: false- default: 'v0.5.8'+ default: 'v0.5.9'runs:using: "composite"diff --git a/Dockerfile b/Dockerfileindex 822aebd89..0b2455142 100644--- a/Dockerfile+++ b/Dockerfile@@ -4,7 +4,7 @@ FROM debian:stable-slimARG MINISIG=0.12ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/UARG V8=15.5.35.13-ARG ZIG_V8=v0.5.8+ARG ZIG_V8=v0.5.9ARG TARGETPLATFORMRUN apt-get update -yq && \diff --git a/build.zig b/build.zigindex 8677c590d..0707fa034 100644--- a/build.zig+++ b/build.zig@@ -306,11 +306,13 @@ fn findPrebuiltV8(b: *Build, target: Build.ResolvedTarget, dev_fast: bool) ?[]co@tagName(target.result.cpu.arch),}) });};- b.dependOnFileMetadata(b.path(path));std.Io.Dir.cwd().access(io, rootPath(b, path), .{}) catch {+ // Zig can't track a missing file as a configure dependency; the+ // source-build path poisons the configure cache instead.std.debug.print("No prebuilt V8 at {s}; using the V8 source-build path. `make download-v8` fetches the prebuilt.\n", .{path});return null;};+ b.dependOnFileMetadata(b.path(path));std.debug.print("Using prebuilt V8: {s}\n", .{path});return path;}diff --git a/build.zig.zon b/build.zig.zonindex 3bf2fac20..36d0d6241 100644--- a/build.zig.zon+++ b/build.zig.zon@@ -5,8 +5,8 @@.minimum_zig_version = "0.17.0",.dependencies = .{.v8 = .{- .url = "https://github.com/lightpanda-io/zig-v8-fork/archive/10f6a11e81fd4809988a24e3f5b3d5d4fd3a73fe.tar.gz",- .hash = "v8-0.0.0-xddH6w1QAwDcuJPtc73VXElNBsgPgrRBqQR__jWhy_C4",+ .url = "https://github.com/lightpanda-io/zig-v8-fork/archive/b73e4fa2d0afe5036745ae7d332cc5cb7e7adb53.tar.gz",+ .hash = "v8-0.0.0-xddH64tVAwDZKW4zyy2h9cKXeWfWSjupsZIwTbYxSL9T",},// .v8 = .{ .path = "../zig-v8-fork" },.brotli = .{diff --git a/src/browser/js/Env.zig b/src/browser/js/Env.zigindex 7a10714bc..bfb523ac2 100644--- a/src/browser/js/Env.zig+++ b/src/browser/js/Env.zig@@ -153,7 +153,7 @@ pub fn init(app: *App, opts: InitOpts) !Env {v8.v8__Isolate__CreateParams__CONSTRUCT(params);params.snapshot_blob = @ptrCast(&snapshot.startup_data);- params.array_buffer_allocator = v8.v8__ArrayBuffer__Allocator__NewDefaultAllocator().?;+ params.array_buffer_allocator = v8.v8__ArrayBuffer__Allocator__NewDefaultAllocator(4 * 1024 * 1024 * 1024).?;errdefer v8.v8__ArrayBuffer__Allocator__DELETE(params.array_buffer_allocator.?);params.external_references = &snapshot.external_references;diff --git a/src/browser/js/Snapshot.zig b/src/browser/js/Snapshot.zigindex 35e5504b2..c2ab63146 100644--- a/src/browser/js/Snapshot.zig+++ b/src/browser/js/Snapshot.zig@@ -142,7 +142,7 @@ pub fn create() !Snapshot {var params: v8.CreateParams = undefined;v8.v8__Isolate__CreateParams__CONSTRUCT(¶ms);- params.array_buffer_allocator = v8.v8__ArrayBuffer__Allocator__NewDefaultAllocator();+ params.array_buffer_allocator = v8.v8__ArrayBuffer__Allocator__NewDefaultAllocator(4 * 1024 * 1024 * 1024);defer v8.v8__ArrayBuffer__Allocator__DELETE(params.array_buffer_allocator.?);params.external_references = @ptrCast(&external_references);diff --git a/src/string.zig b/src/string.zigindex 4d9d76bc2..1d0230274 100644--- a/src/string.zig+++ b/src/string.zig@@ -545,15 +545,15 @@ pub fn repeat(comptime s: []const u8, comptime n: usize) *const [s.len * n:0]u8fn Repeated(comptime s: []const u8, comptime n: usize) type {return struct {const value: [s.len * n:0]u8 = blk: {- var buf: [s.len * n:0]u8 = undefined;- if (s.len == 1) {- buf = @splat(s[0]);- } else {- @setEvalBranchQuota(1000 + 10 * n);- for (0..n) |i| @memcpy(buf[i * s.len ..][0..s.len], s);+ // Doubling: log2(n) concatenations instead of n comptime memcpys.+ var acc: []const u8 = "";+ var pow: []const u8 = s;+ var k = n;+ while (k > 0) : (k >>= 1) {+ if (k & 1 == 1) acc = acc ++ pow;+ if (k > 1) pow = pow ++ pow;}- buf[buf.len] = 0;- break :blk buf;+ break :blk acc[0 .. s.len * n].* ++ [_:0]u8{};};};}