diff options
author | 2021-05-12 01:46:58 -0700 | |
---|---|---|
committer | 2021-05-12 01:46:58 -0700 | |
commit | f8131f42bcd039964586cbf3bd019dc9a449c438 (patch) | |
tree | 04af9a81309920ba04fd2e18d9f7fda3d615115b /src/api | |
parent | 175bbdd3c3ef13c3446fc5712e9dfcf96d387f0a (diff) | |
download | bun-f8131f42bcd039964586cbf3bd019dc9a449c438.tar.gz bun-f8131f42bcd039964586cbf3bd019dc9a449c438.tar.zst bun-f8131f42bcd039964586cbf3bd019dc9a449c438.zip |
okay
Former-commit-id: 2c20d88e8d0cf66b32daceb942ba9bf8514f5705
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/schema.d.ts | 1 | ||||
-rw-r--r-- | src/api/schema.js | 10 | ||||
-rw-r--r-- | src/api/schema.peechy | 2 | ||||
-rw-r--r-- | src/api/schema.zig | 11 |
4 files changed, 24 insertions, 0 deletions
diff --git a/src/api/schema.d.ts b/src/api/schema.d.ts index ff4b54a30..ce4521d6b 100644 --- a/src/api/schema.d.ts +++ b/src/api/schema.d.ts @@ -126,6 +126,7 @@ type uint32 = number; loader_values?: Loader[]; main_fields?: string[]; platform?: Platform; + watch?: boolean; } export interface FileHandle { diff --git a/src/api/schema.js b/src/api/schema.js index 0986f0d0b..acd53ac51 100644 --- a/src/api/schema.js +++ b/src/api/schema.js @@ -227,6 +227,10 @@ function decodeTransformOptions(bb) { result["platform"] = Platform[bb.readByte()]; break; + case 18: + result["watch"] = !!bb.readByte(); + break; + default: throw new Error("Attempted to parse invalid message"); } @@ -382,6 +386,12 @@ bb.writeByte(encoded); if (encoded === void 0) throw new Error("Invalid value " + JSON.stringify(value) + " for enum \"Platform\""); bb.writeByte(encoded); } + + var value = message["watch"]; + if (value != null) { + bb.writeByte(18); + bb.writeByte(value); + } bb.writeByte(0); } diff --git a/src/api/schema.peechy b/src/api/schema.peechy index 442dd3f84..f36a968b2 100644 --- a/src/api/schema.peechy +++ b/src/api/schema.peechy @@ -67,6 +67,8 @@ message TransformOptions { string[] main_fields = 16; Platform platform = 17; + + bool watch = 18; } struct FileHandle { diff --git a/src/api/schema.zig b/src/api/schema.zig index b6f1a47f0..d32b8fb23 100644 --- a/src/api/schema.zig +++ b/src/api/schema.zig @@ -200,6 +200,9 @@ pub const Api = struct { /// platform platform: ?Platform = null, + /// watch + watch: ?bool = null, + pub fn decode(allocator: *std.mem.Allocator, reader: anytype) anyerror!TransformOptions { var obj = std.mem.zeroes(TransformOptions); try update(&obj, allocator, reader); @@ -374,6 +377,9 @@ pub const Api = struct { 17 => { result.platform = try reader.readEnum(Platform, .Little); }, + 18 => { + result.watch = (try reader.readByte()) == @as(u8, 1); + }, else => { return error.InvalidMessage; }, @@ -534,6 +540,11 @@ pub const Api = struct { try writer.writeByte(17); try writer.writeIntNative(@TypeOf(@enumToInt(result.platform orelse unreachable)), @enumToInt(result.platform orelse unreachable)); } + + if (result.watch) |watch| { + try writer.writeByte(18); + try writer.writeByte(@boolToInt(watch)); + } try writer.writeByte(0); return; } |