aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-27 03:29:36 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-27 03:29:53 -0800
commit805e87eeb6a2c77a35c779f6d50cdbf49291f988 (patch)
tree1137c59a2528c7fc1b3a637225b26abb16c16022
parent8dc1140f43314c9f7b3f1a7a1db838d465e000c9 (diff)
downloadbun-805e87eeb6a2c77a35c779f6d50cdbf49291f988.tar.gz
bun-805e87eeb6a2c77a35c779f6d50cdbf49291f988.tar.zst
bun-805e87eeb6a2c77a35c779f6d50cdbf49291f988.zip
Add a comment
-rw-r--r--src/bun.js/javascript.zig24
-rw-r--r--src/watcher.zig10
2 files changed, 14 insertions, 20 deletions
diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig
index 1a0b7783f..7ff935f0b 100644
--- a/src/bun.js/javascript.zig
+++ b/src/bun.js/javascript.zig
@@ -2776,18 +2776,8 @@ pub const HotReloader = struct {
if (this.verbose)
Output.prettyErrorln("<r><d>File changed: {s}<r>", .{fs.relativeTo(file_path)});
- if (comptime Environment.isMac) {
- // kqueue will report one of these if you rename, delete, or write to a file descriptor
- // since it's a file descriptor and not a file path, the
- // file descriptor will need to be closed for some
- // changes to be reflected
- if (event.op.write or event.op.delete or event.op.rename) {
- current_task.append(id);
- }
- } else {
- if (event.op.write) {
- current_task.append(id);
- }
+ if (event.op.write or event.op.delete or event.op.rename) {
+ current_task.append(id);
}
},
.directory => {
@@ -2888,19 +2878,13 @@ pub const HotReloader = struct {
last_file_hash = file_hash;
if (this.verbose)
- Output.prettyErrorln("<r> <d>File change: {s}<r>", .{fs.relativeTo(abs_path)});
+ Output.prettyErrorln("<r> <d>File change: {s}<r>", .{fs.relativeTo(abs_path)});
}
}
}
if (this.verbose) {
- // if (event.op.delete or event.op.rename)
- // ctx.watcher.removeAtIndex(event.index, hashes[event.index], parent_hashes, .directory);
- if (comptime false) {
- Output.prettyErrorln("<r>📁 <d>Dir change: {s}<r>", .{fs.relativeTo(file_path)});
- } else {
- Output.prettyErrorln("<r> <d>Dir change: {s}<r>", .{fs.relativeTo(file_path)});
- }
+ Output.prettyErrorln("<r> <d>Dir change: {s}<r>", .{fs.relativeTo(file_path)});
}
},
}
diff --git a/src/watcher.zig b/src/watcher.zig
index e51dad72e..5f02652d2 100644
--- a/src/watcher.zig
+++ b/src/watcher.zig
@@ -163,6 +163,16 @@ pub const INotify = struct {
}
}
+ // This is what replit does as of Jaunary 2023.
+ // 1) CREATE .http.ts.3491171321~
+ // 2) OPEN .http.ts.3491171321~
+ // 3) ATTRIB .http.ts.3491171321~
+ // 4) MODIFY .http.ts.3491171321~
+ // 5) CLOSE_WRITE,CLOSE .http.ts.3491171321~
+ // 6) MOVED_FROM .http.ts.3491171321~
+ // 7) MOVED_TO http.ts
+ // We still don't correctly handle MOVED_FROM && MOVED_TO it seems.
+
var count: u32 = 0;
var i: u32 = 0;
while (i < len) : (i += @sizeOf(INotifyEvent)) {