mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
rename _global -> bun
This commit is contained in:
@@ -5,8 +5,8 @@ const http = @import("../../../http.zig");
|
||||
const JavaScript = @import("../javascript.zig");
|
||||
const QueryStringMap = @import("../../../query_string_map.zig").QueryStringMap;
|
||||
const CombinedScanner = @import("../../../query_string_map.zig").CombinedScanner;
|
||||
const _global = @import("../../../global.zig");
|
||||
const string = _global.string;
|
||||
const bun = @import("../../../global.zig");
|
||||
const string = bun.string;
|
||||
const JSC = @import("../../../jsc.zig");
|
||||
const js = JSC.C;
|
||||
const WebCore = @import("../webcore/response.zig");
|
||||
@@ -366,7 +366,7 @@ pub fn createQueryObject(ctx: js.JSContextRef, map: *QueryStringMap, _: js.Excep
|
||||
return value.asRef();
|
||||
}
|
||||
|
||||
threadlocal var entry_point_tempbuf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
threadlocal var entry_point_tempbuf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
pub fn getScriptSrcString(
|
||||
comptime Writer: type,
|
||||
writer: Writer,
|
||||
|
||||
@@ -5,8 +5,8 @@ const http = @import("../../../http.zig");
|
||||
const JavaScript = @import("../javascript.zig");
|
||||
const QueryStringMap = @import("../../../query_string_map.zig").QueryStringMap;
|
||||
const CombinedScanner = @import("../../../query_string_map.zig").CombinedScanner;
|
||||
const _global = @import("../../../global.zig");
|
||||
const string = _global.string;
|
||||
const bun = @import("../../../global.zig");
|
||||
const string = bun.string;
|
||||
const JSC = @import("../../../jsc.zig");
|
||||
const js = JSC.C;
|
||||
const WebCore = @import("../webcore/response.zig");
|
||||
@@ -100,7 +100,7 @@ const TranspilerOptions = struct {
|
||||
};
|
||||
|
||||
// Mimalloc gets unstable if we try to move this to a different thread
|
||||
// threadlocal var transform_buffer: _global.MutableString = undefined;
|
||||
// threadlocal var transform_buffer: bun.MutableString = undefined;
|
||||
// threadlocal var transform_buffer_loaded: bool = false;
|
||||
|
||||
// This is going to be hard to not leak
|
||||
@@ -120,7 +120,7 @@ pub const TransformTask = struct {
|
||||
pub const AsyncTransformEventLoopTask = AsyncTransformTask.EventLoopTask;
|
||||
|
||||
pub fn create(transpiler: *Transpiler, protected_input_value: JSC.C.JSValueRef, globalThis: *JSGlobalObject, input_code: ZigString, loader: Loader) !*AsyncTransformTask {
|
||||
var transform_task = try _global.default_allocator.create(TransformTask);
|
||||
var transform_task = try bun.default_allocator.create(TransformTask);
|
||||
transform_task.* = .{
|
||||
.input_code = input_code,
|
||||
.protected_input_value = if (protected_input_value != null) JSC.JSValue.fromRef(protected_input_value) else @intToEnum(JSC.JSValue, 0),
|
||||
@@ -128,23 +128,23 @@ pub const TransformTask = struct {
|
||||
.global = globalThis,
|
||||
.macro_map = transpiler.transpiler_options.macro_map,
|
||||
.tsconfig = transpiler.transpiler_options.tsconfig,
|
||||
.log = logger.Log.init(_global.default_allocator),
|
||||
.log = logger.Log.init(bun.default_allocator),
|
||||
.loader = loader,
|
||||
};
|
||||
transform_task.bundler = transpiler.bundler;
|
||||
transform_task.bundler.linker.resolver = &transform_task.bundler.resolver;
|
||||
|
||||
transform_task.bundler.setLog(&transform_task.log);
|
||||
transform_task.bundler.setAllocator(_global.default_allocator);
|
||||
return try AsyncTransformTask.createOnJSThread(_global.default_allocator, globalThis, transform_task);
|
||||
transform_task.bundler.setAllocator(bun.default_allocator);
|
||||
return try AsyncTransformTask.createOnJSThread(bun.default_allocator, globalThis, transform_task);
|
||||
}
|
||||
|
||||
pub fn run(this: *TransformTask) void {
|
||||
const name = this.loader.stdinName();
|
||||
const source = logger.Source.initPathString(name, this.input_code.slice());
|
||||
|
||||
JSAst.Stmt.Data.Store.create(_global.default_allocator);
|
||||
JSAst.Expr.Data.Store.create(_global.default_allocator);
|
||||
JSAst.Stmt.Data.Store.create(bun.default_allocator);
|
||||
JSAst.Expr.Data.Store.create(bun.default_allocator);
|
||||
|
||||
var arena = Mimalloc.Arena.init() catch unreachable;
|
||||
|
||||
@@ -221,7 +221,7 @@ pub const TransformTask = struct {
|
||||
if (!this.log.hasAny()) {
|
||||
break :brk JSC.JSValue.fromRef(JSC.BuildError.create(
|
||||
this.global,
|
||||
_global.default_allocator,
|
||||
bun.default_allocator,
|
||||
logger.Msg{
|
||||
.data = logger.Data{ .text = std.mem.span(@errorName(err)) },
|
||||
},
|
||||
@@ -229,7 +229,7 @@ pub const TransformTask = struct {
|
||||
}
|
||||
}
|
||||
|
||||
break :brk this.log.toJS(this.global, _global.default_allocator, "Transform failed");
|
||||
break :brk this.log.toJS(this.global, bun.default_allocator, "Transform failed");
|
||||
};
|
||||
|
||||
promise.reject(this.global, error_value);
|
||||
@@ -250,7 +250,7 @@ pub const TransformTask = struct {
|
||||
|
||||
pub fn deinit(this: *TransformTask) void {
|
||||
var should_cleanup = false;
|
||||
defer if (should_cleanup) _global.Global.mimalloc_cleanup(false);
|
||||
defer if (should_cleanup) bun.Global.mimalloc_cleanup(false);
|
||||
|
||||
this.log.deinit();
|
||||
if (this.input_code.isGloballyAllocated()) {
|
||||
@@ -262,7 +262,7 @@ pub const TransformTask = struct {
|
||||
this.output_code.deinitGlobal();
|
||||
}
|
||||
|
||||
_global.default_allocator.destroy(this);
|
||||
bun.default_allocator.destroy(this);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -589,8 +589,8 @@ pub fn finalize(
|
||||
this.buffer_writer.?.buffer.deinit();
|
||||
}
|
||||
|
||||
// _global.default_allocator.free(this.transpiler_options.tsconfig_buf);
|
||||
// _global.default_allocator.free(this.transpiler_options.macros_buf);
|
||||
// bun.default_allocator.free(this.transpiler_options.tsconfig_buf);
|
||||
// bun.default_allocator.free(this.transpiler_options.macros_buf);
|
||||
this.arena.deinit();
|
||||
}
|
||||
|
||||
@@ -852,7 +852,7 @@ pub fn transformSync(
|
||||
buffer_writer.reset();
|
||||
var printer = JSPrinter.BufferPrinter.init(buffer_writer);
|
||||
_ = this.bundler.print(parse_result, @TypeOf(&printer), &printer, .esm_ascii) catch |err| {
|
||||
JSC.JSError(_global.default_allocator, "Failed to print code: {s}", .{@errorName(err)}, ctx, exception);
|
||||
JSC.JSError(bun.default_allocator, "Failed to print code: {s}", .{@errorName(err)}, ctx, exception);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
pub const js = @import("../../jsc.zig").C;
|
||||
const std = @import("std");
|
||||
const _global = @import("../../global.zig");
|
||||
const string = _global.string;
|
||||
const Output = _global.Output;
|
||||
const Global = _global.Global;
|
||||
const Environment = _global.Environment;
|
||||
const strings = _global.strings;
|
||||
const MutableString = _global.MutableString;
|
||||
const stringZ = _global.stringZ;
|
||||
const default_allocator = _global.default_allocator;
|
||||
const C = _global.C;
|
||||
const bun = @import("../../global.zig");
|
||||
const string = bun.string;
|
||||
const Output = bun.Output;
|
||||
const Global = bun.Global;
|
||||
const Environment = bun.Environment;
|
||||
const strings = bun.strings;
|
||||
const MutableString = bun.MutableString;
|
||||
const stringZ = bun.stringZ;
|
||||
const default_allocator = bun.default_allocator;
|
||||
const C = bun.C;
|
||||
const JavaScript = @import("./javascript.zig");
|
||||
const ResolveError = JavaScript.ResolveError;
|
||||
const BuildError = JavaScript.BuildError;
|
||||
@@ -156,9 +156,9 @@ pub const To = struct {
|
||||
var zig_strings: []ZigString = if (value.len < 32)
|
||||
&zig_strings_buf
|
||||
else
|
||||
(_global.default_allocator.alloc(ZigString, value.len) catch unreachable);
|
||||
(bun.default_allocator.alloc(ZigString, value.len) catch unreachable);
|
||||
defer if (zig_strings.ptr != &zig_strings_buf)
|
||||
_global.default_allocator.free(zig_strings);
|
||||
bun.default_allocator.free(zig_strings);
|
||||
|
||||
for (value) |path_string, i| {
|
||||
if (comptime Type == []const PathString) {
|
||||
@@ -173,12 +173,12 @@ pub const To = struct {
|
||||
if (clone) {
|
||||
for (value) |path_string| {
|
||||
if (comptime Type == []const PathString) {
|
||||
_global.default_allocator.free(path_string.slice());
|
||||
bun.default_allocator.free(path_string.slice());
|
||||
} else {
|
||||
_global.default_allocator.free(path_string);
|
||||
bun.default_allocator.free(path_string);
|
||||
}
|
||||
}
|
||||
_global.default_allocator.free(value);
|
||||
bun.default_allocator.free(value);
|
||||
}
|
||||
|
||||
return array;
|
||||
@@ -227,8 +227,8 @@ pub const To = struct {
|
||||
}
|
||||
|
||||
{
|
||||
var array = _global.default_allocator.alloc(JSC.C.JSValueRef, value.len) catch unreachable;
|
||||
defer _global.default_allocator.free(array);
|
||||
var array = bun.default_allocator.alloc(JSC.C.JSValueRef, value.len) catch unreachable;
|
||||
defer bun.default_allocator.free(array);
|
||||
var i: usize = 0;
|
||||
while (i < value.len and exception.* == null) : (i += 1) {
|
||||
array[i] = if (comptime Child == JSC.C.JSValueRef)
|
||||
@@ -271,7 +271,7 @@ pub const To = struct {
|
||||
}
|
||||
|
||||
if (comptime !@hasDecl(Type, "toJS")) {
|
||||
var val = _global.default_allocator.create(Type) catch unreachable;
|
||||
var val = bun.default_allocator.create(Type) catch unreachable;
|
||||
val.* = value;
|
||||
return Type.Class.make(context, val);
|
||||
}
|
||||
@@ -841,6 +841,7 @@ pub const ClassOptions = struct {
|
||||
|
||||
// work around a comptime bug
|
||||
|
||||
const _to_json: stringZ = "toJSON";
|
||||
pub fn NewClass(
|
||||
comptime ZigType: type,
|
||||
comptime options: ClassOptions,
|
||||
@@ -1611,7 +1612,7 @@ pub fn NewClass(
|
||||
const JSValue = JSC.JSValue;
|
||||
const ZigString = JSC.ZigString;
|
||||
|
||||
pub const PathString = _global.PathString;
|
||||
pub const PathString = bun.PathString;
|
||||
|
||||
threadlocal var error_args: [1]js.JSValueRef = undefined;
|
||||
pub fn JSError(
|
||||
@@ -1725,7 +1726,7 @@ pub const ArrayBuffer = extern struct {
|
||||
this.ptr,
|
||||
this.byte_len,
|
||||
MarkedArrayBuffer_deallocator,
|
||||
@intToPtr(*anyopaque, @ptrToInt(&_global.default_allocator)),
|
||||
@intToPtr(*anyopaque, @ptrToInt(&bun.default_allocator)),
|
||||
exception,
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
pub const Shimmer = @import("./shimmer.zig").Shimmer;
|
||||
const std = @import("std");
|
||||
const _global = @import("../../../global.zig");
|
||||
const string = _global.string;
|
||||
const Output = _global.Output;
|
||||
const bun = @import("../../../global.zig");
|
||||
const string = bun.string;
|
||||
const Output = bun.Output;
|
||||
const hasRef = std.meta.trait.hasField("ref");
|
||||
const C_API = @import("../../../jsc.zig").C;
|
||||
const StringPointer = @import("../../../api/schema.zig").Api.StringPointer;
|
||||
const Exports = @import("./exports.zig");
|
||||
const strings = _global.strings;
|
||||
const strings = bun.strings;
|
||||
const ErrorableZigString = Exports.ErrorableZigString;
|
||||
const ErrorableResolvedSource = Exports.ErrorableResolvedSource;
|
||||
const ZigException = Exports.ZigException;
|
||||
@@ -95,7 +95,7 @@ pub const ZigString = extern struct {
|
||||
len: u32,
|
||||
allocated: bool = false,
|
||||
|
||||
pub const empty = Slice{ .allocator = _global.default_allocator, .ptr = undefined, .len = 0, .allocated = false };
|
||||
pub const empty = Slice{ .allocator = bun.default_allocator, .ptr = undefined, .len = 0, .allocated = false };
|
||||
|
||||
pub fn slice(this: Slice) []const u8 {
|
||||
return this.ptr[0..this.len];
|
||||
@@ -197,7 +197,7 @@ pub const ZigString = extern struct {
|
||||
}
|
||||
|
||||
pub inline fn deinitGlobal(this: ZigString) void {
|
||||
_global.default_allocator.free(this.slice());
|
||||
bun.default_allocator.free(this.slice());
|
||||
}
|
||||
|
||||
pub inline fn mark(this: *ZigString) void {
|
||||
@@ -251,7 +251,7 @@ pub const ZigString = extern struct {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn sliceZBuf(this: ZigString, buf: *[_global.MAX_PATH_BYTES]u8) ![:0]const u8 {
|
||||
pub fn sliceZBuf(this: ZigString, buf: *[bun.MAX_PATH_BYTES]u8) ![:0]const u8 {
|
||||
return try std.fmt.bufPrintZ(buf, "{}", .{this});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,19 +5,19 @@ const JS = @import("../javascript.zig");
|
||||
const JSBase = @import("../base.zig");
|
||||
const ZigURL = @import("../../../query_string_map.zig").URL;
|
||||
const Api = @import("../../../api/schema.zig").Api;
|
||||
const _global = @import("../../../global.zig");
|
||||
const bun = @import("../../../global.zig");
|
||||
const std = @import("std");
|
||||
const Shimmer = @import("./shimmer.zig").Shimmer;
|
||||
const strings = @import("strings");
|
||||
const default_allocator = _global.default_allocator;
|
||||
const default_allocator = bun.default_allocator;
|
||||
const NewGlobalObject = JSC.NewGlobalObject;
|
||||
const JSGlobalObject = JSC.JSGlobalObject;
|
||||
const is_bindgen: bool = std.meta.globalOption("bindgen", bool) orelse false;
|
||||
const ZigString = JSC.ZigString;
|
||||
const string = _global.string;
|
||||
const string = bun.string;
|
||||
const JSValue = JSC.JSValue;
|
||||
const Output = _global.Output;
|
||||
const Environment = _global.Environment;
|
||||
const Output = bun.Output;
|
||||
const Environment = bun.Environment;
|
||||
const ScriptArguments = JSC.ScriptArguments;
|
||||
const JSPromise = JSC.JSPromise;
|
||||
const JSPromiseRejectionOperation = JSC.JSPromiseRejectionOperation;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
const _global = @import("../../global.zig");
|
||||
const string = _global.string;
|
||||
const Output = _global.Output;
|
||||
const Global = _global.Global;
|
||||
const Environment = _global.Environment;
|
||||
const strings = _global.strings;
|
||||
const MutableString = _global.MutableString;
|
||||
const stringZ = _global.stringZ;
|
||||
const default_allocator = _global.default_allocator;
|
||||
const C = _global.C;
|
||||
const bun = @import("../../global.zig");
|
||||
const string = bun.string;
|
||||
const Output = bun.Output;
|
||||
const Global = bun.Global;
|
||||
const Environment = bun.Environment;
|
||||
const strings = bun.strings;
|
||||
const MutableString = bun.MutableString;
|
||||
const stringZ = bun.stringZ;
|
||||
const default_allocator = bun.default_allocator;
|
||||
const C = bun.C;
|
||||
const std = @import("std");
|
||||
|
||||
const Fs = @import("../../fs.zig");
|
||||
|
||||
@@ -2,18 +2,18 @@ const std = @import("std");
|
||||
const is_bindgen: bool = std.meta.globalOption("bindgen", bool) orelse false;
|
||||
const StaticExport = @import("./bindings/static_export.zig");
|
||||
const c_char = StaticExport.c_char;
|
||||
const _global = @import("../../global.zig");
|
||||
const string = _global.string;
|
||||
const Output = _global.Output;
|
||||
const Global = _global.Global;
|
||||
const Environment = _global.Environment;
|
||||
const strings = _global.strings;
|
||||
const MutableString = _global.MutableString;
|
||||
const stringZ = _global.stringZ;
|
||||
const default_allocator = _global.default_allocator;
|
||||
const StoredFileDescriptorType = _global.StoredFileDescriptorType;
|
||||
const bun = @import("../../global.zig");
|
||||
const string = bun.string;
|
||||
const Output = bun.Output;
|
||||
const Global = bun.Global;
|
||||
const Environment = bun.Environment;
|
||||
const strings = bun.strings;
|
||||
const MutableString = bun.MutableString;
|
||||
const stringZ = bun.stringZ;
|
||||
const default_allocator = bun.default_allocator;
|
||||
const StoredFileDescriptorType = bun.StoredFileDescriptorType;
|
||||
const Arena = @import("../../mimalloc_arena.zig").Arena;
|
||||
const C = _global.C;
|
||||
const C = bun.C;
|
||||
const NetworkThread = @import("http").NetworkThread;
|
||||
|
||||
pub fn zigCast(comptime Destination: type, value: anytype) *Destination {
|
||||
@@ -658,7 +658,7 @@ pub const Bun = struct {
|
||||
arguments: []const js.JSValueRef,
|
||||
exception: js.ExceptionRef,
|
||||
) js.JSValueRef {
|
||||
var buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
const path = getFilePath(ctx, arguments, &buf, exception) orelse return null;
|
||||
buf[path.len] = 0;
|
||||
|
||||
@@ -675,7 +675,7 @@ pub const Bun = struct {
|
||||
arguments: []const js.JSValueRef,
|
||||
exception: js.ExceptionRef,
|
||||
) js.JSValueRef {
|
||||
var buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
const path = getFilePath(ctx, arguments, &buf, exception) orelse return null;
|
||||
buf[path.len] = 0;
|
||||
|
||||
@@ -737,7 +737,7 @@ pub const Bun = struct {
|
||||
return Node.NodeFSBindings.make(
|
||||
ctx,
|
||||
VirtualMachine.vm.node_fs orelse brk: {
|
||||
VirtualMachine.vm.node_fs = _global.default_allocator.create(Node.NodeFS) catch unreachable;
|
||||
VirtualMachine.vm.node_fs = bun.default_allocator.create(Node.NodeFS) catch unreachable;
|
||||
VirtualMachine.vm.node_fs.?.* = Node.NodeFS{ .async_io = undefined };
|
||||
break :brk VirtualMachine.vm.node_fs.?;
|
||||
},
|
||||
@@ -800,7 +800,7 @@ pub const Bun = struct {
|
||||
return out.toValueGC(ctx.ptr()).asObjectRef();
|
||||
}
|
||||
|
||||
var public_path_temp_str: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
var public_path_temp_str: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
|
||||
pub fn getPublicPathJS(
|
||||
_: void,
|
||||
@@ -832,7 +832,7 @@ pub const Bun = struct {
|
||||
// if (arguments.len == 0) return ZigString.Empty.toValue(ctx.ptr()).asObjectRef();
|
||||
// var zig_str: ZigString = ZigString.Empty;
|
||||
// JSValue.toZigString(JSValue.fromRef(arguments[0]), &zig_str, ctx.ptr());
|
||||
// var buf: [_global.MAX_PATH_BYTES]u8 = undefined;
|
||||
// var buf: [bun.MAX_PATH_BYTES]u8 = undefined;
|
||||
// var stack = std.heap.stackFallback(32 * @sizeOf(string), VirtualMachine.vm.allocator);
|
||||
// var allocator = stack.get();
|
||||
// var parts = allocator.alloc(string, arguments.len) catch {};
|
||||
@@ -1449,7 +1449,7 @@ pub const Bun = struct {
|
||||
const StackFallback = std.heap.StackFallbackAllocator(32 * 2 * @sizeOf(ZigString));
|
||||
var stack = StackFallback{
|
||||
.buffer = undefined,
|
||||
.fallback_allocator = _global.default_allocator,
|
||||
.fallback_allocator = bun.default_allocator,
|
||||
.fixed_buffer_allocator = undefined,
|
||||
};
|
||||
var allocator = stack.get();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -13,10 +13,10 @@ const testing = std.testing;
|
||||
const Allocator = std.mem.Allocator;
|
||||
const resolve_path = @import("../../resolver/resolve_path.zig");
|
||||
const JSC = @import("../../jsc.zig");
|
||||
const _global = @import("../../global.zig");
|
||||
const string = _global.string;
|
||||
const strings = _global.strings;
|
||||
const default_allocator = _global.default_allocator;
|
||||
const bun = @import("../../global.zig");
|
||||
const string = bun.string;
|
||||
const strings = bun.strings;
|
||||
const default_allocator = bun.default_allocator;
|
||||
|
||||
pub const bindgen = true;
|
||||
|
||||
|
||||
@@ -110,6 +110,7 @@ pub const Response = struct {
|
||||
try formatter.writeIndent(@TypeOf(writer), writer);
|
||||
try writer.writeAll("statusText: \"");
|
||||
try writer.writeAll(this.status_text);
|
||||
try writer.writeAll("\"");
|
||||
}
|
||||
try writer.writeAll("\n");
|
||||
try formatter.writeIndent(@TypeOf(writer), writer);
|
||||
|
||||
Reference in New Issue
Block a user