aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/os/wasm.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-04-04 19:22:04 +0300
committerCan Celik <ogulcancelik@gmail.com>2026-04-05 01:23:06 +0300
commit41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch)
tree3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/src/os/wasm.zig
parent55c138263e190a1e79d4b997bfb9397306c0ec1f (diff)
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/src/os/wasm.zig')
-rw-r--r--vendor/libghostty-vt/src/os/wasm.zig25
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/os/wasm.zig b/vendor/libghostty-vt/src/os/wasm.zig
new file mode 100644
index 00000000..3d0b90e9
--- /dev/null
+++ b/vendor/libghostty-vt/src/os/wasm.zig
@@ -0,0 +1,25 @@
+//! This file contains helpers for wasm compilation.
+const std = @import("std");
+const builtin = @import("builtin");
+const options = @import("build_options");
+
+comptime {
+ if (!builtin.target.cpu.arch.isWasm()) {
+ @compileError("wasm.zig should only be analyzed for wasm32 builds");
+ }
+}
+
+/// True if we're in shared memory mode. If true, then the memory buffer
+/// in JS will be backed by a SharedArrayBuffer and some behaviors change.
+pub const shared_mem = options.wasm_shared;
+
+/// The allocator to use in wasm environments.
+///
+/// The return values of this should NOT be sent to the host environment
+/// unless toHostOwned is called on them. In this case, the caller is expected
+/// to call free. If a pointer is NOT host-owned, then the wasm module is
+/// expected to call the normal alloc.free/destroy functions.
+pub const alloc = if (builtin.is_test)
+ std.testing.allocator
+else
+ std.heap.wasm_allocator;