mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
rename _global -> bun
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
const std = @import("std");
|
||||
const _global = @import("../../../global.zig");
|
||||
const strings = _global.strings;
|
||||
const string = _global.string;
|
||||
const bun = @import("../../../global.zig");
|
||||
const strings = bun.strings;
|
||||
const string = bun.string;
|
||||
const AsyncIO = @import("io");
|
||||
const JSC = @import("../../../jsc.zig");
|
||||
const PathString = JSC.PathString;
|
||||
const Environment = _global.Environment;
|
||||
const C = _global.C;
|
||||
const Environment = bun.Environment;
|
||||
const C = bun.C;
|
||||
const Syscall = @import("./syscall.zig");
|
||||
const os = std.os;
|
||||
const Buffer = JSC.ArrayBuffer;
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
// for interacting with the filesystem from JavaScript.
|
||||
// The top-level functions assume the arguments are already validated
|
||||
const std = @import("std");
|
||||
const _global = @import("../../../global.zig");
|
||||
const strings = _global.strings;
|
||||
const string = _global.string;
|
||||
const bun = @import("../../../global.zig");
|
||||
const strings = bun.strings;
|
||||
const string = bun.string;
|
||||
const AsyncIO = @import("io");
|
||||
const JSC = @import("../../../jsc.zig");
|
||||
const PathString = JSC.PathString;
|
||||
const Environment = _global.Environment;
|
||||
const C = _global.C;
|
||||
const Environment = bun.Environment;
|
||||
const C = bun.C;
|
||||
const Flavor = JSC.Node.Flavor;
|
||||
const system = std.os.system;
|
||||
const Maybe = JSC.Node.Maybe;
|
||||
@@ -2417,7 +2417,7 @@ pub const NodeFS = struct {
|
||||
/// We want to avoid allocating a new path buffer for every error message so that JSC can clone + GC it.
|
||||
/// That means a stack-allocated buffer won't suffice. Instead, we re-use
|
||||
/// the heap allocated buffer on the NodefS struct
|
||||
sync_error_buf: [_global.MAX_PATH_BYTES]u8 = undefined,
|
||||
sync_error_buf: [bun.MAX_PATH_BYTES]u8 = undefined,
|
||||
|
||||
pub const ReturnType = Return;
|
||||
|
||||
@@ -2506,8 +2506,8 @@ pub const NodeFS = struct {
|
||||
|
||||
switch (comptime flavor) {
|
||||
.sync => {
|
||||
var src_buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var dest_buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var src_buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
var dest_buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
var src = args.src.sliceZ(&src_buf);
|
||||
var dest = args.dest.sliceZ(&dest_buf);
|
||||
|
||||
@@ -2776,7 +2776,7 @@ pub const NodeFS = struct {
|
||||
return Maybe(Return.Lchown).todo;
|
||||
}
|
||||
pub fn link(this: *NodeFS, args: Arguments.Link, comptime flavor: Flavor) Maybe(Return.Link) {
|
||||
var new_path_buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var new_path_buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
const from = args.old_path.sliceZ(&this.sync_error_buf);
|
||||
const to = args.new_path.sliceZ(&new_path_buf);
|
||||
|
||||
@@ -2846,7 +2846,7 @@ pub const NodeFS = struct {
|
||||
switch (comptime flavor) {
|
||||
// The sync version does no allocation except when returning the path
|
||||
.sync => {
|
||||
var buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
const path = args.path.sliceZWithForceCopy(&buf, true);
|
||||
const len = @truncate(u16, path.len);
|
||||
|
||||
@@ -2942,7 +2942,7 @@ pub const NodeFS = struct {
|
||||
var display_path: []const u8 = "";
|
||||
if (first_match != std.math.maxInt(u16)) {
|
||||
// TODO: this leaks memory
|
||||
display_path = _global.default_allocator.dupe(u8, display_path[0..first_match]) catch unreachable;
|
||||
display_path = bun.default_allocator.dupe(u8, display_path[0..first_match]) catch unreachable;
|
||||
}
|
||||
return Option{ .result = display_path };
|
||||
},
|
||||
@@ -2957,7 +2957,7 @@ pub const NodeFS = struct {
|
||||
var display_path = args.path.slice();
|
||||
if (first_match != std.math.maxInt(u16)) {
|
||||
// TODO: this leaks memory
|
||||
display_path = _global.default_allocator.dupe(u8, display_path[0..first_match]) catch unreachable;
|
||||
display_path = bun.default_allocator.dupe(u8, display_path[0..first_match]) catch unreachable;
|
||||
}
|
||||
return Option{ .result = display_path };
|
||||
},
|
||||
@@ -2990,7 +2990,7 @@ pub const NodeFS = struct {
|
||||
_ = this;
|
||||
_ = flavor;
|
||||
return .{
|
||||
.result = PathString.init(_global.default_allocator.dupe(u8, std.mem.span(rc.?)) catch unreachable),
|
||||
.result = PathString.init(bun.default_allocator.dupe(u8, std.mem.span(rc.?)) catch unreachable),
|
||||
};
|
||||
}
|
||||
pub fn open(this: *NodeFS, args: Arguments.Open, comptime flavor: Flavor) Maybe(Return.Open) {
|
||||
@@ -3198,7 +3198,7 @@ pub const NodeFS = struct {
|
||||
_ = Syscall.close(fd);
|
||||
}
|
||||
|
||||
var entries = std.ArrayList(ExpectedType).init(_global.default_allocator);
|
||||
var entries = std.ArrayList(ExpectedType).init(bun.default_allocator);
|
||||
var dir = std.fs.Dir{ .fd = fd };
|
||||
var iterator = DirIterator.iterate(dir);
|
||||
var entry = iterator.next();
|
||||
@@ -3207,13 +3207,13 @@ pub const NodeFS = struct {
|
||||
for (entries.items) |*item| {
|
||||
switch (comptime ExpectedType) {
|
||||
DirEnt => {
|
||||
_global.default_allocator.free(item.name.slice());
|
||||
bun.default_allocator.free(item.name.slice());
|
||||
},
|
||||
Buffer => {
|
||||
item.destroy();
|
||||
},
|
||||
PathString => {
|
||||
_global.default_allocator.free(item.slice());
|
||||
bun.default_allocator.free(item.slice());
|
||||
},
|
||||
else => unreachable,
|
||||
}
|
||||
@@ -3230,17 +3230,17 @@ pub const NodeFS = struct {
|
||||
switch (comptime ExpectedType) {
|
||||
DirEnt => {
|
||||
entries.append(.{
|
||||
.name = PathString.init(_global.default_allocator.dupe(u8, current.name.slice()) catch unreachable),
|
||||
.name = PathString.init(bun.default_allocator.dupe(u8, current.name.slice()) catch unreachable),
|
||||
.kind = current.kind,
|
||||
}) catch unreachable;
|
||||
},
|
||||
Buffer => {
|
||||
const slice = current.name.slice();
|
||||
entries.append(Buffer.fromString(slice, _global.default_allocator) catch unreachable) catch unreachable;
|
||||
entries.append(Buffer.fromString(slice, bun.default_allocator) catch unreachable) catch unreachable;
|
||||
},
|
||||
PathString => {
|
||||
entries.append(
|
||||
PathString.init(_global.default_allocator.dupe(u8, current.name.slice()) catch unreachable),
|
||||
PathString.init(bun.default_allocator.dupe(u8, current.name.slice()) catch unreachable),
|
||||
) catch unreachable;
|
||||
},
|
||||
else => unreachable,
|
||||
@@ -3291,7 +3291,7 @@ pub const NodeFS = struct {
|
||||
};
|
||||
|
||||
const size = @intCast(u64, @maximum(stat_.size, 0));
|
||||
var buf = std.ArrayList(u8).init(_global.default_allocator);
|
||||
var buf = std.ArrayList(u8).init(bun.default_allocator);
|
||||
buf.ensureTotalCapacity(size + 16) catch unreachable;
|
||||
buf.expandToCapacity();
|
||||
var total: usize = 0;
|
||||
@@ -3320,7 +3320,7 @@ pub const NodeFS = struct {
|
||||
return switch (args.encoding) {
|
||||
.buffer => .{
|
||||
.result = .{
|
||||
.buffer = Buffer.fromBytes(buf.items, _global.default_allocator, .Uint8Array),
|
||||
.buffer = Buffer.fromBytes(buf.items, bun.default_allocator, .Uint8Array),
|
||||
},
|
||||
},
|
||||
else => .{
|
||||
@@ -3393,7 +3393,7 @@ pub const NodeFS = struct {
|
||||
}
|
||||
|
||||
pub fn readlink(this: *NodeFS, args: Arguments.Readlink, comptime flavor: Flavor) Maybe(Return.Readlink) {
|
||||
var outbuf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var outbuf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
var inbuf = &this.sync_error_buf;
|
||||
switch (comptime flavor) {
|
||||
.sync => {
|
||||
@@ -3409,10 +3409,10 @@ pub const NodeFS = struct {
|
||||
return .{
|
||||
.result = switch (args.encoding) {
|
||||
.buffer => .{
|
||||
.buffer = Buffer.fromString(outbuf[0..len], _global.default_allocator) catch unreachable,
|
||||
.buffer = Buffer.fromString(outbuf[0..len], bun.default_allocator) catch unreachable,
|
||||
},
|
||||
else => .{
|
||||
.string = _global.default_allocator.dupe(u8, outbuf[0..len]) catch unreachable,
|
||||
.string = bun.default_allocator.dupe(u8, outbuf[0..len]) catch unreachable,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -3426,7 +3426,7 @@ pub const NodeFS = struct {
|
||||
return Maybe(Return.Readlink).todo;
|
||||
}
|
||||
pub fn realpath(this: *NodeFS, args: Arguments.Realpath, comptime flavor: Flavor) Maybe(Return.Realpath) {
|
||||
var outbuf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var outbuf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
var inbuf = &this.sync_error_buf;
|
||||
if (comptime Environment.allow_assert) std.debug.assert(FileSystem.instance_loaded);
|
||||
|
||||
@@ -3466,10 +3466,10 @@ pub const NodeFS = struct {
|
||||
return .{
|
||||
.result = switch (args.encoding) {
|
||||
.buffer => .{
|
||||
.buffer = Buffer.fromString(buf, _global.default_allocator) catch unreachable,
|
||||
.buffer = Buffer.fromString(buf, bun.default_allocator) catch unreachable,
|
||||
},
|
||||
else => .{
|
||||
.string = _global.default_allocator.dupe(u8, buf) catch unreachable,
|
||||
.string = bun.default_allocator.dupe(u8, buf) catch unreachable,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -3491,7 +3491,7 @@ pub const NodeFS = struct {
|
||||
// }
|
||||
pub fn rename(this: *NodeFS, args: Arguments.Rename, comptime flavor: Flavor) Maybe(Return.Rename) {
|
||||
var from_buf = &this.sync_error_buf;
|
||||
var to_buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var to_buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
|
||||
switch (comptime flavor) {
|
||||
.sync => {
|
||||
@@ -3550,7 +3550,7 @@ pub const NodeFS = struct {
|
||||
}
|
||||
|
||||
pub fn symlink(this: *NodeFS, args: Arguments.Symlink, comptime flavor: Flavor) Maybe(Return.Symlink) {
|
||||
var to_buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var to_buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
|
||||
switch (comptime flavor) {
|
||||
.sync => {
|
||||
@@ -3684,7 +3684,7 @@ pub const NodeFS = struct {
|
||||
_ = args;
|
||||
_ = this;
|
||||
_ = flavor;
|
||||
var stream = _global.default_allocator.create(JSC.Node.Stream) catch unreachable;
|
||||
var stream = bun.default_allocator.create(JSC.Node.Stream) catch unreachable;
|
||||
stream.* = JSC.Node.Stream{
|
||||
.sink = .{
|
||||
.readable = JSC.Node.Readable{
|
||||
@@ -3695,10 +3695,10 @@ pub const NodeFS = struct {
|
||||
.sink_type = .readable,
|
||||
.content = undefined,
|
||||
.content_type = undefined,
|
||||
.allocator = _global.default_allocator,
|
||||
.allocator = bun.default_allocator,
|
||||
};
|
||||
|
||||
args.file.copyToStream(args.flags, args.autoClose, args.mode, _global.default_allocator, stream) catch unreachable;
|
||||
args.file.copyToStream(args.flags, args.autoClose, args.mode, bun.default_allocator, stream) catch unreachable;
|
||||
args.copyToState(&stream.sink.readable.state);
|
||||
return Maybe(Return.CreateReadStream){ .result = stream };
|
||||
}
|
||||
@@ -3706,7 +3706,7 @@ pub const NodeFS = struct {
|
||||
_ = args;
|
||||
_ = this;
|
||||
_ = flavor;
|
||||
var stream = _global.default_allocator.create(JSC.Node.Stream) catch unreachable;
|
||||
var stream = bun.default_allocator.create(JSC.Node.Stream) catch unreachable;
|
||||
stream.* = JSC.Node.Stream{
|
||||
.sink = .{
|
||||
.writable = JSC.Node.Writable{
|
||||
@@ -3717,9 +3717,9 @@ pub const NodeFS = struct {
|
||||
.sink_type = .writable,
|
||||
.content = undefined,
|
||||
.content_type = undefined,
|
||||
.allocator = _global.default_allocator,
|
||||
.allocator = bun.default_allocator,
|
||||
};
|
||||
args.file.copyToStream(args.flags, args.autoClose, args.mode, _global.default_allocator, stream) catch unreachable;
|
||||
args.file.copyToStream(args.flags, args.autoClose, args.mode, bun.default_allocator, stream) catch unreachable;
|
||||
args.copyToState(&stream.sink.writable.state);
|
||||
return Maybe(Return.CreateWriteStream){ .result = stream };
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ const default_allocator = @import("../../../global.zig").default_allocator;
|
||||
const JSC = @import("../../../jsc.zig");
|
||||
const SystemError = JSC.SystemError;
|
||||
const darwin = os.darwin;
|
||||
const _global = @import("../../../global.zig");
|
||||
const MAX_PATH_BYTES = _global.MAX_PATH_BYTES;
|
||||
const fd_t = _global.FileDescriptorType;
|
||||
const bun = @import("../../../global.zig");
|
||||
const MAX_PATH_BYTES = bun.MAX_PATH_BYTES;
|
||||
const fd_t = bun.FileDescriptorType;
|
||||
const C = @import("../../../global.zig").C;
|
||||
const linux = os.linux;
|
||||
const Maybe = JSC.Node.Maybe;
|
||||
@@ -78,12 +78,12 @@ else
|
||||
|
||||
const mem = std.mem;
|
||||
|
||||
pub fn getcwd(buf: *[_global.MAX_PATH_BYTES]u8) Maybe([]const u8) {
|
||||
pub fn getcwd(buf: *[bun.MAX_PATH_BYTES]u8) Maybe([]const u8) {
|
||||
const Result = Maybe([]const u8);
|
||||
buf[0] = 0;
|
||||
const rc = std.c.getcwd(buf, _global.MAX_PATH_BYTES);
|
||||
const rc = std.c.getcwd(buf, bun.MAX_PATH_BYTES);
|
||||
return if (rc != null)
|
||||
Result{ .result = std.mem.sliceTo(rc.?[0.._global.MAX_PATH_BYTES], 0) }
|
||||
Result{ .result = std.mem.sliceTo(rc.?[0..bun.MAX_PATH_BYTES], 0) }
|
||||
else
|
||||
Result.errnoSys(0, .getcwd).?;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const _global = @import("../../../global.zig");
|
||||
const strings = _global.strings;
|
||||
const string = _global.string;
|
||||
const bun = @import("../../../global.zig");
|
||||
const strings = bun.strings;
|
||||
const string = bun.string;
|
||||
const AsyncIO = @import("io");
|
||||
const JSC = @import("../../../jsc.zig");
|
||||
const PathString = JSC.PathString;
|
||||
const Environment = _global.Environment;
|
||||
const C = _global.C;
|
||||
const Environment = bun.Environment;
|
||||
const C = bun.C;
|
||||
const Syscall = @import("./syscall.zig");
|
||||
const os = std.os;
|
||||
const Buffer = JSC.MarkedArrayBuffer;
|
||||
@@ -16,11 +16,11 @@ const logger = @import("../../../logger.zig");
|
||||
const Fs = @import("../../../fs.zig");
|
||||
const Shimmer = @import("../bindings/shimmer.zig").Shimmer;
|
||||
const is_bindgen: bool = std.meta.globalOption("bindgen", bool) orelse false;
|
||||
const meta = _global.meta;
|
||||
const meta = bun.meta;
|
||||
/// Time in seconds. Not nanos!
|
||||
pub const TimeLike = c_int;
|
||||
pub const Mode = if (Environment.isLinux) u32 else std.os.mode_t;
|
||||
const heap_allocator = _global.default_allocator;
|
||||
const heap_allocator = bun.default_allocator;
|
||||
pub fn DeclEnum(comptime T: type) type {
|
||||
const fieldInfos = std.meta.declarations(T);
|
||||
var enumFields: [fieldInfos.len]std.builtin.TypeInfo.EnumField = undefined;
|
||||
@@ -133,7 +133,7 @@ pub const StringOrBuffer = union(Tag) {
|
||||
}
|
||||
|
||||
pub export fn external_string_finalizer(_: ?*anyopaque, _: JSC.C.JSStringRef, buffer: *anyopaque, byteLength: usize) void {
|
||||
_global.default_allocator.free(@ptrCast([*]const u8, buffer)[0..byteLength]);
|
||||
bun.default_allocator.free(@ptrCast([*]const u8, buffer)[0..byteLength]);
|
||||
}
|
||||
|
||||
pub fn toJS(this: StringOrBuffer, ctx: JSC.C.JSContextRef, exception: JSC.C.ExceptionRef) JSC.C.JSValueRef {
|
||||
@@ -250,7 +250,7 @@ pub const PathLike = union(Tag) {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn sliceZWithForceCopy(this: PathLike, buf: *[_global.MAX_PATH_BYTES]u8, comptime force: bool) [:0]const u8 {
|
||||
pub fn sliceZWithForceCopy(this: PathLike, buf: *[bun.MAX_PATH_BYTES]u8, comptime force: bool) [:0]const u8 {
|
||||
var sliced = this.slice();
|
||||
|
||||
if (sliced.len == 0) return "";
|
||||
@@ -267,7 +267,7 @@ pub const PathLike = union(Tag) {
|
||||
return buf[0..sliced.len :0];
|
||||
}
|
||||
|
||||
pub inline fn sliceZ(this: PathLike, buf: *[_global.MAX_PATH_BYTES]u8) [:0]const u8 {
|
||||
pub inline fn sliceZ(this: PathLike, buf: *[bun.MAX_PATH_BYTES]u8) [:0]const u8 {
|
||||
return sliceZWithForceCopy(this, buf, false);
|
||||
}
|
||||
|
||||
@@ -345,11 +345,11 @@ pub const Valid = struct {
|
||||
JSC.throwInvalidArguments("Invalid path string: can't be empty", .{}, ctx, exception);
|
||||
return false;
|
||||
},
|
||||
1..._global.MAX_PATH_BYTES => return true,
|
||||
1...bun.MAX_PATH_BYTES => return true,
|
||||
else => {
|
||||
// TODO: should this be an EINVAL?
|
||||
JSC.throwInvalidArguments(
|
||||
comptime std.fmt.comptimePrint("Invalid path string: path is too long (max: {d})", .{_global.MAX_PATH_BYTES}),
|
||||
comptime std.fmt.comptimePrint("Invalid path string: path is too long (max: {d})", .{bun.MAX_PATH_BYTES}),
|
||||
.{},
|
||||
ctx,
|
||||
exception,
|
||||
@@ -373,14 +373,14 @@ pub const Valid = struct {
|
||||
|
||||
// TODO: should this be an EINVAL?
|
||||
JSC.throwInvalidArguments(
|
||||
comptime std.fmt.comptimePrint("Invalid path buffer: path is too long (max: {d})", .{_global.MAX_PATH_BYTES}),
|
||||
comptime std.fmt.comptimePrint("Invalid path buffer: path is too long (max: {d})", .{bun.MAX_PATH_BYTES}),
|
||||
.{},
|
||||
ctx,
|
||||
exception,
|
||||
);
|
||||
return false;
|
||||
},
|
||||
1..._global.MAX_PATH_BYTES => return true,
|
||||
1...bun.MAX_PATH_BYTES => return true,
|
||||
}
|
||||
|
||||
unreachable;
|
||||
@@ -389,7 +389,7 @@ pub const Valid = struct {
|
||||
|
||||
pub const ArgumentsSlice = struct {
|
||||
remaining: []const JSC.JSValue,
|
||||
arena: std.heap.ArenaAllocator = std.heap.ArenaAllocator.init(_global.default_allocator),
|
||||
arena: std.heap.ArenaAllocator = std.heap.ArenaAllocator.init(bun.default_allocator),
|
||||
all: []const JSC.JSValue,
|
||||
|
||||
pub fn init(arguments: []const JSC.JSValue) ArgumentsSlice {
|
||||
@@ -814,13 +814,13 @@ fn StatsLike(comptime name: string, comptime T: type) type {
|
||||
}
|
||||
|
||||
pub fn toJS(this: Stats, ctx: JSC.C.JSContextRef, _: JSC.C.ExceptionRef) JSC.C.JSValueRef {
|
||||
var _this = _global.default_allocator.create(Stats) catch unreachable;
|
||||
var _this = bun.default_allocator.create(Stats) catch unreachable;
|
||||
_this.* = this;
|
||||
return Class.make(ctx, _this);
|
||||
}
|
||||
|
||||
pub fn finalize(this: *Stats) void {
|
||||
_global.default_allocator.destroy(this);
|
||||
bun.default_allocator.destroy(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -962,8 +962,8 @@ pub const DirEnt = struct {
|
||||
});
|
||||
|
||||
pub fn finalize(this: *DirEnt) void {
|
||||
_global.default_allocator.free(this.name.slice());
|
||||
_global.default_allocator.destroy(this);
|
||||
bun.default_allocator.free(this.name.slice());
|
||||
bun.default_allocator.destroy(this);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1047,11 +1047,11 @@ pub const Emitter = struct {
|
||||
listeners: Map = Map.initFill(Listener.List{}),
|
||||
|
||||
pub fn addListener(this: *EventEmitter, ctx: JSC.C.JSContextRef, event: EventType, listener: Emitter.Listener) !void {
|
||||
try this.listeners.getPtr(event).append(_global.default_allocator, ctx, listener);
|
||||
try this.listeners.getPtr(event).append(bun.default_allocator, ctx, listener);
|
||||
}
|
||||
|
||||
pub fn prependListener(this: *EventEmitter, ctx: JSC.C.JSContextRef, event: EventType, listener: Emitter.Listener) !void {
|
||||
try this.listeners.getPtr(event).prepend(_global.default_allocator, ctx, listener);
|
||||
try this.listeners.getPtr(event).prepend(bun.default_allocator, ctx, listener);
|
||||
}
|
||||
|
||||
pub fn emit(this: *EventEmitter, event: EventType, globalThis: *JSC.JSGlobalObject, value: JSC.JSValue) void {
|
||||
@@ -2198,7 +2198,7 @@ pub const Path = struct {
|
||||
var arena = std.heap.ArenaAllocator.init(heap_allocator);
|
||||
var arena_allocator = arena.allocator();
|
||||
defer arena.deinit();
|
||||
var buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
var to_join = allocator.alloc(string, args_len) catch unreachable;
|
||||
var possibly_utf16 = false;
|
||||
for (args_ptr[0..args_len]) |arg, i| {
|
||||
@@ -2231,7 +2231,7 @@ pub const Path = struct {
|
||||
var zig_str: JSC.ZigString = args_ptr[0].getZigString(globalThis);
|
||||
if (zig_str.len == 0) return JSC.ZigString.init("").toValue(globalThis);
|
||||
|
||||
var buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
var str_slice = zig_str.toSlice(heap_allocator);
|
||||
defer str_slice.deinit();
|
||||
var str = str_slice.slice();
|
||||
@@ -2322,7 +2322,7 @@ pub const Path = struct {
|
||||
heap_allocator,
|
||||
);
|
||||
var allocator = stack_fallback_allocator.get();
|
||||
var out_buf: [_global.MAX_PATH_BYTES * 2]u8 = undefined;
|
||||
var out_buf: [bun.MAX_PATH_BYTES * 2]u8 = undefined;
|
||||
|
||||
var parts = allocator.alloc(string, args_len) catch unreachable;
|
||||
defer allocator.free(parts);
|
||||
@@ -2447,7 +2447,7 @@ pub const Process = struct {
|
||||
}
|
||||
|
||||
pub fn getCwd(globalObject: *JSC.JSGlobalObject) callconv(.C) JSC.JSValue {
|
||||
var buffer: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var buffer: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
switch (Syscall.getcwd(&buffer)) {
|
||||
.err => |err| {
|
||||
return err.toJSC(globalObject);
|
||||
@@ -2467,7 +2467,7 @@ pub const Process = struct {
|
||||
return JSC.toInvalidArguments("path is required", .{}, globalObject.ref());
|
||||
}
|
||||
|
||||
var buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
const slice = to.sliceZBuf(&buf) catch {
|
||||
return JSC.toInvalidArguments("Invalid path", .{}, globalObject.ref());
|
||||
};
|
||||
@@ -2500,14 +2500,14 @@ pub const Process = struct {
|
||||
std.os.exit(@truncate(u8, @intCast(u32, @maximum(code, 0))));
|
||||
}
|
||||
|
||||
pub export const Bun__version: [:0]const u8 = "v" ++ _global.Global.package_json_version;
|
||||
pub export const Bun__versions_mimalloc: [:0]const u8 = _global.Global.versions.mimalloc;
|
||||
pub export const Bun__versions_webkit: [:0]const u8 = _global.Global.versions.webkit;
|
||||
pub export const Bun__versions_libarchive: [:0]const u8 = _global.Global.versions.libarchive;
|
||||
pub export const Bun__versions_picohttpparser: [:0]const u8 = _global.Global.versions.picohttpparser;
|
||||
pub export const Bun__versions_boringssl: [:0]const u8 = _global.Global.versions.boringssl;
|
||||
pub export const Bun__versions_zlib: [:0]const u8 = _global.Global.versions.zlib;
|
||||
pub export const Bun__versions_zig: [:0]const u8 = _global.Global.versions.zig;
|
||||
pub export const Bun__version: [:0]const u8 = "v" ++ bun.Global.package_json_version;
|
||||
pub export const Bun__versions_mimalloc: [:0]const u8 = bun.Global.versions.mimalloc;
|
||||
pub export const Bun__versions_webkit: [:0]const u8 = bun.Global.versions.webkit;
|
||||
pub export const Bun__versions_libarchive: [:0]const u8 = bun.Global.versions.libarchive;
|
||||
pub export const Bun__versions_picohttpparser: [:0]const u8 = bun.Global.versions.picohttpparser;
|
||||
pub export const Bun__versions_boringssl: [:0]const u8 = bun.Global.versions.boringssl;
|
||||
pub export const Bun__versions_zlib: [:0]const u8 = bun.Global.versions.zlib;
|
||||
pub export const Bun__versions_zig: [:0]const u8 = bun.Global.versions.zig;
|
||||
};
|
||||
|
||||
comptime {
|
||||
|
||||
Reference in New Issue
Block a user