From 3f1533813b6692a736251e4d467a7f108229ddee Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 11:40:11 -0300 Subject: targets: the DOM web shell goes (src/web.zig and src/web/, its harnesses web_harness, web_snapshot, web_driver_test and web-snapshots/, tools/web_fixture.py, -Dplatform=web, -Ddump, and the web, web-harness, web-snap, web-e2e and web-driver-test steps), and with it what only a freestanding build needed: `hosted` and every guard on it (every build has a host now), memory's stack-fallback arenas and reduced_target sizes, the emscripten main, the tree-sitter libc shim and the stb stub, lsp's has_client, the web arms of the platform switches (-Dplatform is tui, gui or macos); the macOS files pass zig ast-check; docs/web.md is a paragraph on what it was Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/dump.zig | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/dump.zig') diff --git a/src/dump.zig b/src/dump.zig index 6bdfb7d4..a35a9fab 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -54,7 +54,6 @@ fn uniqueIn(buf: *[1024:0]u8, dir: []const u8, base: []const u8) ?[:0]const u8 { std.fmt.bufPrintSentinel(buf, "{s}/{s}.dump", .{ dir, base }, 0) else std.fmt.bufPrintSentinel(buf, "{s}/{s}-{d}.dump", .{ dir, base, n }, 0)) catch return null; - if (comptime !pardes.hosted) return path; if (std.c.access(path.ptr, std.c.F_OK) != 0) return path; } return null; @@ -72,10 +71,8 @@ test "two dumps in one second get names of their own" { try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "pardes-x.dump", .data = "" }); try std.testing.expect(std.mem.endsWith(u8, uniqueIn(&buf, dir, "pardes-x").?, "/pardes-x-2.dump")); } -/// The host's environment; a freestanding core (the web's) has none -/// and no libc to ask, so only a DumpDir with no `~/` names a directory there. +/// The host's environment. fn hostEnv(name: [*:0]const u8) ?[*:0]u8 { - if (builtin.os.tag == .freestanding) return null; return std.c.getenv(name); } @@ -90,8 +87,7 @@ pub fn directory(buf: []u8, dir_setting: []const u8) ?[]const u8 { var fba_buf: [4096]u8 = undefined; var fba = std.heap.FixedBufferAllocator.init(&fba_buf); var cwd_buf: [1024]u8 = undefined; - // No libc on the web: there a relative one is from `/`. - const cwd: []const u8 = if (comptime !pardes.hosted) "/" else if (std.fs.path.isAbsolute(raw)) "/" else if (std.c.getcwd(&cwd_buf, cwd_buf.len)) |c| std.mem.span(@as([*:0]const u8, @ptrCast(c))) else "/"; + const cwd: []const u8 = if (std.fs.path.isAbsolute(raw)) "/" else if (std.c.getcwd(&cwd_buf, cwd_buf.len)) |c| std.mem.span(@as([*:0]const u8, @ptrCast(c))) else "/"; const resolved = std.fs.path.resolvePosix(fba.allocator(), &.{ cwd, raw }) catch return null; return std.fmt.bufPrint(buf, "{s}", .{resolved}) catch null; } @@ -157,7 +153,6 @@ const SessionLoad = walk.Load(&.{ Pardes, []const filesystem.Mount, OnDisk, []co const OnDisk = [MAX_PANES]bool; fn onDisk(pane: *const pardes.panes.Pane) bool { - if (comptime !pardes.hosted) return false; const f = pane.file orelse return false; if (f.output != null) return false; const local = filesystem.localPath(f.path) orelse return false; @@ -464,13 +459,13 @@ fn revivePane(p: *Pardes, id: usize, pane: *pardes.panes.Pane, was_on_disk: bool if (pane.terminal != null) { // A command pane comes back finished, showing what it said: its // command is not run again. A host that runs shells starts one - // under the history in the old one's directory; the web shell and - // an isolated build only show it. + // under the history in the old one's directory; an isolated build + // only shows it. if (pane.command != null) { pane.command_done = true; return; } - if (comptime platform == .web or isolated) return; + if (comptime isolated) return; if (pane.cwdSlice().len > effect_path_cap) return; pardes.panes.terminal.reviveShell(pane); p.emitSpawn(id, pane.serial, pane.cwdSlice()); @@ -489,8 +484,7 @@ fn revivePane(p: *Pardes, id: usize, pane: *pardes.panes.Pane, was_on_disk: bool // Its file gone from disk since the dump: its text is nowhere else, so // it is said deleted, and Del, Exit and Restore ask first. One never on // disk (a name not yet saved) comes back as it was. - // (A host with no disk of its own, the web's, asks nothing.) - if (comptime pardes.hosted) if (was_on_disk and !onDisk(pane)) pardes.panes.File.deleted(p, @intCast(id)); + if (was_on_disk and !onDisk(pane)) pardes.panes.File.deleted(p, @intCast(id)); } // ---- one pane to and from a dump: the store's, a handover's ---- -- cgit v1.3