Skip to content

Commit 068ef9f

Browse files
committed
Merge remote-tracking branch 'origin/main' into jarred/repro-23333
2 parents fe724c6 + d17134f commit 068ef9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1474
-894
lines changed

src/StandaloneModuleGraph.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,10 @@ pub const StandaloneModuleGraph = struct {
540540

541541
pub fn inject(bytes: []const u8, self_exe: [:0]const u8, inject_options: InjectOptions, target: *const CompileTarget) bun.FileDescriptor {
542542
var buf: bun.PathBuffer = undefined;
543-
var zname: [:0]const u8 = bun.span(bun.fs.FileSystem.instance.tmpname("bun-build", &buf, @as(u64, @bitCast(std.time.milliTimestamp()))) catch |err| {
543+
var zname: [:0]const u8 = bun.fs.FileSystem.tmpname("bun-build", &buf, @as(u64, @bitCast(std.time.milliTimestamp()))) catch |err| {
544544
Output.prettyErrorln("<r><red>error<r><d>:<r> failed to get temporary file name: {s}", .{@errorName(err)});
545545
return bun.invalid_fd;
546-
});
546+
};
547547

548548
const cleanup = struct {
549549
pub fn toClean(name: [:0]const u8, fd: bun.FileDescriptor) void {

src/bun.js/ModuleLoader.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn resolveEmbeddedFile(vm: *VirtualMachine, input_path: []const u8, extname:
3838

3939
// atomically write to a tmpfile and then move it to the final destination
4040
var tmpname_buf: bun.PathBuffer = undefined;
41-
const tmpfilename = bun.sliceTo(bun.fs.FileSystem.instance.tmpname(extname, &tmpname_buf, bun.hash(file.name)) catch return null, 0);
41+
const tmpfilename = bun.fs.FileSystem.tmpname(extname, &tmpname_buf, bun.hash(file.name)) catch return null;
4242

4343
const tmpdir: bun.FD = .fromStdDir(bun.fs.FileSystem.instance.tmpdir() catch return null);
4444

src/bun.js/RuntimeTranspilerCache.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub const RuntimeTranspilerCache = struct {
163163

164164
// atomically write to a tmpfile and then move it to the final destination
165165
var tmpname_buf: bun.PathBuffer = undefined;
166-
const tmpfilename = bun.sliceTo(try bun.fs.FileSystem.instance.tmpname(std.fs.path.extension(destination_path.slice()), &tmpname_buf, input_hash), 0);
166+
const tmpfilename = try bun.fs.FileSystem.tmpname(std.fs.path.extension(destination_path.slice()), &tmpname_buf, input_hash);
167167

168168
const output_bytes = output_code.byteSlice();
169169

src/bun.js/test/Collection.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn init(gpa: std.mem.Allocator, bun_test_root: *bun_test.BunTestRoot) Collec
2727
.name = null,
2828
.concurrent = false,
2929
.mode = .normal,
30-
.only = .no,
30+
.only = if (jsc.Jest.Jest.runner) |runner| if (runner.only) .contains else .no else .no,
3131
.has_callback = false,
3232
.test_id_for_debugger = 0,
3333
.line_no = 0,

src/cli/Arguments.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ pub const test_only_params = [_]ParamType{
196196
clap.parseParam("-u, --update-snapshots Update snapshot files") catch unreachable,
197197
clap.parseParam("--rerun-each <NUMBER> Re-run each test file <NUMBER> times, helps catch certain bugs") catch unreachable,
198198
clap.parseParam("--todo Include tests that are marked with \"test.todo()\"") catch unreachable,
199+
clap.parseParam("--only Run only tests that are marked with \"test.only()\" or \"describe.only()\"") catch unreachable,
199200
clap.parseParam("--concurrent Treat all tests as `test.concurrent()` tests") catch unreachable,
200201
clap.parseParam("--randomize Run tests in random order") catch unreachable,
201202
clap.parseParam("--seed <INT> Set the random seed for test randomization") catch unreachable,
@@ -507,6 +508,7 @@ pub fn parse(allocator: std.mem.Allocator, ctx: Command.Context, comptime cmd: C
507508
}
508509
ctx.test_options.update_snapshots = args.flag("--update-snapshots");
509510
ctx.test_options.run_todo = args.flag("--todo");
511+
ctx.test_options.only = args.flag("--only");
510512
ctx.test_options.concurrent = args.flag("--concurrent");
511513
ctx.test_options.randomize = args.flag("--randomize");
512514

src/compile_target.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ pub fn downloadToPath(this: *const CompileTarget, env: *bun.DotEnv.Loader, alloc
248248

249249
const libarchive = bun.libarchive;
250250
var tmpname_buf: [1024]u8 = undefined;
251-
const tempdir_name = bun.span(try bun.fs.FileSystem.instance.tmpname("tmp", &tmpname_buf, bun.fastRandom()));
251+
const tempdir_name = try bun.fs.FileSystem.tmpname("tmp", &tmpname_buf, bun.fastRandom());
252252
var tmpdir = try std.fs.cwd().makeOpenPath(tempdir_name, .{});
253253
defer tmpdir.close();
254254
defer std.fs.cwd().deleteTree(tempdir_name) catch {};

src/fs.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub const FileSystem = struct {
4747
}
4848

4949
var tmpname_id_number = std.atomic.Value(u32).init(0);
50-
pub fn tmpname(_: *const FileSystem, extname: string, buf: []u8, hash: u64) ![*:0]u8 {
50+
pub fn tmpname(extname: string, buf: []u8, hash: u64) std.fmt.BufPrintError![:0]u8 {
5151
const hex_value = @as(u64, @truncate(@as(u128, @intCast(hash)) | @as(u128, @intCast(std.time.nanoTimestamp()))));
5252

5353
return try std.fmt.bufPrintZ(buf, ".{any}-{any}.{s}", .{

src/install/PackageInstaller.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ pub const PackageInstaller = struct {
121121

122122
return (try bun.sys.openDirAtWindowsA(.fromStdDir(root), this.path.items, .{
123123
.can_rename_or_delete = false,
124-
.create = false,
125124
.read_only = false,
126125
}).unwrap()).stdDir();
127126
}
@@ -132,11 +131,9 @@ pub const PackageInstaller = struct {
132131
break :brk try root.makeOpenPath(this.path.items, .{ .iterate = true, .access_sub_paths = true });
133132
}
134133

135-
// TODO: is this `makePath` necessary with `.create = true` below
136-
try bun.MakePath.makePath(u8, root, this.path.items);
137134
break :brk (try bun.sys.openDirAtWindowsA(.fromStdDir(root), this.path.items, .{
138135
.can_rename_or_delete = false,
139-
.create = true,
136+
.op = .open_or_create,
140137
.read_only = false,
141138
}).unwrap()).stdDir();
142139
};

src/install/PackageManager.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ var ensureTempNodeGypScriptOnce = bun.once(struct {
454454

455455
const tempdir = manager.getTemporaryDirectory();
456456
var path_buf: bun.PathBuffer = undefined;
457-
const node_gyp_tempdir_name = bun.span(try Fs.FileSystem.instance.tmpname("node-gyp", &path_buf, 12345));
457+
const node_gyp_tempdir_name = try Fs.FileSystem.tmpname("node-gyp", &path_buf, 12345);
458458

459459
// used later for adding to path for scripts
460460
manager.node_gyp_tempdir_name = try manager.allocator.dupe(u8, node_gyp_tempdir_name);

src/install/PackageManager/PackageManagerDirectories.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var getTemporaryDirectoryOnce = bun.once(struct {
4141
};
4242
};
4343
var tmpbuf: bun.PathBuffer = undefined;
44-
const tmpname = Fs.FileSystem.instance.tmpname("hm", &tmpbuf, bun.fastRandom()) catch unreachable;
44+
const tmpname = Fs.FileSystem.tmpname("hm", &tmpbuf, bun.fastRandom()) catch unreachable;
4545
var timer: std.time.Timer = if (manager.options.log_level != .silent) std.time.Timer.start() catch unreachable else undefined;
4646
brk: while (true) {
4747
var file = tempdir.createFileZ(tmpname, .{ .truncate = true }) catch |err2| {

0 commit comments

Comments
 (0)