diff options
author | 2023-07-11 19:14:34 -0700 | |
---|---|---|
committer | 2023-07-11 19:14:34 -0700 | |
commit | cbb88672f217a90db1aa1eb29cd92d5d9035b22b (patch) | |
tree | 43a00501f3cde495967e116f0b660777051551f8 /src/api/schema.zig | |
parent | 1f900cff453700b19bca2acadfe26da4468c1282 (diff) | |
parent | 34b0e7a2bbd8bf8097341cdb0075d0908283e834 (diff) | |
download | bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.tar.gz bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.tar.zst bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.zip |
Merge branch 'main' into jarred/esm-conditionsjarred/esm-conditions
Diffstat (limited to 'src/api/schema.zig')
-rw-r--r-- | src/api/schema.zig | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/src/api/schema.zig b/src/api/schema.zig index 227d1296b..ec8efa9f6 100644 --- a/src/api/schema.zig +++ b/src/api/schema.zig @@ -201,7 +201,7 @@ pub fn Writer(comptime WritableStream: type) type { } pub inline fn writeEnum(this: *Self, val: anytype) !void { - try this.writeInt(@enumToInt(val)); + try this.writeInt(@intFromEnum(val)); } pub fn writeValue(this: *Self, comptime SliceType: type, slice: SliceType) !void { @@ -896,9 +896,9 @@ pub const Api = struct { try writer.writeValue(@TypeOf(this.factory), this.factory); try writer.writeEnum(this.runtime); try writer.writeValue(@TypeOf(this.fragment), this.fragment); - try writer.writeInt(@as(u8, @boolToInt(this.development))); + try writer.writeInt(@as(u8, @intFromBool(this.development))); try writer.writeValue(@TypeOf(this.import_source), this.import_source); - try writer.writeInt(@as(u8, @boolToInt(this.react_fast_refresh))); + try writer.writeInt(@as(u8, @intFromBool(this.react_fast_refresh))); } }; @@ -1166,7 +1166,7 @@ pub const Api = struct { pub fn encode(this: *const @This(), writer: anytype) anyerror!void { try writer.writeEnum(this.kind); try writer.writeValue(@TypeOf(this.path), this.path); - try writer.writeInt(@as(u8, @boolToInt(this.dynamic))); + try writer.writeInt(@as(u8, @intFromBool(this.dynamic))); } }; @@ -1405,7 +1405,7 @@ pub const Api = struct { } if (this.development) |development| { try writer.writeFieldID(5); - try writer.writeInt(@as(u8, @boolToInt(development))); + try writer.writeInt(@as(u8, @intFromBool(development))); } if (this.client_css_in_js) |client_css_in_js| { try writer.writeFieldID(6); @@ -1579,7 +1579,7 @@ pub const Api = struct { pub fn encode(this: *const @This(), writer: anytype) anyerror!void { try writer.writeValue(@TypeOf(this.package), this.package); try writer.writeValue(@TypeOf(this.display_name), this.display_name); - try writer.writeInt(@as(u8, @boolToInt(this.development))); + try writer.writeInt(@as(u8, @intFromBool(this.development))); try writer.writeValue(@TypeOf(this.entry_points), this.entry_points); try writer.writeEnum(this.client_css_in_js); try writer.writeValue(@TypeOf(this.override_modules), this.override_modules); @@ -1887,7 +1887,7 @@ pub const Api = struct { } if (this.preserve_symlinks) |preserve_symlinks| { try writer.writeFieldID(7); - try writer.writeInt(@as(u8, @boolToInt(preserve_symlinks))); + try writer.writeInt(@as(u8, @intFromBool(preserve_symlinks))); } if (this.entry_points) |entry_points| { try writer.writeFieldID(8); @@ -1895,7 +1895,7 @@ pub const Api = struct { } if (this.write) |write| { try writer.writeFieldID(9); - try writer.writeInt(@as(u8, @boolToInt(write))); + try writer.writeInt(@as(u8, @intFromBool(write))); } if (this.inject) |inject| { try writer.writeFieldID(10); @@ -1923,7 +1923,7 @@ pub const Api = struct { } if (this.serve) |serve| { try writer.writeFieldID(16); - try writer.writeInt(@as(u8, @boolToInt(serve))); + try writer.writeInt(@as(u8, @intFromBool(serve))); } if (this.extension_order) |extension_order| { try writer.writeFieldID(17); @@ -1931,7 +1931,7 @@ pub const Api = struct { } if (this.generate_node_module_bundle) |generate_node_module_bundle| { try writer.writeFieldID(18); - try writer.writeInt(@as(u8, @boolToInt(generate_node_module_bundle))); + try writer.writeInt(@as(u8, @intFromBool(generate_node_module_bundle))); } if (this.node_modules_bundle_path) |node_modules_bundle_path| { try writer.writeFieldID(19); @@ -1951,11 +1951,11 @@ pub const Api = struct { } if (this.no_summary) |no_summary| { try writer.writeFieldID(23); - try writer.writeInt(@as(u8, @boolToInt(no_summary))); + try writer.writeInt(@as(u8, @intFromBool(no_summary))); } if (this.disable_hmr) |disable_hmr| { try writer.writeFieldID(24); - try writer.writeInt(@as(u8, @boolToInt(disable_hmr))); + try writer.writeInt(@as(u8, @intFromBool(disable_hmr))); } if (this.port) |port| { try writer.writeFieldID(25); @@ -2427,7 +2427,7 @@ pub const Api = struct { } if (this.build) |build| { try writer.writeFieldID(2); - try writer.writeInt(@as(u8, @boolToInt(build))); + try writer.writeInt(@as(u8, @intFromBool(build))); } try writer.endMessage(); } @@ -2901,6 +2901,12 @@ pub const Api = struct { /// global_bin_dir global_bin_dir: ?[]const u8 = null, + /// frozen_lockfile + frozen_lockfile: ?bool = null, + + /// exact + exact: ?bool = null, + pub fn decode(reader: anytype) anyerror!BunInstall { var this = std.mem.zeroes(BunInstall); @@ -2964,6 +2970,12 @@ pub const Api = struct { 18 => { this.global_bin_dir = try reader.readValue([]const u8); }, + 19 => { + this.frozen_lockfile = try reader.readValue(bool); + }, + 20 => { + this.exact = try reader.readValue(bool); + }, else => { return error.InvalidMessage; }, @@ -2995,35 +3007,35 @@ pub const Api = struct { } if (this.dry_run) |dry_run| { try writer.writeFieldID(6); - try writer.writeInt(@as(u8, @boolToInt(dry_run))); + try writer.writeInt(@as(u8, @intFromBool(dry_run))); } if (this.force) |force| { try writer.writeFieldID(7); - try writer.writeInt(@as(u8, @boolToInt(force))); + try writer.writeInt(@as(u8, @intFromBool(force))); } if (this.save_dev) |save_dev| { try writer.writeFieldID(8); - try writer.writeInt(@as(u8, @boolToInt(save_dev))); + try writer.writeInt(@as(u8, @intFromBool(save_dev))); } if (this.save_optional) |save_optional| { try writer.writeFieldID(9); - try writer.writeInt(@as(u8, @boolToInt(save_optional))); + try writer.writeInt(@as(u8, @intFromBool(save_optional))); } if (this.save_peer) |save_peer| { try writer.writeFieldID(10); - try writer.writeInt(@as(u8, @boolToInt(save_peer))); + try writer.writeInt(@as(u8, @intFromBool(save_peer))); } if (this.save_lockfile) |save_lockfile| { try writer.writeFieldID(11); - try writer.writeInt(@as(u8, @boolToInt(save_lockfile))); + try writer.writeInt(@as(u8, @intFromBool(save_lockfile))); } if (this.production) |production| { try writer.writeFieldID(12); - try writer.writeInt(@as(u8, @boolToInt(production))); + try writer.writeInt(@as(u8, @intFromBool(production))); } if (this.save_yarn_lockfile) |save_yarn_lockfile| { try writer.writeFieldID(13); - try writer.writeInt(@as(u8, @boolToInt(save_yarn_lockfile))); + try writer.writeInt(@as(u8, @intFromBool(save_yarn_lockfile))); } if (this.native_bin_links) |native_bin_links| { try writer.writeFieldID(14); @@ -3031,11 +3043,11 @@ pub const Api = struct { } if (this.disable_cache) |disable_cache| { try writer.writeFieldID(15); - try writer.writeInt(@as(u8, @boolToInt(disable_cache))); + try writer.writeInt(@as(u8, @intFromBool(disable_cache))); } if (this.disable_manifest_cache) |disable_manifest_cache| { try writer.writeFieldID(16); - try writer.writeInt(@as(u8, @boolToInt(disable_manifest_cache))); + try writer.writeInt(@as(u8, @intFromBool(disable_manifest_cache))); } if (this.global_dir) |global_dir| { try writer.writeFieldID(17); @@ -3045,6 +3057,14 @@ pub const Api = struct { try writer.writeFieldID(18); try writer.writeValue(@TypeOf(global_bin_dir), global_bin_dir); } + if (this.frozen_lockfile) |frozen_lockfile| { + try writer.writeFieldID(19); + try writer.writeInt(@as(u8, @intFromBool(frozen_lockfile))); + } + if (this.exact) |exact| { + try writer.writeFieldID(20); + try writer.writeInt(@as(u8, @intFromBool(exact))); + } try writer.endMessage(); } }; |