mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 20:39:05 +00:00
various bug fixes
This commit is contained in:
17
.vscode/launch.json
vendored
17
.vscode/launch.json
vendored
@@ -10,6 +10,23 @@
|
||||
"args": ["/usr/local/bin/zig"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "Dev Launch",
|
||||
"program": "${workspaceFolder}/build/bin/debug/esdev",
|
||||
"preLaunchTask": "build",
|
||||
"args": [
|
||||
"--resolve=dev",
|
||||
"--cwd",
|
||||
"./src/test",
|
||||
"./fixtures/for-loop-bug",
|
||||
"-o",
|
||||
"out"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "internalConsole"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
3
.vscode/tasks.json
vendored
3
.vscode/tasks.json
vendored
@@ -4,7 +4,8 @@
|
||||
{
|
||||
"label": "build",
|
||||
"type": "process",
|
||||
"command": "zig build",
|
||||
"command": "zig",
|
||||
"args": ["build"],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
|
||||
@@ -72,6 +72,11 @@ pub const Bundler = struct {
|
||||
|
||||
var entry_points = try allocator.alloc(Resolver.Resolver.Result, bundler.options.entry_points.len);
|
||||
|
||||
if (isDebug) {
|
||||
log.level = .verbose;
|
||||
bundler.resolver.debug_logs = try Resolver.Resolver.DebugLogs.init(allocator);
|
||||
}
|
||||
|
||||
var entry_point_i: usize = 0;
|
||||
for (bundler.options.entry_points) |entry| {
|
||||
const result = bundler.resolver.resolve(bundler.fs.top_level_dir, entry, .entry_point) catch {
|
||||
@@ -87,6 +92,12 @@ pub const Bundler = struct {
|
||||
entry_point_i += 1;
|
||||
}
|
||||
|
||||
if (isDebug) {
|
||||
for (log.msgs.items) |msg| {
|
||||
try msg.writeFormat(std.io.getStdOut().writer());
|
||||
}
|
||||
}
|
||||
|
||||
switch (bundler.options.resolve_mode) {
|
||||
.lazy, .dev, .bundle => {},
|
||||
else => Global.panic("Unsupported resolve mode: {s}", .{@tagName(bundler.options.resolve_mode)}),
|
||||
|
||||
@@ -386,7 +386,7 @@ pub const FileSystem = struct {
|
||||
|
||||
// First, check the cache
|
||||
if (fs.entries.get(dir)) |_dir| {
|
||||
return EntriesOption{ .entries = _dir.entries };
|
||||
return _dir;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,15 +140,22 @@ pub const Msg = struct {
|
||||
msg: *const Msg,
|
||||
to: anytype,
|
||||
) !void {
|
||||
try std.fmt.format(to, "\n\n{s}: {s}\n{s}\n{s}:{}:{} {d}", .{
|
||||
msg.kind.string(),
|
||||
msg.data.text,
|
||||
msg.data.location.?.line_text,
|
||||
msg.data.location.?.file,
|
||||
msg.data.location.?.line,
|
||||
msg.data.location.?.column,
|
||||
msg.data.location.?.offset,
|
||||
});
|
||||
if (msg.data.location) |location| {
|
||||
try std.fmt.format(to, "\n\n{s}: {s}\n{s}\n{s}:{}:{} {d}", .{
|
||||
msg.kind.string(),
|
||||
msg.data.text,
|
||||
location.line_text,
|
||||
location.file,
|
||||
location.line,
|
||||
location.column,
|
||||
location.offset,
|
||||
});
|
||||
} else {
|
||||
try std.fmt.format(to, "\n\n{s}: {s}\n", .{
|
||||
msg.kind.string(),
|
||||
msg.data.text,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
pub fn doFormat(msg: *const Msg, to: anytype, formatterFunc: anytype) !void {
|
||||
|
||||
@@ -151,7 +151,7 @@ pub const Resolver = struct {
|
||||
if (len > 0) {
|
||||
var __text = try d.notes.allocator.alloc(u8, text.len + len);
|
||||
std.mem.copy(u8, __text, d.indent.list.items);
|
||||
std.mem.copy(u8, __text[len..text.len], _text);
|
||||
std.mem.copy(u8, __text[len..__text.len], _text);
|
||||
d.notes.allocator.free(_text);
|
||||
}
|
||||
|
||||
@@ -1197,7 +1197,7 @@ pub const Resolver = struct {
|
||||
debug.addNoteFmt("Found file \"{s}\" ", .{base}) catch {};
|
||||
}
|
||||
|
||||
return LoadResult{ .path = base, .diff_case = query.diff_case };
|
||||
return LoadResult{ .path = path, .diff_case = query.diff_case };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1211,7 +1211,7 @@ pub const Resolver = struct {
|
||||
debug.addNoteFmt("Checking for file \"{s}{s}\" ", .{ base, ext }) catch {};
|
||||
}
|
||||
|
||||
if (entries.get(buffer)) |query| {
|
||||
if (entries.get(buffer[path.len - base.len .. buffer.len])) |query| {
|
||||
if (query.entry.kind(rfs) == .file) {
|
||||
if (r.debug_logs) |*debug| {
|
||||
debug.addNoteFmt("Found file \"{s}\" ", .{buffer}) catch {};
|
||||
|
||||
Reference in New Issue
Block a user