╭ changed ╮ │build.zig│ ╰─────────╯ ╭────────────────────────────────────────────────────────────────────╮ │ 1 const std = @import("std"); │ │ 2 │ │ 3 pub fn build(b: *std.Build) void { │ │ 4 + const xit_dep = b.dependency("xit", .{}); │ │ 5 + │ │ 6 + // wasm │ │ 7 + const install_wasm_exe = blk: { │ │ 8 + const wasm_target = b.resolveTargetQuery(.{ │ │ 9 + .cpu_arch = .wasm32, │ │10 + .os_tag = .freestanding, │ │11 + }); │ │12 + │ │13 + const exe = b.addExecutable(.{ │ │14 + .name = "haxy", │ │15 + .root_module = b.createModule(.{ │ │16 + .root_source_file = b.path("src/main_wasm.zig"),│ │17 + .target = wasm_target, │ │18 + .optimize = .ReleaseSmall, │ │19 + }), │ │20 + }); │ │21 + exe.root_module.addImport("xit", xit_dep.module("xit"));│ │22 + │ │23 + exe.global_base = 6560; │ │24 + exe.entry = .disabled; │ │25 + exe.rdynamic = true; │ │26 + exe.import_memory = false; │ │27 + exe.export_memory = true; │ │28 + exe.stack_size = std.wasm.page_size; │ │29 + │ │30 + const initial_pages = 16; │ │31 + const max_pages = 256; │ │32 + exe.initial_memory = std.wasm.page_size * initial_pages;│ │33 + exe.max_memory = std.wasm.page_size * max_pages; │ │34 + │ │35 + const install_exe = b.addInstallArtifact(exe, .{}); │ │36 + b.getInstallStep().dependOn(&install_exe.step); │ │37 + │ │38 + const wasm_step = b.step("wasm", "Generate the wasm"); │ │39 + wasm_step.dependOn(&install_exe.step); │ │40 + │ │41 + break :blk install_exe; │ │42 + }; │ │43 + │ │44 const target = b.standardTargetOptions(.{}); │ │45 const optimize = b.standardOptimizeOption(.{}); │ │46 │ ╰────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │54 .optimize = optimize, │ │55 }), │ │56 }); │ │17 - exe.root_module.addImport("xit", b.dependency("xit", .{}).module("xit"));│ │57 + exe.root_module.addImport("xit", xit_dep.module("xit")); │ │58 + exe.step.dependOn(&install_wasm_exe.step); │ │59 │ │60 const install_exe = b.addInstallArtifact(exe, .{}); │ │61 b.getInstallStep().dependOn(&install_exe.step); │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │73 │ │74 break :blk install_exe; │ │75 }; │ │35 - │ │36 - // wasm │ │37 - { │ │38 - const wasm_target = b.resolveTargetQuery(.{ │ │39 - .cpu_arch = .wasm32, │ │40 - .os_tag = .freestanding, │ │41 - }); │ │42 - │ │43 - const exe = b.addExecutable(.{ │ │44 - .name = "haxy", │ │45 - .root_module = b.createModule(.{ │ │46 - .root_source_file = b.path("src/main_wasm.zig"), │ │47 - .target = wasm_target, │ │48 - .optimize = .ReleaseSmall, │ │49 - }), │ │50 - }); │ │51 - exe.root_module.addImport("xit", b.dependency("xit", .{}).module("xit"));│ │52 - │ │53 - exe.global_base = 6560; │ │54 - exe.entry = .disabled; │ │55 - exe.rdynamic = true; │ │56 - exe.import_memory = false; │ │57 - exe.export_memory = true; │ │58 - exe.stack_size = std.wasm.page_size; │ │59 - │ │60 - const initial_pages = 16; │ │61 - const max_pages = 256; │ │62 - exe.initial_memory = std.wasm.page_size * initial_pages; │ │63 - exe.max_memory = std.wasm.page_size * max_pages; │ │64 - │ │65 - b.installArtifact(exe); │ │66 - │ │67 - const wasm_step = b.step("wasm", "Generate the wasm"); │ │68 - wasm_step.dependOn(&exe.step); │ │69 - wasm_step.dependOn(b.getInstallStep()); │ │70 - } │ │76 │ │77 // module for using haxy as a library │ │78 // (the commands below consume haxy this way) │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────╮ │79 const haxy = b.addModule("haxy", .{ │ │80 .root_source_file = b.path("src/lib.zig"), │ │81 }); │ │77 - haxy.addImport("xit", b.dependency("xit", .{}).module("xit"));│ │82 + haxy.addImport("xit", xit_dep.module("xit")); │ │83 │ │84 // test │ │85 { │ ╰──────────────────────────────────────────────────────────────────────╯ ╭ changed ──────╮ │src/command.zig│ ╰───────────────╯ ╭─────────────────────────────────────╮ │193 http_listen: []const u8,│ │194 ssh_listen: ?[]const u8,│ │195 data_dir: []const u8, │ │196 - ui: bool, │ │196 + tui: bool, │ │197 }, │ │198 ssh_helper: struct { │ │199 ssh_connect: []const u8,│ ╰─────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │211 .http_listen = (cmd_args.get("--http-listen") orelse null) orelse "127.0.0.1:8080",│ │212 .ssh_listen = (cmd_args.get("--ssh-listen") orelse null), │ │213 .data_dir = (cmd_args.get("--data-dir") orelse null) orelse ".", │ │214 - .ui = cmd_args.contains("--ui"), │ │214 + .tui = cmd_args.contains("--tui"), │ │215 } }; │ │216 }, │ │217 .ssh_helper => { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───╮ │src/main.zig│ ╰────────────╯ ╭─────────────────────────────────────────────────────────────────╮ │80 .http_listen = cli_cmd.serve.http_listen,│ │81 .ssh_listen = cli_cmd.serve.ssh_listen, │ │82 .data_dir = cli_cmd.serve.data_dir, │ │83 - .ui = cli_cmd.serve.ui, │ │83 + .tui = cli_cmd.serve.tui, │ │84 }, run_opts.err); │ │85 }, │ │86 .ssh_helper => { │ ╰─────────────────────────────────────────────────────────────────╯ ╭ changed ────╮ │src/serve.zig│ ╰─────────────╯ ╭────────────────────────────────────────╮ │ 3 const rp = xit.repo; │ │ 4 const hash = xit.hash; │ │ 5 const ui = @import("./ui.zig"); │ │ 6 +const web = @import("./web.zig"); │ │ 7 + │ │ 8 +const wui_listen = "127.0.0.1:8082";│ │ 9 │ │10 pub const Options = struct { │ │11 http_listen: []const u8, │ ╰────────────────────────────────────────╯ ╭──────────────────────────────────╮ │12 ssh_listen: ?[]const u8, │ │13 data_dir: []const u8, │ │11 - ui: bool, │ │14 + tui: bool, │ │15 }; │ │16 │ │17 const ListenAddress = struct {│ ╰──────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │49 const http_address = try std.Io.net.IpAddress.parseIp4(http_listen_address.host, http_listen_address.port);│ │50 var http_server = try http_address.listen(io, .{ .reuse_address = true }); │ │51 defer http_server.deinit(io); │ │49 - │ │50 - try err.print("serving HTTP on {s}, repo root {s}\n", .{ options.http_listen, repo_root_path }); │ │51 - try err.flush(); │ │52 │ │53 - var tasks: std.Io.Group = .init; │ │54 - defer tasks.cancel(io); │ │55 - │ │56 - runHttpListener(repo_kind, any_repo_opts, io, allocator, repo_root_path, &http_server, &tasks, err); │ │57 - │ │58 - if (options.ui) { │ │59 - runTui(io, allocator, &tasks, err); │ │60 - } │ │61 - │ │53 // create ssh listener │ │54 │ │55 var ssh_server: ?std.Io.net.Server = null; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯