diff options
author | 2021-08-23 02:31:06 -0700 | |
---|---|---|
committer | 2021-08-23 02:31:06 -0700 | |
commit | a3cfd26125bbb5fdb2872c1b3d511ccbf6f3fc4c (patch) | |
tree | 811cffdd6d2a3699ffdd026b22c07c9ad528b61b /src | |
parent | 945cd08931d70ada914d14c4ab886fcc4493eac1 (diff) | |
download | bun-a3cfd26125bbb5fdb2872c1b3d511ccbf6f3fc4c.tar.gz bun-a3cfd26125bbb5fdb2872c1b3d511ccbf6f3fc4c.tar.zst bun-a3cfd26125bbb5fdb2872c1b3d511ccbf6f3fc4c.zip |
emoji
Former-commit-id: 812c1222bd62826a9bd829219970332d4b22bcd7
Diffstat (limited to 'src')
-rw-r--r-- | src/http.zig | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/http.zig b/src/http.zig index 4e08af858..316bbb802 100644 --- a/src/http.zig +++ b/src/http.zig @@ -1736,6 +1736,7 @@ pub const Server = struct { events: []watcher.WatchEvent, watchlist: watcher.Watchlist, comptime is_javascript_enabled: bool, + comptime is_emoji_enabled: bool, ) void { var fbs = std.io.fixedBufferStream(&filechange_buf); var writer = ByteApiWriter.init(&fbs); @@ -1750,11 +1751,12 @@ pub const Server = struct { const kinds = slice.items(.kind); const hashes = slice.items(.hash); const parent_hashes = slice.items(.parent_hash); - const fds = slice.items(.fd); var header = fbs.getWritten(); defer ctx.watcher.flushEvictions(); defer Output.flush(); + // It's important that this function does not do any memory allocations + // If this blocks, it can cause cascading bad things to happen for (events) |event| { const file_path = file_paths[event.index]; const update_count = counts[event.index] + 1; @@ -1801,7 +1803,12 @@ pub const Server = struct { RequestContext.WebsocketHandler.broadcast(written_buf) catch |err| { Output.prettyln("Error writing change notification: {s}<r>", .{@errorName(err)}); }; - Output.prettyln("<r><d>Detected edit: {s}<r>", .{ctx.bundler.fs.relativeTo(file_path)}); + + if (comptime is_emoji_enabled) { + Output.prettyln("<r>📜 <d>File change: {s}<r>", .{ctx.bundler.fs.relativeTo(file_path)}); + } else { + Output.prettyln("<r> <d>File change: {s}<r>", .{ctx.bundler.fs.relativeTo(file_path)}); + } } }, .directory => { @@ -1809,11 +1816,14 @@ pub const Server = struct { rfs.bustEntriesCache(file_path); ctx.bundler.resolver.dir_cache.remove(file_path); - if (event.op.delete or event.op.rename) { + if (event.op.delete or event.op.rename) ctx.watcher.removeAtIndex(event.index, hashes[event.index], parent_hashes, .directory); - } - Output.prettyln("<r><d>Folder change: {s}<r>", .{ctx.bundler.fs.relativeTo(file_path)}); + if (comptime is_emoji_enabled) { + Output.prettyln("<r>📁 <d>Dir change: {s}<r>", .{ctx.bundler.fs.relativeTo(file_path)}); + } else { + Output.prettyln("<r> <d>Dir change: {s}<r>", .{ctx.bundler.fs.relativeTo(file_path)}); + } }, } } |