diff options
Diffstat (limited to '')
-rw-r--r-- | src/install/install.zig | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/src/install/install.zig b/src/install/install.zig index 1e04a8932..9fbd4f773 100644 --- a/src/install/install.zig +++ b/src/install/install.zig @@ -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 JSLexer = @import("../js_lexer.zig"); @@ -30,13 +30,12 @@ const NodeModuleBundle = @import("../node_module_bundle.zig").NodeModuleBundle; const DotEnv = @import("../env_loader.zig"); const which = @import("../which.zig").which; const Run = @import("../bun_js.zig").Run; -const NewBunQueue = @import("../bun_queue.zig").NewBunQueue; const HeaderBuilder = @import("http").HeaderBuilder; const Fs = @import("../fs.zig"); const FileSystem = Fs.FileSystem; const Lock = @import("../lock.zig").Lock; -var path_buf: [_global.MAX_PATH_BYTES]u8 = undefined; -var path_buf2: [_global.MAX_PATH_BYTES]u8 = undefined; +var path_buf: [bun.MAX_PATH_BYTES]u8 = undefined; +var path_buf2: [bun.MAX_PATH_BYTES]u8 = undefined; const URL = @import("../query_string_map.zig").URL; const AsyncHTTP = @import("http").AsyncHTTP; const HTTPChannel = @import("http").HTTPChannel; @@ -587,8 +586,8 @@ const PackageInstall = struct { var this: *PackageInstall.Task = @fieldParentPtr(PackageInstall.Task, "task", task); var ctx = this.ctx; - var destination_dir_subpath_buf: [_global.MAX_PATH_BYTES]u8 = undefined; - var cache_dir_subpath_buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var destination_dir_subpath_buf: [bun.MAX_PATH_BYTES]u8 = undefined; + var cache_dir_subpath_buf: [bun.MAX_PATH_BYTES]u8 = undefined; const name = ctx.names[this.package_id].slice(ctx.string_buf); const resolution = ctx.resolutions[this.package_id]; std.mem.copy(u8, &destination_dir_subpath_buf, name); @@ -811,7 +810,7 @@ const PackageInstall = struct { walker: *Walker, ) !u32 { var real_file_count: u32 = 0; - var stackpath: [_global.MAX_PATH_BYTES]u8 = undefined; + var stackpath: [bun.MAX_PATH_BYTES]u8 = undefined; while (try walker.next()) |entry| { switch (entry.kind) { .Directory => std.os.mkdirat(destination_dir_.fd, entry.path, 0o755) catch {}, @@ -1284,7 +1283,7 @@ pub const PackageManager = struct { } } - var cached_package_folder_name_buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var cached_package_folder_name_buf: [bun.MAX_PATH_BYTES]u8 = undefined; pub inline fn getCacheDirectory(this: *PackageManager) std.fs.Dir { return this.cache_directory_ orelse brk: { @@ -2562,14 +2561,14 @@ pub const PackageManager = struct { } if (std.os.getenvZ("BUN_INSTALL")) |home_dir| { - var buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var buf: [bun.MAX_PATH_BYTES]u8 = undefined; var parts = [_]string{ "install", "global" }; var path = Path.joinAbsStringBuf(home_dir, &buf, &parts, .auto); return try std.fs.cwd().makeOpenPath(path, .{ .iterate = true }); } if (std.os.getenvZ("XDG_CACHE_HOME") orelse std.os.getenvZ("HOME")) |home_dir| { - var buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var buf: [bun.MAX_PATH_BYTES]u8 = undefined; var parts = [_]string{ ".bun", "install", "global" }; var path = Path.joinAbsStringBuf(home_dir, &buf, &parts, .auto); return try std.fs.cwd().makeOpenPath(path, .{ .iterate = true }); @@ -2592,7 +2591,7 @@ pub const PackageManager = struct { } if (std.os.getenvZ("BUN_INSTALL")) |home_dir| { - var buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var buf: [bun.MAX_PATH_BYTES]u8 = undefined; var parts = [_]string{ "bin", }; @@ -2601,7 +2600,7 @@ pub const PackageManager = struct { } if (std.os.getenvZ("XDG_CACHE_HOME") orelse std.os.getenvZ("HOME")) |home_dir| { - var buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var buf: [bun.MAX_PATH_BYTES]u8 = undefined; var parts = [_]string{ ".bun", "bin", @@ -3461,8 +3460,8 @@ pub const PackageManager = struct { } if (args.option("--cwd")) |cwd_| { - var buf: [_global.MAX_PATH_BYTES]u8 = undefined; - var buf2: [_global.MAX_PATH_BYTES]u8 = undefined; + var buf: [bun.MAX_PATH_BYTES]u8 = undefined; + var buf2: [bun.MAX_PATH_BYTES]u8 = undefined; var final_path: [:0]u8 = undefined; if (cwd_.len > 0 and cwd_[0] == '.') { var cwd = try std.os.getcwd(&buf); @@ -3955,7 +3954,7 @@ pub const PackageManager = struct { if (op == .remove) { var cwd = std.fs.cwd(); // This is not exactly correct - var node_modules_buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var node_modules_buf: [bun.MAX_PATH_BYTES]u8 = undefined; std.mem.copy(u8, &node_modules_buf, "node_modules" ++ std.fs.path.sep_str); var offset_buf: []u8 = node_modules_buf["node_modules/".len..]; const name_hashes = manager.lockfile.packages.items(.name_hash); @@ -4002,8 +4001,8 @@ pub const PackageManager = struct { } } - var cwd_buf: [_global.MAX_PATH_BYTES]u8 = undefined; - var package_json_cwd_buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var cwd_buf: [bun.MAX_PATH_BYTES]u8 = undefined; + var package_json_cwd_buf: [bun.MAX_PATH_BYTES]u8 = undefined; pub inline fn install( ctx: Command.Context, @@ -4050,8 +4049,8 @@ pub const PackageManager = struct { node: *Progress.Node, has_created_bin: bool = false, global_bin_dir: std.fs.Dir, - destination_dir_subpath_buf: [_global.MAX_PATH_BYTES]u8 = undefined, - folder_path_buf: [_global.MAX_PATH_BYTES]u8 = undefined, + destination_dir_subpath_buf: [bun.MAX_PATH_BYTES]u8 = undefined, + folder_path_buf: [bun.MAX_PATH_BYTES]u8 = undefined, install_count: usize = 0, successfully_installed: Bitset, @@ -4522,7 +4521,7 @@ pub const PackageManager = struct { pub fn setupGlobalDir(manager: *PackageManager, ctx: *const Command.Context) !void { manager.options.global_bin_dir = try Options.openGlobalBinDir(ctx.install); - var out_buffer: [_global.MAX_PATH_BYTES]u8 = undefined; + var out_buffer: [bun.MAX_PATH_BYTES]u8 = undefined; var result = try std.os.getFdPath(manager.options.global_bin_dir.fd, &out_buffer); out_buffer[result.len] = 0; var result_: [:0]u8 = out_buffer[0..result.len :0]; |