diff options
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/build_command.zig | 26 | ||||
-rw-r--r-- | src/cli/bun_command.zig | 20 | ||||
-rw-r--r-- | src/cli/colon_list_type.zig | 20 | ||||
-rw-r--r-- | src/cli/create_command.zig | 36 | ||||
-rw-r--r-- | src/cli/discord_command.zig | 20 | ||||
-rw-r--r-- | src/cli/install_completions_command.zig | 26 | ||||
-rw-r--r-- | src/cli/package_manager_command.zig | 6 | ||||
-rw-r--r-- | src/cli/run_command.zig | 24 | ||||
-rw-r--r-- | src/cli/shell_completions.zig | 20 | ||||
-rw-r--r-- | src/cli/test_command.zig | 40 | ||||
-rw-r--r-- | src/cli/upgrade_command.zig | 28 |
11 files changed, 133 insertions, 133 deletions
diff --git a/src/cli/build_command.zig b/src/cli/build_command.zig index 3542af5e4..b8be52118 100644 --- a/src/cli/build_command.zig +++ b/src/cli/build_command.zig @@ -1,14 +1,14 @@ -const _global = @import("../global.zig"); -const string = _global.string; -const Output = _global.Output; -const Global = _global.Global; -const Environment = _global.Environment; -const FeatureFlags = _global.FeatureFlags; -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 FeatureFlags = bun.FeatureFlags; +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 lex = @import("../js_lexer.zig"); @@ -28,7 +28,7 @@ const Command = @import("../cli.zig").Command; const bundler = @import("../bundler.zig"); const NodeModuleBundle = @import("../node_module_bundle.zig").NodeModuleBundle; const fs = @import("../fs.zig"); -const constStrToU8 = _global.constStrToU8; +const constStrToU8 = bun.constStrToU8; pub const BuildCommand = struct { pub fn exec(ctx: Command.Context) !void { @@ -89,7 +89,7 @@ pub const BuildCommand = struct { // So don't do that unless we actually need to. // const do_we_need_to_close = !FeatureFlags.store_file_descriptors or (@intCast(usize, root_dir.fd) + open_file_limit) < result.output_files.len; - var filepath_buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var filepath_buf: [bun.MAX_PATH_BYTES]u8 = undefined; filepath_buf[0] = '.'; filepath_buf[1] = '/'; diff --git a/src/cli/bun_command.zig b/src/cli/bun_command.zig index 225940d13..d9fbaea75 100644 --- a/src/cli/bun_command.zig +++ b/src/cli/bun_command.zig @@ -1,15 +1,15 @@ const std = @import("std"); const Command = @import("../cli.zig").Command; -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 lex = @import("../js_lexer.zig"); const logger = @import("../logger.zig"); diff --git a/src/cli/colon_list_type.zig b/src/cli/colon_list_type.zig index 8290681ef..9aa4aaa96 100644 --- a/src/cli/colon_list_type.zig +++ b/src/cli/colon_list_type.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"); pub fn ColonListType(comptime t: type, value_resolver: anytype) type { diff --git a/src/cli/create_command.zig b/src/cli/create_command.zig index f81832b0c..da9c1703d 100644 --- a/src/cli/create_command.zig +++ b/src/cli/create_command.zig @@ -1,14 +1,14 @@ -const _global = @import("../global.zig"); -const string = _global.string; -const constStrToU8 = _global.constStrToU8; -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 constStrToU8 = bun.constStrToU8; +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 lex = @import("../js_lexer.zig"); @@ -42,7 +42,7 @@ const clap = @import("clap"); const Lock = @import("../lock.zig").Lock; const Headers = @import("http").Headers; const CopyFile = @import("../copy_file.zig"); -var bun_path_buf: [_global.MAX_PATH_BYTES]u8 = undefined; +var bun_path_buf: [bun.MAX_PATH_BYTES]u8 = undefined; const Futex = @import("../futex.zig"); const ComptimeStringMap = @import("../comptime_string_map.zig").ComptimeStringMap; @@ -245,7 +245,7 @@ const CreateOptions = struct { }; const BUN_CREATE_DIR = ".bun-create"; -var home_dir_buf: [_global.MAX_PATH_BYTES]u8 = undefined; +var home_dir_buf: [bun.MAX_PATH_BYTES]u8 = undefined; pub const CreateCommand = struct { pub fn exec(ctx: Command.Context, _: []const []const u8) !void { @setCold(true); @@ -869,10 +869,10 @@ pub const CreateCommand = struct { var needs_bun_macros_prop = needs_bun_prop; if (needs_bun_macros_prop) { - if (package_json_expr.asProperty("bun")) |bun| { + if (package_json_expr.asProperty("bun")) |bun_| { needs_bun_prop = false; - bun_prop = bun.expr; - if (bun.expr.asProperty("macros")) |macros_q| { + bun_prop = bun_.expr; + if (bun_.expr.asProperty("macros")) |macros_q| { bun_macros_prop = macros_q.expr; needs_bun_macros_prop = false; if (macros_q.expr.asProperty("react-relay")) |react_relay_q| { @@ -1645,8 +1645,8 @@ pub const CreateCommand = struct { Output.flush(); if (create_options.open) { - if (which(&bun_path_buf, PATH, destination, "bun")) |bun| { - var argv = [_]string{std.mem.span(bun)}; + if (which(&bun_path_buf, PATH, destination, "bun")) |bin| { + var argv = [_]string{std.mem.span(bin)}; var child = try std.ChildProcess.init(&argv, ctx.allocator); child.cwd = destination; child.stdin_behavior = .Inherit; diff --git a/src/cli/discord_command.zig b/src/cli/discord_command.zig index 8b2d92cc5..b5af28345 100644 --- a/src/cli/discord_command.zig +++ b/src/cli/discord_command.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 open = @import("../open.zig"); diff --git a/src/cli/install_completions_command.zig b/src/cli/install_completions_command.zig index 385d5c40e..6860996a4 100644 --- a/src/cli/install_completions_command.zig +++ b/src/cli/install_completions_command.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 lex = @import("../js_lexer.zig"); @@ -75,7 +75,7 @@ pub const InstallCompletionsCommand = struct { var completions_dir: string = ""; var output_dir: std.fs.Dir = found: { - var cwd_buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var cwd_buf: [bun.MAX_PATH_BYTES]u8 = undefined; var cwd = std.os.getcwd(&cwd_buf) catch { Output.prettyErrorln("<r><red>error<r>: Could not get current working directory", .{}); Output.flush(); @@ -285,9 +285,9 @@ pub const InstallCompletionsCommand = struct { // Check if they need to load the zsh completions file into their .zshrc if (shell == .zsh) { - var completions_absolute_path_buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var completions_absolute_path_buf: [bun.MAX_PATH_BYTES]u8 = undefined; var completions_path = std.os.getFdPath(output_file.handle, &completions_absolute_path_buf) catch unreachable; - var zshrc_filepath: [_global.MAX_PATH_BYTES]u8 = undefined; + var zshrc_filepath: [bun.MAX_PATH_BYTES]u8 = undefined; const needs_to_tell_them_to_add_completions_file = brk: { var dot_zshrc: std.fs.File = zshrc: { first: { diff --git a/src/cli/package_manager_command.zig b/src/cli/package_manager_command.zig index b91b1966b..3537c75a7 100644 --- a/src/cli/package_manager_command.zig +++ b/src/cli/package_manager_command.zig @@ -7,12 +7,12 @@ const Global = @import("../global.zig").Global; const Output = @import("../global.zig").Output; const Fs = @import("../fs.zig"); const Path = @import("../resolver/resolve_path.zig"); -const _global = @import("../global.zig"); +const bun = @import("../global.zig"); pub const PackageManagerCommand = struct { pub fn printHelp(_: std.mem.Allocator) void {} pub fn printHash(ctx: Command.Context, lockfile_: []const u8) !void { @setCold(true); - var lockfile_buffer: [_global.MAX_PATH_BYTES]u8 = undefined; + var lockfile_buffer: [bun.MAX_PATH_BYTES]u8 = undefined; @memcpy(&lockfile_buffer, lockfile_.ptr, lockfile_.len); lockfile_buffer[lockfile_.len] = 0; var lockfile = lockfile_buffer[0..lockfile_.len :0]; @@ -140,7 +140,7 @@ pub const PackageManagerCommand = struct { _ = try pm.lockfile.hasMetaHashChanged(true); Global.exit(0); } else if (strings.eqlComptime(first, "cache")) { - var dir: [_global.MAX_PATH_BYTES]u8 = undefined; + var dir: [bun.MAX_PATH_BYTES]u8 = undefined; var fd = pm.getCacheDirectory(); var outpath = std.os.getFdPath(fd.fd, &dir) catch |err| { Output.prettyErrorln("{s} getting cache directory", .{@errorName(err)}); diff --git a/src/cli/run_command.zig b/src/cli/run_command.zig index e1e4bf22c..1fda7fe07 100644 --- a/src/cli/run_command.zig +++ b/src/cli/run_command.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 lex = @import("../js_lexer.zig"); @@ -30,8 +30,8 @@ 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; -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 NpmArgs = struct { // https://github.com/npm/rfcs/blob/main/implemented/0021-reduce-lifecycle-script-environment.md#detailed-explanation pub const package_name: string = "npm_package_name"; diff --git a/src/cli/shell_completions.zig b/src/cli/shell_completions.zig index 10269de11..30d987da0 100644 --- a/src/cli/shell_completions.zig +++ b/src/cli/shell_completions.zig @@ -1,14 +1,14 @@ 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; pub const Shell = enum { unknown, diff --git a/src/cli/test_command.zig b/src/cli/test_command.zig index 40fa344e6..c0c00d96b 100644 --- a/src/cli/test_command.zig +++ b/src/cli/test_command.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 lex = @import("../js_lexer.zig"); @@ -31,9 +31,9 @@ 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; -var path_buf: [_global.MAX_PATH_BYTES]u8 = undefined; -var path_buf2: [_global.MAX_PATH_BYTES]u8 = undefined; -const PathString = _global.PathString; +var path_buf: [bun.MAX_PATH_BYTES]u8 = undefined; +var path_buf2: [bun.MAX_PATH_BYTES]u8 = undefined; +const PathString = bun.PathString; const is_bindgen = std.meta.globalOption("bindgen", bool) orelse false; const JSC = @import("javascript_core"); @@ -103,15 +103,15 @@ const Scanner = struct { exclusion_names: []const []const u8 = &.{}, filter_names: []const []const u8 = &.{}, dirs_to_scan: Fifo, - results: std.ArrayList(_global.PathString), + results: std.ArrayList(bun.PathString), fs: *FileSystem, - open_dir_buf: [_global.MAX_PATH_BYTES]u8 = undefined, - scan_dir_buf: [_global.MAX_PATH_BYTES]u8 = undefined, + open_dir_buf: [bun.MAX_PATH_BYTES]u8 = undefined, + scan_dir_buf: [bun.MAX_PATH_BYTES]u8 = undefined, options: *options.BundleOptions, has_iterated: bool = false, const ScanEntry = struct { - relative_dir: _global.StoredFileDescriptorType, + relative_dir: bun.StoredFileDescriptorType, dir_path: string, name: strings.StringOrTinyString, }; @@ -127,7 +127,7 @@ const Scanner = struct { var root = this.readDirWithName(path, null) catch |err| { if (err == error.NotDir) { if (this.isTestFile(path)) { - this.results.append(_global.PathString.init(this.fs.filename_store.append(@TypeOf(path), path) catch unreachable)) catch unreachable; + this.results.append(bun.PathString.init(this.fs.filename_store.append(@TypeOf(path), path) catch unreachable)) catch unreachable; } } @@ -190,7 +190,7 @@ const Scanner = struct { return this.couldBeTestFile(name) and this.doesAbsolutePathMatchFilter(name); } - pub fn next(this: *Scanner, entry: *FileSystem.Entry, fd: _global.StoredFileDescriptorType) void { + pub fn next(this: *Scanner, entry: *FileSystem.Entry, fd: bun.StoredFileDescriptorType) void { const name = entry.base_lowercase(); this.has_iterated = true; switch (entry.kind(&this.fs.fs)) { @@ -220,7 +220,7 @@ const Scanner = struct { if (!this.doesAbsolutePathMatchFilter(path)) return; - entry.abs_path = _global.PathString.init(this.fs.filename_store.append(@TypeOf(path), path) catch unreachable); + entry.abs_path = bun.PathString.init(this.fs.filename_store.append(@TypeOf(path), path) catch unreachable); this.results.append(entry.abs_path) catch unreachable; }, } diff --git a/src/cli/upgrade_command.zig b/src/cli/upgrade_command.zig index ce05a1dfc..b66e1e9da 100644 --- a/src/cli/upgrade_command.zig +++ b/src/cli/upgrade_command.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 lex = @import("../js_lexer.zig"); @@ -120,10 +120,10 @@ pub const UpgradeCheckerThread = struct { pub const UpgradeCommand = struct { pub const timeout: u32 = 30000; const default_github_headers: string = "Acceptapplication/vnd.github.v3+json"; - var github_repository_url_buf: [_global.MAX_PATH_BYTES]u8 = undefined; - var current_executable_buf: [_global.MAX_PATH_BYTES]u8 = undefined; - var unzip_path_buf: [_global.MAX_PATH_BYTES]u8 = undefined; - var tmpdir_path_buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var github_repository_url_buf: [bun.MAX_PATH_BYTES]u8 = undefined; + var current_executable_buf: [bun.MAX_PATH_BYTES]u8 = undefined; + var unzip_path_buf: [bun.MAX_PATH_BYTES]u8 = undefined; + var tmpdir_path_buf: [bun.MAX_PATH_BYTES]u8 = undefined; pub fn getLatestVersion( allocator: std.mem.Allocator, |