This function populates f.manifest or leaves it null.
fn loadManifest(f: *Fetch, pkg_root: Path) RunError!void
fn loadManifest(f: *Fetch, pkg_root: Path) RunError!void {
const io = f.job_queue.io;
const eb = &f.error_bundle;
const arena = f.arena.allocator();
const manifest_path = try pkg_root.join(arena, Manifest.basename);
Manifest.load(
io,
arena,
manifest_path,
&f.manifest_ast,
eb,
&f.manifest,
f.allow_missing_paths_field,
) catch |err| switch (err) {
error.FileNotFound => return,
error.Canceled => |e| return e,
error.ErrorsBundled => return error.FetchFailed,
else => |e| {
try eb.addRootErrorMessage(.{
.msg = try eb.printString("unable to load package manifest '{f}': {t}", .{ manifest_path, e }),
});
return error.FetchFailed;
},
};
f.have_manifest = true;
}