diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ba67f31..415ae709 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * refactor(terminal): track scroll_region as tuple rather than Option (https://github.com/zellij-org/zellij/pull/4082) * chore(deps): Use workspace dependencies (https://github.com/zellij-org/zellij/pull/4085) * build: Don't use default features (https://github.com/zellij-org/zellij/pull/4086) +* build: Don't re-export foreign crates (https://github.com/zellij-org/zellij/pull/4087) ## [0.42.1] - 2025-03-21 * fix(mouse): fix mouse handling in windows terminal (https://github.com/zellij-org/zellij/pull/4076) diff --git a/Cargo.lock b/Cargo.lock index a43d0003..4b7bebbc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4976,15 +4976,22 @@ dependencies = [ name = "zellij" version = "0.43.0" dependencies = [ + "anyhow", + "clap", "dialoguer", + "humantime", "insta", + "interprocess", "log", + "miette", "names", + "nix 0.23.1", "rand 0.8.5", "regex", "ssh2", "suggest", "thiserror 1.0.61", + "vte 0.11.0", "zellij-client", "zellij-server", "zellij-utils", @@ -4994,13 +5001,23 @@ dependencies = [ name = "zellij-client" version = "0.43.0" dependencies = [ + "anyhow", "insta", + "interprocess", + "lazy_static", + "libc", "log", "mio 0.7.14", + "nix 0.23.1", + "notify-debouncer-full", + "regex", "serde", "serde_json", "serde_yaml", + "signal-hook", + "termwiz", "url", + "uuid", "zellij-utils", ] @@ -5009,7 +5026,10 @@ name = "zellij-server" version = "0.43.0" dependencies = [ "ansi_term", + "anyhow", "arrayvec 0.7.2", + "async-channel", + "async-std", "async-trait", "base64 0.13.0", "byteorder", @@ -5020,9 +5040,19 @@ dependencies = [ "daemonize", "highway", "insta", + "interprocess", + "isahc", + "lazy_static", + "libc", "log", + "nix 0.23.1", + "notify-debouncer-full", + "prost", + "regex", "semver 0.11.0", + "serde", "serde_json", + "signal-hook", "sixel-image", "sixel-tokenizer", "sysinfo", @@ -5031,6 +5061,7 @@ dependencies = [ "unicode-width 0.1.10", "url", "uuid", + "vte 0.11.0", "wasmtime", "wasmtime-wasi", "zellij-utils", @@ -5041,6 +5072,7 @@ name = "zellij-tile" version = "0.43.0" dependencies = [ "clap", + "prost", "serde", "serde_json", "strum", @@ -5060,7 +5092,6 @@ name = "zellij-utils" version = "0.43.0" dependencies = [ "anyhow", - "async-channel", "async-std", "backtrace", "bitflags 2.5.0", @@ -5072,29 +5103,24 @@ dependencies = [ "curl-sys", "directories", "expect-test", - "humantime", "include_dir", "insta", "interprocess", "isahc", "kdl", "lazy_static", - "libc", "log", "log4rs", "miette", "nix 0.23.1", - "notify-debouncer-full", "openssl-sys", "percent-encoding", "prost", "prost-build", - "regex", "rmp-serde", "serde", "serde_json", "shellexpand 3.0.0", - "signal-hook", "strip-ansi-escapes", "strum", "strum_macros", @@ -5104,7 +5130,6 @@ dependencies = [ "unicode-width 0.1.10", "url", "uuid", - "vte 0.11.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ed0aa445..d3ffdaf9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,9 +17,15 @@ rust-version = "1.84" zellij-client = { path = "zellij-client/", version = "0.43.0" } zellij-server = { path = "zellij-server/", version = "0.43.0" } zellij-utils = { workspace = true } +anyhow = { workspace = true } +clap = { workspace = true } dialoguer = { version = "0.10.4", default-features = false } +humantime = { version = "2.1.0", default-features = false } +interprocess = { workspace = true } log = { workspace = true } +miette = { workspace = true } names = { version = "0.14.0", default-features = false } +nix = { workspace = true } suggest = { version = "0.4.0", default-features = false } thiserror = { workspace = true } @@ -28,6 +34,7 @@ insta = { version = "1.6.0", features = ["backtrace"] } ssh2 = "0.9.1" rand = "0.8.0" regex = "1.8.1" +vte = { workspace = true } [workspace] members = [ @@ -52,16 +59,30 @@ members = [ [workspace.dependencies] ansi_term = { version = "0.12.1", default-features = false } anyhow = { version = "1.0.70", default-features = false, features = ["backtrace", "std"] } +async-std = { version = "1.3.0", default-features = false, features = ["attributes", "default", "std", "unstable"] } clap = { version = "3.2.2", default-features = false, features = ["env", "derive", "color", "std", "suggestions"] } +interprocess = { version = "1.2.1", default-features = false } +isahc = { version = "1.7.2", default-features = false, features = ["http2", "text-decoding"] } +lazy_static = { version = "1.4.0", default-features = false } +libc = { version = "0.2", default-features = false, features = ["std"] } log = { version = "0.4.17", default-features = false } +miette = { version = "5.7.0", default-features = false, features = ["fancy"] } +nix = { version = "0.23.1", default-features = false } +notify-debouncer-full = { version = "0.1.0", default-features = false } +prost = { version = "0.11.9", default-features = false, features = ["std", "prost-derive"] } +regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] } serde = { version = "1.0", default-features = false, features = ["derive", "std"] } serde_json = { version = "1.0", default-features = false, features = ["std"] } +signal-hook = { version = "0.3", default-features = false, features = ["iterator"] } strum = { version = "0.20.0", default-features = false } strum_macros = { version = "0.20.0", default-features = false } +tempfile = { version = "3.2.0", default-features = false } +termwiz = { version = "0.23.2", default-features = false } thiserror = { version = "1.0.40", default-features = false } unicode-width = { version = "0.1.8", default-features = false } url = { version = "2.2.2", default-features = false, features = ["serde"] } uuid = { version = "1.4.1", default-features = false, features = ["serde", "v4", "std"] } +vte = { version = "0.11.0", default-features = false } zellij-utils = { path = "zellij-utils/", version = "0.43.0" } [profile.dev-opt] diff --git a/src/commands.rs b/src/commands.rs index dba2c9d7..e01d5176 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -9,6 +9,8 @@ use crate::sessions::{ print_sessions_with_index, resurrection_layout, session_exists, ActiveSession, SessionNameMatch, }; +use miette::{Report, Result}; +use nix; use zellij_client::{ old_config_converter::{ config_yaml_to_config_kdl, convert_old_yaml_files, layout_yaml_to_layout_kdl, @@ -27,8 +29,6 @@ use zellij_utils::{ layout::Layout, options::Options, }, - miette::{Report, Result}, - nix, setup::{find_default_config_dir, get_layout_dir, Setup}, }; diff --git a/src/main.rs b/src/main.rs index b3a5ce96..10459786 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,8 +3,8 @@ mod sessions; #[cfg(test)] mod tests; +use clap::Parser; use zellij_utils::{ - clap::Parser, cli::{CliAction, CliArgs, Command, Sessions}, consts::create_config_and_cache_folders, envs, diff --git a/src/sessions.rs b/src/sessions.rs index 5f77e2ef..99c1036e 100644 --- a/src/sessions.rs +++ b/src/sessions.rs @@ -1,18 +1,18 @@ +use anyhow; +use humantime::format_duration; +use interprocess::local_socket::LocalSocketStream; use std::collections::HashMap; use std::os::unix::fs::FileTypeExt; use std::time::{Duration, SystemTime}; use std::{fs, io, process}; use suggest::Suggest; use zellij_utils::{ - anyhow, consts::{ session_info_folder_for_session, session_layout_cache_file_name, ZELLIJ_SESSION_INFO_CACHE_DIR, ZELLIJ_SOCK_DIR, }, envs, - humantime::format_duration, input::layout::Layout, - interprocess::local_socket::LocalSocketStream, ipc::{ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg}, }; diff --git a/src/tests/e2e/remote_runner.rs b/src/tests/e2e/remote_runner.rs index b3d8b9ac..626007c4 100644 --- a/src/tests/e2e/remote_runner.rs +++ b/src/tests/e2e/remote_runner.rs @@ -2,11 +2,11 @@ use std::collections::HashMap; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex}; +use vte; use zellij_server::panes::sixel::SixelImageStore; use zellij_server::panes::{LinkHandler, TerminalPane}; use zellij_utils::data::{Palette, Style}; use zellij_utils::pane_size::{Dimension, PaneGeom, Size, SizeInPixels}; -use zellij_utils::vte; use ssh2::Session; use std::io::prelude::*; diff --git a/zellij-client/Cargo.toml b/zellij-client/Cargo.toml index 8d511dc9..30cc3d7c 100644 --- a/zellij-client/Cargo.toml +++ b/zellij-client/Cargo.toml @@ -9,12 +9,22 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +anyhow = { workspace = true } +interprocess = { workspace = true } +lazy_static = { workspace = true } +libc = { workspace = true } log = { workspace = true } mio = { version = "0.7.11", default-features = false, features = ['os-ext'] } +nix = { workspace = true } +notify-debouncer-full = { workspace = true } +regex = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } serde_yaml = { version = "0.8", default-features = false } +signal-hook = { workspace = true } +termwiz = { workspace = true } url = { workspace = true } +uuid = { workspace = true } zellij-utils = { workspace = true } [dev-dependencies] diff --git a/zellij-client/src/cli_client.rs b/zellij-client/src/cli_client.rs index 620b5a82..825b0a5a 100644 --- a/zellij-client/src/cli_client.rs +++ b/zellij-client/src/cli_client.rs @@ -6,11 +6,11 @@ use std::process; use std::{fs, path::PathBuf}; use crate::os_input_output::ClientOsApi; +use uuid::Uuid; use zellij_utils::{ errors::prelude::*, input::actions::Action, ipc::{ClientToServerMsg, ExitReason, ServerToClientMsg}, - uuid::Uuid, }; pub fn start_cli_client( diff --git a/zellij-client/src/input_handler.rs b/zellij-client/src/input_handler.rs index 9df9ec5f..bdbfc083 100644 --- a/zellij-client/src/input_handler.rs +++ b/zellij-client/src/input_handler.rs @@ -3,6 +3,7 @@ use crate::{ os_input_output::ClientOsApi, stdin_ansi_parser::AnsiStdinInstruction, ClientId, ClientInstruction, CommandIsExecuting, InputInstruction, }; +use termwiz::input::{InputEvent, Modifiers, MouseButtons, MouseEvent as TermwizMouseEvent}; use zellij_utils::{ channels::{Receiver, SenderWithContext, OPENCALLS}, data::{InputMode, KeyWithModifier}, @@ -16,7 +17,6 @@ use zellij_utils::{ }, ipc::{ClientToServerMsg, ExitReason}, position::Position, - termwiz::input::{InputEvent, Modifiers, MouseButtons, MouseEvent as TermwizMouseEvent}, }; /// Handles the dispatching of [`Action`]s according to the current diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs index 725ed8cd..3256ada1 100644 --- a/zellij-client/src/lib.rs +++ b/zellij-client/src/lib.rs @@ -17,7 +17,7 @@ use std::sync::{Arc, Mutex}; use std::thread; use zellij_utils::errors::FatalError; -use zellij_utils::notify_debouncer_full::notify::{self, Event, RecursiveMode, Watcher}; +use notify_debouncer_full::notify::{self, Event, RecursiveMode, Watcher}; use zellij_utils::setup::Setup; use crate::stdin_ansi_parser::{AnsiStdinInstruction, StdinAnsiParser, SyncOutput}; @@ -25,6 +25,7 @@ use crate::{ command_is_executing::CommandIsExecuting, input_handler::input_loop, os_input_output::ClientOsApi, stdin_handler::stdin_loop, }; +use termwiz::input::InputEvent; use zellij_utils::{ channels::{self, ChannelWithContext, SenderWithContext}, consts::{set_permissions, ZELLIJ_SOCK_DIR}, @@ -34,7 +35,6 @@ use zellij_utils::{ input::{config::Config, options::Options}, ipc::{ClientAttributes, ClientToServerMsg, ExitReason, ServerToClientMsg}, pane_size::Size, - termwiz::input::InputEvent, }; use zellij_utils::{cli::CliArgs, input::layout::Layout}; diff --git a/zellij-client/src/os_input_output.rs b/zellij-client/src/os_input_output.rs index 41d03b0f..8f7d8817 100644 --- a/zellij-client/src/os_input_output.rs +++ b/zellij-client/src/os_input_output.rs @@ -1,6 +1,9 @@ -use zellij_utils::anyhow::{Context, Result}; +use anyhow::{Context, Result}; +use interprocess; +use libc; +use nix; +use signal_hook; use zellij_utils::pane_size::Size; -use zellij_utils::{interprocess, libc, nix, signal_hook}; use interprocess::local_socket::LocalSocketStream; use mio::{unix::SourceFd, Events, Interest, Poll, Token}; diff --git a/zellij-client/src/stdin_ansi_parser.rs b/zellij-client/src/stdin_ansi_parser.rs index 6816803b..7fa3492e 100644 --- a/zellij-client/src/stdin_ansi_parser.rs +++ b/zellij-client/src/stdin_ansi_parser.rs @@ -1,15 +1,16 @@ use std::time::{Duration, Instant}; const STARTUP_PARSE_DEADLINE_MS: u64 = 500; +use lazy_static::lazy_static; +use regex::Regex; use zellij_utils::{ - consts::ZELLIJ_STDIN_CACHE_FILE, ipc::PixelDimensions, lazy_static::lazy_static, - pane_size::SizeInPixels, regex::Regex, + consts::ZELLIJ_STDIN_CACHE_FILE, ipc::PixelDimensions, pane_size::SizeInPixels, }; +use anyhow::Result; use serde::{Deserialize, Serialize}; use std::fs::{File, OpenOptions}; use std::io::{Read, Write}; -use zellij_utils::anyhow::Result; /// Describe the terminal implementation of synchronised output #[derive(Debug, Clone, Copy, Serialize, Deserialize)] diff --git a/zellij-client/src/stdin_handler.rs b/zellij-client/src/stdin_handler.rs index a1235621..7ec335f7 100644 --- a/zellij-client/src/stdin_handler.rs +++ b/zellij-client/src/stdin_handler.rs @@ -3,8 +3,8 @@ use crate::os_input_output::ClientOsApi; use crate::stdin_ansi_parser::StdinAnsiParser; use crate::InputInstruction; use std::sync::{Arc, Mutex}; +use termwiz::input::{InputEvent, InputParser, MouseButtons}; use zellij_utils::channels::SenderWithContext; -use zellij_utils::termwiz::input::{InputEvent, InputParser, MouseButtons}; fn send_done_parsing_after_query_timeout( send_input_instructions: SenderWithContext, diff --git a/zellij-server/Cargo.toml b/zellij-server/Cargo.toml index ed4bcc87..a2d5affb 100644 --- a/zellij-server/Cargo.toml +++ b/zellij-server/Cargo.toml @@ -10,7 +10,10 @@ license = "MIT" [dependencies] ansi_term = { workspace = true } +anyhow = { workspace = true } arrayvec = { version = "0.7.2", default-features = false, features = ["std"] } +async-channel = { version = "1.8.0", default-features = false } +async-std = { workspace = true } async-trait = { version = "0.1.50", default-features = false } base64 = { version = "0.13.0", default-features = false, features = ["std"] } byteorder = { version = "1.4.3", default-features = false, features = ["std"] } @@ -20,16 +23,28 @@ chrono = { version = "0.4.19", default-features = false, features = ["std", "clo close_fds = { version = "0.3.2", default-features = false } daemonize = { version = "0.5", default-features = false } highway = { version = "0.6.4", default-features = false, features = ["std"] } +interprocess = { workspace = true } +isahc = { workspace = true } +lazy_static = { workspace = true } +libc = { workspace = true } log = { workspace = true } +nix = { workspace = true } +notify-debouncer-full = { workspace = true } +prost = { workspace = true } +regex = { workspace = true } semver = { version = "0.11.0", default-features = false } +serde = { workspace = true } serde_json = { workspace = true } +signal-hook = { workspace = true } sixel-image = { version = "0.1.0", default-features = false } sixel-tokenizer = { version = "0.1.0", default-features = false } sysinfo = { version = "0.22.5", default-features = false } +tempfile = { workspace = true } typetag = { version = "0.1.7", default-features = false } unicode-width = { workspace = true } url = { workspace = true } uuid = { workspace = true } +vte = { workspace = true } wasmtime-wasi = { version = "29.0.1", default-features = false, features = ["preview1"] } # Keep in sync with wasmtime zellij-utils = { workspace = true } diff --git a/zellij-server/src/background_jobs.rs b/zellij-server/src/background_jobs.rs index c293cdb7..bb428c0e 100644 --- a/zellij-server/src/background_jobs.rs +++ b/zellij-server/src/background_jobs.rs @@ -1,4 +1,4 @@ -use zellij_utils::async_std::task; +use async_std::task; use zellij_utils::consts::{ session_info_cache_file_name, session_info_folder_for_session, session_layout_cache_file_name, ZELLIJ_SESSION_INFO_CACHE_DIR, ZELLIJ_SOCK_DIR, @@ -7,9 +7,9 @@ use zellij_utils::data::{Event, HttpVerb, SessionInfo}; use zellij_utils::errors::{prelude::*, BackgroundJobContext, ContextType}; use zellij_utils::input::layout::RunPlugin; -use zellij_utils::isahc::prelude::*; -use zellij_utils::isahc::AsyncReadResponseExt; -use zellij_utils::isahc::{config::RedirectPolicy, HttpClient, Request}; +use isahc::prelude::*; +use isahc::AsyncReadResponseExt; +use isahc::{config::RedirectPolicy, HttpClient, Request}; use std::collections::{BTreeMap, HashMap}; use std::fs; @@ -291,7 +291,7 @@ pub(crate) fn background_jobs_main( http_client: HttpClient, ) -> Result< (u16, BTreeMap, Vec), // status_code, headers, body - zellij_utils::isahc::Error, + isahc::Error, > { let mut request = match verb { HttpVerb::Get => Request::get(url), diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 6e652c05..7c0de0b0 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -17,6 +17,7 @@ mod ui; use background_jobs::{background_jobs_main, BackgroundJob}; use log::info; +use nix::sys::stat::{umask, Mode}; use pty_writer::{pty_writer_main, PtyWriteInstruction}; use std::collections::{BTreeMap, HashMap, HashSet}; use std::{ @@ -25,7 +26,6 @@ use std::{ thread, }; use zellij_utils::envs; -use zellij_utils::nix::sys::stat::{umask, Mode}; use zellij_utils::pane_size::Size; use wasmtime::{Config as WasmtimeConfig, Engine, Strategy}; @@ -555,9 +555,8 @@ pub fn start_server(mut os_input: Box, socket_path: PathBuf) { let _ = thread::Builder::new() .name("server_listener".to_string()) .spawn({ - use zellij_utils::{ - interprocess::local_socket::LocalSocketListener, shared::set_permissions, - }; + use interprocess::local_socket::LocalSocketListener; + use zellij_utils::shared::set_permissions; let os_input = os_input.clone(); let session_data = session_data.clone(); diff --git a/zellij-server/src/logging_pipe.rs b/zellij-server/src/logging_pipe.rs index 5de45abe..b179694f 100644 --- a/zellij-server/src/logging_pipe.rs +++ b/zellij-server/src/logging_pipe.rs @@ -2,14 +2,13 @@ use std::{collections::VecDeque, io::Write}; use crate::plugins::PluginId; use log::{debug, error}; -use zellij_utils::{errors::prelude::*, serde}; +use zellij_utils::errors::prelude::*; use serde::{Deserialize, Serialize}; // 16kB log buffer const ZELLIJ_MAX_PIPE_BUFFER_SIZE: usize = 16_384; #[derive(Debug, Serialize, Deserialize)] -#[serde(crate = "self::serde")] pub struct LoggingPipe { buffer: VecDeque, plugin_name: String, diff --git a/zellij-server/src/os_input_output.rs b/zellij-server/src/os_input_output.rs index 59c63bd6..c6e4de78 100644 --- a/zellij-server/src/os_input_output.rs +++ b/zellij-server/src/os_input_output.rs @@ -11,23 +11,25 @@ use nix::{ unistd, }; +use async_std; +use interprocess; +use libc; +use nix; +use signal_hook; use signal_hook::consts::*; use sysinfo::{ProcessExt, ProcessRefreshKind, System, SystemExt}; +use tempfile::tempfile; use zellij_utils::{ - async_std, channels, + channels, channels::TrySendError, data::Palette, errors::prelude::*, input::command::{RunCommand, TerminalAction}, - interprocess, ipc::{ ClientToServerMsg, ExitReason, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg, }, - libc, nix, shared::default_palette, - signal_hook, - tempfile::tempfile, }; use std::{ diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index 15bec4f8..11f31d3c 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -1,11 +1,11 @@ use super::sixel::{PixelRect, SixelGrid, SixelImageStore}; +use regex::Regex; use std::borrow::Cow; use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; use zellij_utils::data::Style; use zellij_utils::errors::prelude::*; -use zellij_utils::regex::Regex; use std::{ cmp::Ordering, @@ -14,13 +14,13 @@ use std::{ str, }; +use vte; use zellij_utils::{ consts::{DEFAULT_SCROLL_BUFFER_SIZE, SCROLL_BUFFER_SIZE}, data::{Palette, PaletteColor, Styling}, input::mouse::{MouseEvent, MouseEventType}, pane_size::SizeInPixels, position::Position, - vte, }; const TABSTOP_WIDTH: usize = 8; // TODO: is this always right? diff --git a/zellij-server/src/panes/plugin_pane.rs b/zellij-server/src/panes/plugin_pane.rs index 3bfe9c24..9986585c 100644 --- a/zellij-server/src/panes/plugin_pane.rs +++ b/zellij-server/src/panes/plugin_pane.rs @@ -18,6 +18,7 @@ use crate::ui::{ use crate::ClientId; use std::cell::RefCell; use std::rc::Rc; +use vte; use zellij_utils::data::{ BareKey, KeyWithModifier, PermissionStatus, PermissionType, PluginPermission, }; @@ -31,7 +32,6 @@ use zellij_utils::{ input::mouse::{MouseEvent, MouseEventType}, pane_size::PaneGeom, shared::make_terminal_title, - vte, }; macro_rules! style { diff --git a/zellij-server/src/panes/terminal_character.rs b/zellij-server/src/panes/terminal_character.rs index 06e2fe42..d1ecbe26 100644 --- a/zellij-server/src/panes/terminal_character.rs +++ b/zellij-server/src/panes/terminal_character.rs @@ -5,12 +5,10 @@ use std::rc::Rc; use unicode_width::UnicodeWidthChar; use unicode_width::UnicodeWidthStr; +use vte::ParamsIter; use zellij_utils::data::StyleDeclaration; +use zellij_utils::data::{PaletteColor, Style}; use zellij_utils::input::command::RunCommand; -use zellij_utils::{ - data::{PaletteColor, Style}, - vte::ParamsIter, -}; use crate::panes::alacritty_functions::parse_sgr_color; diff --git a/zellij-server/src/panes/terminal_pane.rs b/zellij-server/src/panes/terminal_pane.rs index e1de0e89..eb2f862d 100644 --- a/zellij-server/src/panes/terminal_pane.rs +++ b/zellij-server/src/panes/terminal_pane.rs @@ -13,6 +13,7 @@ use std::collections::{HashMap, HashSet}; use std::fmt::Debug; use std::rc::Rc; use std::time::{self, Instant}; +use vte; use zellij_utils::input::command::RunCommand; use zellij_utils::input::mouse::{MouseEvent, MouseEventType}; use zellij_utils::pane_size::Offset; @@ -27,7 +28,6 @@ use zellij_utils::{ pane_size::SizeInPixels, position::Position, shared::make_terminal_title, - vte, }; use crate::ui::pane_boundaries_frame::{FrameParams, PaneFrame}; diff --git a/zellij-server/src/panes/unit/grid_tests.rs b/zellij-server/src/panes/unit/grid_tests.rs index 21c17b9e..32a7cdd9 100644 --- a/zellij-server/src/panes/unit/grid_tests.rs +++ b/zellij-server/src/panes/unit/grid_tests.rs @@ -5,11 +5,11 @@ use ::insta::assert_snapshot; use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; +use vte; use zellij_utils::{ data::{Palette, Style}, pane_size::SizeInPixels, position::Position, - vte, }; use std::fmt::Write; diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs index f1d11377..d7cb07d2 100644 --- a/zellij-server/src/plugins/mod.rs +++ b/zellij-server/src/plugins/mod.rs @@ -22,8 +22,8 @@ use crate::{pty::PtyInstruction, thread_bus::Bus, ClientId, ServerInstruction}; pub use wasm_bridge::PluginRenderAsset; use wasm_bridge::WasmBridge; +use async_std::{channel, future::timeout, task}; use zellij_utils::{ - async_std::{channel, future::timeout, task}, data::{ ClientInfo, Event, EventType, InputMode, MessageToPlugin, PermissionStatus, PermissionType, PipeMessage, PipeSource, PluginCapabilities, diff --git a/zellij-server/src/plugins/pipes.rs b/zellij-server/src/plugins/pipes.rs index 36cee46e..840af17b 100644 --- a/zellij-server/src/plugins/pipes.rs +++ b/zellij-server/src/plugins/pipes.rs @@ -6,8 +6,8 @@ use std::collections::{HashMap, HashSet}; use zellij_utils::data::{PipeMessage, PipeSource}; use zellij_utils::plugin_api::pipe_message::ProtobufPipeMessage; +use prost::Message; use zellij_utils::errors::prelude::*; -use zellij_utils::prost::Message; use crate::{thread_bus::ThreadSenders, ClientId}; diff --git a/zellij-server/src/plugins/plugin_loader.rs b/zellij-server/src/plugins/plugin_loader.rs index 4dac8df8..1dbe020e 100644 --- a/zellij-server/src/plugins/plugin_loader.rs +++ b/zellij-server/src/plugins/plugin_loader.rs @@ -6,6 +6,7 @@ use crate::plugins::zellij_exports::{wasi_write_object, zellij_exports}; use crate::plugins::PluginId; use highway::{HighwayHash, PortableHash}; use log::info; +use prost::Message; use std::{ collections::{HashMap, HashSet, VecDeque}, fs, @@ -16,7 +17,6 @@ use url::Url; use wasmtime::{Engine, Instance, Linker, Module, Store}; use wasmtime_wasi::{preview1::WasiP1Ctx, DirPerms, FilePerms, WasiCtxBuilder}; use zellij_utils::consts::ZELLIJ_PLUGIN_ARTIFACT_DIR; -use zellij_utils::prost::Message; use crate::{ logging_pipe::LoggingPipe, screen::ScreenInstruction, thread_bus::ThreadSenders, diff --git a/zellij-server/src/plugins/plugin_map.rs b/zellij-server/src/plugins/plugin_map.rs index 655aec50..6716dffd 100644 --- a/zellij-server/src/plugins/plugin_map.rs +++ b/zellij-server/src/plugins/plugin_map.rs @@ -16,7 +16,7 @@ use wasmtime_wasi::{ use crate::{thread_bus::ThreadSenders, ClientId}; -use zellij_utils::async_channel::Sender; +use async_channel::Sender; use zellij_utils::{ data::EventType, data::InputMode, diff --git a/zellij-server/src/plugins/plugin_worker.rs b/zellij-server/src/plugins/plugin_worker.rs index 635c8f50..30085a3a 100644 --- a/zellij-server/src/plugins/plugin_worker.rs +++ b/zellij-server/src/plugins/plugin_worker.rs @@ -2,11 +2,11 @@ use crate::plugins::plugin_map::PluginEnv; use crate::plugins::zellij_exports::wasi_write_object; use wasmtime::{Instance, Store}; -use zellij_utils::async_channel::{unbounded, Receiver, Sender}; -use zellij_utils::async_std::task; +use async_channel::{unbounded, Receiver, Sender}; +use async_std::task; +use prost::Message; use zellij_utils::errors::prelude::*; use zellij_utils::plugin_api::message::ProtobufMessage; -use zellij_utils::prost::Message; pub struct RunningWorker { pub instance: Instance, diff --git a/zellij-server/src/plugins/unit/plugin_tests.rs b/zellij-server/src/plugins/unit/plugin_tests.rs index 38b8448b..327252a1 100644 --- a/zellij-server/src/plugins/unit/plugin_tests.rs +++ b/zellij-server/src/plugins/unit/plugin_tests.rs @@ -2,6 +2,7 @@ use super::plugin_thread_main; use crate::screen::ScreenInstruction; use crate::{channels::SenderWithContext, thread_bus::Bus, ServerInstruction}; use insta::assert_snapshot; +use lazy_static::lazy_static; use std::collections::BTreeMap; use std::path::PathBuf; use tempfile::tempdir; @@ -18,7 +19,6 @@ use zellij_utils::input::layout::{ use zellij_utils::input::permission::PermissionCache; use zellij_utils::input::plugins::PluginAliases; use zellij_utils::ipc::ClientAttributes; -use zellij_utils::lazy_static::lazy_static; use zellij_utils::pane_size::Size; use crate::background_jobs::BackgroundJob; diff --git a/zellij-server/src/plugins/wasm_bridge.rs b/zellij-server/src/plugins/wasm_bridge.rs index 5bac0294..5efebf38 100644 --- a/zellij-server/src/plugins/wasm_bridge.rs +++ b/zellij-server/src/plugins/wasm_bridge.rs @@ -8,8 +8,11 @@ use crate::plugins::plugin_map::{AtomicEvent, PluginEnv, PluginMap, RunningPlugi use crate::plugins::plugin_worker::MessageToWorker; use crate::plugins::watch_filesystem::watch_filesystem; use crate::plugins::zellij_exports::{wasi_read_string, wasi_write_object}; +use async_channel::Sender; +use async_std::task::{self, JoinHandle}; use highway::{HighwayHash, PortableHash}; use log::info; +use notify_debouncer_full::{notify::RecommendedWatcher, Debouncer, FileIdMap}; use std::{ collections::{BTreeMap, HashMap, HashSet}, path::PathBuf, @@ -17,17 +20,14 @@ use std::{ sync::{Arc, Mutex}, }; use wasmtime::{Engine, Module}; -use zellij_utils::async_channel::Sender; -use zellij_utils::async_std::task::{self, JoinHandle}; use zellij_utils::consts::{ZELLIJ_CACHE_DIR, ZELLIJ_TMP_DIR}; use zellij_utils::data::{InputMode, PermissionStatus, PermissionType, PipeMessage, PipeSource}; use zellij_utils::downloader::Downloader; use zellij_utils::input::keybinds::Keybinds; use zellij_utils::input::permission::PermissionCache; -use zellij_utils::notify_debouncer_full::{notify::RecommendedWatcher, Debouncer, FileIdMap}; use zellij_utils::plugin_api::event::ProtobufEvent; -use zellij_utils::prost::Message; +use prost::Message; use crate::panes::PaneId; use crate::{ diff --git a/zellij-server/src/plugins/watch_filesystem.rs b/zellij-server/src/plugins/watch_filesystem.rs index d21d1c02..8cb01af2 100644 --- a/zellij-server/src/plugins/watch_filesystem.rs +++ b/zellij-server/src/plugins/watch_filesystem.rs @@ -5,7 +5,7 @@ use crate::thread_bus::ThreadSenders; use std::path::Path; use std::time::Duration; -use zellij_utils::notify_debouncer_full::{ +use notify_debouncer_full::{ new_debouncer, notify::{EventKind, RecommendedWatcher, RecursiveMode, Watcher}, DebounceEventResult, Debouncer, FileIdMap, diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs index 4c6496cc..25964938 100644 --- a/zellij-server/src/plugins/zellij_exports.rs +++ b/zellij-server/src/plugins/zellij_exports.rs @@ -5,6 +5,8 @@ use crate::plugins::wasm_bridge::handle_plugin_crash; use crate::pty::{ClientTabIndexOrPaneId, PtyInstruction}; use crate::route::route_action; use crate::ServerInstruction; +use async_std::task; +use interprocess::local_socket::LocalSocketStream; use log::warn; use serde::Serialize; use std::{ @@ -22,14 +24,11 @@ use zellij_utils::data::{ MessageToPlugin, OriginatingPlugin, PermissionStatus, PermissionType, PluginPermission, }; use zellij_utils::input::permission::PermissionCache; -use zellij_utils::{ - async_std::task, - interprocess::local_socket::LocalSocketStream, - ipc::{ClientToServerMsg, IpcSenderWithContext}, -}; +use zellij_utils::ipc::{ClientToServerMsg, IpcSenderWithContext}; use crate::{panes::PaneId, screen::ScreenInstruction}; +use prost::Message; use zellij_utils::{ consts::{VERSION, ZELLIJ_SESSION_INFO_CACHE_DIR, ZELLIJ_SOCK_DIR}, data::{ @@ -46,8 +45,6 @@ use zellij_utils::{ plugin_command::ProtobufPluginCommand, plugin_ids::{ProtobufPluginIds, ProtobufZellijVersion}, }, - prost::Message, - serde, }; macro_rules! apply_action { diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index 3bb5f227..450f0b0b 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -8,12 +8,14 @@ use crate::{ thread_bus::{Bus, ThreadSenders}, ClientId, ServerInstruction, }; -use async_std::task::{self, JoinHandle}; +use async_std::{ + self, + task::{self, JoinHandle}, +}; +use nix::unistd::Pid; use std::sync::Arc; use std::{collections::HashMap, os::unix::io::RawFd, path::PathBuf}; -use zellij_utils::nix::unistd::Pid; use zellij_utils::{ - async_std, data::{Event, FloatingPaneCoordinates, OriginatingPlugin}, errors::prelude::*, errors::{ContextType, PtyContext}, diff --git a/zellij-server/src/tab/clipboard.rs b/zellij-server/src/tab/clipboard.rs index 685c832c..d954b1c7 100644 --- a/zellij-server/src/tab/clipboard.rs +++ b/zellij-server/src/tab/clipboard.rs @@ -1,4 +1,5 @@ -use zellij_utils::{anyhow::Result, data::CopyDestination, input::options::Clipboard}; +use anyhow::Result; +use zellij_utils::{data::CopyDestination, input::options::Clipboard}; use crate::ClientId; diff --git a/zellij-server/src/tab/copy_command.rs b/zellij-server/src/tab/copy_command.rs index 0b2d84cf..f0a592ef 100644 --- a/zellij-server/src/tab/copy_command.rs +++ b/zellij-server/src/tab/copy_command.rs @@ -1,7 +1,7 @@ use std::io::prelude::*; use std::process::{Command, Stdio}; -use zellij_utils::anyhow::{Context, Result}; +use anyhow::{Context, Result}; pub struct CopyCommand { command: String, diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs index c7839ce6..507cfb3c 100644 --- a/zellij-server/src/tab/mod.rs +++ b/zellij-server/src/tab/mod.rs @@ -7,6 +7,7 @@ mod layout_applier; mod swap_layouts; use copy_command::CopyCommand; +use serde; use std::env::temp_dir; use std::path::PathBuf; use uuid::Uuid; @@ -17,8 +18,8 @@ use zellij_utils::data::{ use zellij_utils::errors::prelude::*; use zellij_utils::input::command::RunCommand; use zellij_utils::input::mouse::{MouseEvent, MouseEventType}; +use zellij_utils::position::Position; use zellij_utils::position::{Column, Line}; -use zellij_utils::{position::Position, serde}; use crate::background_jobs::BackgroundJob; use crate::pty_writer::PtyWriteInstruction; diff --git a/zellij-server/src/tab/unit/tab_integration_tests.rs b/zellij-server/src/tab/unit/tab_integration_tests.rs index 743d99f1..08c60cf6 100644 --- a/zellij-server/src/tab/unit/tab_integration_tests.rs +++ b/zellij-server/src/tab/unit/tab_integration_tests.rs @@ -37,10 +37,10 @@ use std::collections::{BTreeMap, HashMap, HashSet}; use std::os::unix::io::RawFd; use std::rc::Rc; +use interprocess::local_socket::LocalSocketStream; use zellij_utils::{ data::{InputMode, ModeInfo, Palette, Style}, input::command::{RunCommand, TerminalAction}, - interprocess::local_socket::LocalSocketStream, ipc::{ClientToServerMsg, ServerToClientMsg}, }; @@ -746,7 +746,7 @@ fn read_fixture(fixture_name: &str) -> Vec { use crate::panes::grid::Grid; use crate::panes::link_handler::LinkHandler; use insta::assert_snapshot; -use zellij_utils::vte; +use vte; fn take_snapshot(ansi_instructions: &str, rows: usize, columns: usize, palette: Palette) -> String { let sixel_image_store = Rc::new(RefCell::new(SixelImageStore::default())); @@ -5341,7 +5341,7 @@ fn close_main_stacked_pane_in_mid_stack() { swap_tiled_layout { tab { pane split_direction="vertical" { - pane + pane pane stacked=true { children; } } } diff --git a/zellij-server/src/tab/unit/tab_tests.rs b/zellij-server/src/tab/unit/tab_tests.rs index 101d77fd..05a9c84b 100644 --- a/zellij-server/src/tab/unit/tab_tests.rs +++ b/zellij-server/src/tab/unit/tab_tests.rs @@ -19,10 +19,10 @@ use std::collections::{HashMap, HashSet}; use std::os::unix::io::RawFd; use std::rc::Rc; +use interprocess::local_socket::LocalSocketStream; use zellij_utils::{ data::{ModeInfo, Palette, Style}, input::command::{RunCommand, TerminalAction}, - interprocess::local_socket::LocalSocketStream, ipc::{ClientToServerMsg, ServerToClientMsg}, }; diff --git a/zellij-server/src/terminal_bytes.rs b/zellij-server/src/terminal_bytes.rs index 9459e943..c6d901c2 100644 --- a/zellij-server/src/terminal_bytes.rs +++ b/zellij-server/src/terminal_bytes.rs @@ -9,7 +9,6 @@ use std::{ time::{Duration, Instant}, }; use zellij_utils::{ - async_std, errors::{get_current_ctx, prelude::*, ContextType}, logging::debug_to_file, }; diff --git a/zellij-server/src/ui/components/mod.rs b/zellij-server/src/ui/components/mod.rs index db4094eb..bc977f1c 100644 --- a/zellij-server/src/ui/components/mod.rs +++ b/zellij-server/src/ui/components/mod.rs @@ -5,8 +5,11 @@ mod table; mod text; use crate::panes::grid::Grid; +use lazy_static::lazy_static; +use regex::Regex; +use vte; +use zellij_utils::data::Style; use zellij_utils::errors::prelude::*; -use zellij_utils::{data::Style, lazy_static::lazy_static, regex::Regex, vte}; use component_coordinates::{is_too_high, is_too_wide, Coordinates}; use nested_list::{nested_list, parse_nested_list_items}; diff --git a/zellij-server/src/unit/screen_tests.rs b/zellij-server/src/unit/screen_tests.rs index bbb416fe..02ff99fc 100644 --- a/zellij-server/src/unit/screen_tests.rs +++ b/zellij-server/src/unit/screen_tests.rs @@ -35,10 +35,10 @@ use crate::{ }; use zellij_utils::ipc::PixelDimensions; +use interprocess::local_socket::LocalSocketStream; use zellij_utils::{ channels::{self, ChannelWithContext, Receiver}, data::{Direction, FloatingPaneCoordinates, InputMode, ModeInfo, Palette, PluginCapabilities}, - interprocess::local_socket::LocalSocketStream, ipc::{ClientAttributes, ClientToServerMsg, ServerToClientMsg}, }; @@ -48,7 +48,6 @@ use crate::panes::sixel::SixelImageStore; use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; -use zellij_utils::vte; fn take_snapshot_and_cursor_coordinates( ansi_instructions: &str, diff --git a/zellij-tile/Cargo.toml b/zellij-tile/Cargo.toml index 0fd04cb2..ab543e56 100644 --- a/zellij-tile/Cargo.toml +++ b/zellij-tile/Cargo.toml @@ -8,6 +8,7 @@ license = "MIT" [dependencies] clap = { workspace = true } +prost = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } strum = { workspace = true } diff --git a/zellij-tile/src/shim.rs b/zellij-tile/src/shim.rs index ed7b124e..bdb6c672 100644 --- a/zellij-tile/src/shim.rs +++ b/zellij-tile/src/shim.rs @@ -12,7 +12,7 @@ use zellij_utils::plugin_api::plugin_command::ProtobufPluginCommand; use zellij_utils::plugin_api::plugin_ids::{ProtobufPluginIds, ProtobufZellijVersion}; pub use super::ui_components::*; -pub use zellij_utils::prost::{self, *}; +pub use prost::{self, *}; // Subscription Handling diff --git a/zellij-tile/src/ui_components/mod.rs b/zellij-tile/src/ui_components/mod.rs index 0e7d4261..c3d19e9e 100644 --- a/zellij-tile/src/ui_components/mod.rs +++ b/zellij-tile/src/ui_components/mod.rs @@ -3,8 +3,8 @@ mod ribbon; mod table; mod text; +pub use prost::{self, *}; pub use zellij_utils::plugin_api; -pub use zellij_utils::prost::{self, *}; pub use nested_list::*; pub use ribbon::*; diff --git a/zellij-utils/Cargo.toml b/zellij-utils/Cargo.toml index 72d12830..b0cfb59c 100644 --- a/zellij-utils/Cargo.toml +++ b/zellij-utils/Cargo.toml @@ -11,7 +11,6 @@ include = ["src/**/*", "assets/"] [dependencies] anyhow = { workspace = true } -async-channel = { version = "1.8.0", default-features = false } backtrace = { version = "0.3.55", default-features = false, features = ["std"] } bitflags = { version = "2.5.0", default-features = false } clap = { workspace = true } @@ -22,14 +21,12 @@ crossbeam = { version = "0.8.1", default-features = false, features = ["alloc", directories = { version = "5.0", default-features = false } include_dir = { version = "0.7.3", default-features = false } kdl = { version = "4.5.0", default-features = false, features = ["span"] } -lazy_static = { version = "1.4.0", default-features = false } -libc = { version = "0.2", default-features = false, features = ["std"] } +lazy_static = { workspace = true } log = { workspace = true } -miette = { version = "5.7.0", default-features = false, features = ["fancy"] } -nix = { version = "0.23.1", default-features = false } +miette = { workspace = true } +nix = { workspace = true } percent-encoding = { version = "2.1.0", default-features = false, features = ["std"] } -prost = { version = "0.11.9", default-features = false, features = ["std", "prost-derive"] } -regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] } +prost = { workspace = true } rmp-serde = { version = "1.1.0", default-features = false } serde = { workspace = true } serde_json = { workspace = true } @@ -37,23 +34,19 @@ shellexpand = { version = "3.0.0", default-features = false, features = ["base-0 strip-ansi-escapes = { version = "0.1.0", default-features = false } strum = { workspace = true } strum_macros = { workspace = true } -tempfile = { version = "3.2.0", default-features = false } +tempfile = { workspace = true } thiserror = { workspace = true } unicode-width = { workspace = true } url = { workspace = true } uuid = { workspace = true } -vte = { version = "0.11.0", default-features = false } [target.'cfg(not(target_family = "wasm"))'.dependencies] -termwiz = { version = "0.23.2", default-features = false } +async-std = { workspace = true } log4rs = { version = "1.2.0", default-features = false, features = ["pattern_encoder", "rolling_file_appender", "compound_policy", "fixed_window_roller", "size_trigger"] } -notify-debouncer-full = { version = "0.1.0", default-features = false } -signal-hook = { version = "0.3", default-features = false, features = ["iterator"] } -interprocess = { version = "1.2.1", default-features = false } -async-std = { version = "1.3.0", default-features = false, features = ["attributes", "default", "std", "unstable"] } -humantime = { version = "2.1.0", default-features = false } +termwiz = { workspace = true } +interprocess = { workspace = true } openssl-sys = { version = "0.9.93", default-features = false, features = ["vendored"], optional = true } -isahc = { version = "1.7.2", default-features = false, features = ["http2", "text-decoding"] } +isahc = { workspace = true } curl-sys = { version = "0.4", default-features = false, features = ["force-system-lib-on-osx", "ssl"], optional = true } [dev-dependencies] diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs index 9c419773..7c5ccc6d 100644 --- a/zellij-utils/src/errors.rs +++ b/zellij-utils/src/errors.rs @@ -785,7 +785,7 @@ mod not_wasm { /// Helper trait to convert error types that don't satisfy `anyhow`s trait requirements to /// anyhow errors. pub trait ToAnyhow { - fn to_anyhow(self) -> crate::anyhow::Result; + fn to_anyhow(self) -> anyhow::Result; } /// `SendError` doesn't satisfy `anyhow`s trait requirements due to `T` possibly being a @@ -798,19 +798,19 @@ mod not_wasm { impl ToAnyhow for Result> { - fn to_anyhow(self) -> crate::anyhow::Result { + fn to_anyhow(self) -> anyhow::Result { match self { - Ok(val) => crate::anyhow::Ok(val), + Ok(val) => anyhow::Ok(val), Err(e) => { let (msg, context) = e.into_inner(); if *crate::consts::DEBUG_MODE.get().unwrap_or(&true) { - Err(crate::anyhow::anyhow!( + Err(anyhow::anyhow!( "failed to send message to channel: {:#?}", msg )) .with_context(|| context.to_string()) } else { - Err(crate::anyhow::anyhow!("failed to send message to channel")) + Err(anyhow::anyhow!("failed to send message to channel")) .with_context(|| context.to_string()) } }, @@ -819,16 +819,14 @@ mod not_wasm { } impl ToAnyhow for Result> { - fn to_anyhow(self) -> crate::anyhow::Result { + fn to_anyhow(self) -> anyhow::Result { match self { - Ok(val) => crate::anyhow::Ok(val), + Ok(val) => anyhow::Ok(val), Err(e) => { if *crate::consts::DEBUG_MODE.get().unwrap_or(&true) { - Err(crate::anyhow::anyhow!( - "cannot acquire poisoned lock for {e:#?}" - )) + Err(anyhow::anyhow!("cannot acquire poisoned lock for {e:#?}")) } else { - Err(crate::anyhow::anyhow!("cannot acquire poisoned lock")) + Err(anyhow::anyhow!("cannot acquire poisoned lock")) } }, } diff --git a/zellij-utils/src/lib.rs b/zellij-utils/src/lib.rs index 2085473f..06779d02 100644 --- a/zellij-utils/src/lib.rs +++ b/zellij-utils/src/lib.rs @@ -24,12 +24,3 @@ pub mod downloader; // Requires async_std pub mod ipc; // Requires interprocess #[cfg(not(target_family = "wasm"))] pub mod logging; // Requires log4rs - -#[cfg(not(target_family = "wasm"))] -pub use ::{ - anyhow, async_channel, async_std, clap, humantime, interprocess, isahc, lazy_static, libc, - miette, nix, notify_debouncer_full, regex, serde, signal_hook, tempfile, termwiz, url, uuid, - vte, -}; - -pub use ::prost;