From 04cf993530d22680241166f5dbf269643fe151ff Mon Sep 17 00:00:00 2001 From: mattwparas Date: Mon, 13 Nov 2023 20:22:33 -0800 Subject: [PATCH] remove color library entirely --- Cargo.lock | 1 - Cargo.toml | 2 +- crates/steel-core/Cargo.toml | 3 - crates/steel-core/src/primitives.rs | 2 - crates/steel-core/src/primitives/colors.rs | 90 -------------------- crates/steel-core/src/steel_vm/primitives.rs | 5 -- 6 files changed, 1 insertion(+), 102 deletions(-) delete mode 100644 crates/steel-core/src/primitives/colors.rs diff --git a/Cargo.lock b/Cargo.lock index e6f7441bc..7ee6535a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3083,7 +3083,6 @@ dependencies = [ "bincode", "chrono", "codespan-reporting", - "colored", "cranelift", "cranelift-jit", "cranelift-module", diff --git a/Cargo.toml b/Cargo.toml index b4d976edf..2e9af5b02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ path = "src/main.rs" [workspace.dependencies] # This has to line up with the workspace version above -steel-core = { path = "./crates/steel-core", version = "0.5.0", features = ["web", "sqlite", "blocking_requests", "dylibs", "markdown", "colors"] } +steel-core = { path = "./crates/steel-core", version = "0.5.0", features = ["web", "sqlite", "blocking_requests", "dylibs", "markdown"] } [dependencies] once_cell = "1.17.0" diff --git a/crates/steel-core/Cargo.toml b/crates/steel-core/Cargo.toml index fd2ac0de8..c39f15156 100644 --- a/crates/steel-core/Cargo.toml +++ b/crates/steel-core/Cargo.toml @@ -49,8 +49,6 @@ radix_fmt = "1.0.0" # For structs smallvec = { version = "1.10.0", optional = true } -colored = { version = "2.0.0", optional = true } - # Pretty printing documentation termimad = { version = "0.21.0", optional = true } @@ -80,7 +78,6 @@ steel-gen = { path = "../steel-gen", version = "0.2.0" } [features] default = ["modules"] -colors = ["dep:colored"] modules = [] jit = ["dep:cranelift", "dep:cranelift-module", "dep:cranelift-jit"] dynamic = [] diff --git a/crates/steel-core/src/primitives.rs b/crates/steel-core/src/primitives.rs index 8104c7341..8197954d8 100644 --- a/crates/steel-core/src/primitives.rs +++ b/crates/steel-core/src/primitives.rs @@ -27,8 +27,6 @@ pub mod sqlite; #[cfg(feature = "blocking_requests")] pub mod blocking_requests; -pub mod colors; - pub use lists::UnRecoverableResult; use crate::values::closed::HeapRef; diff --git a/crates/steel-core/src/primitives/colors.rs b/crates/steel-core/src/primitives/colors.rs deleted file mode 100644 index 9daaeae71..000000000 --- a/crates/steel-core/src/primitives/colors.rs +++ /dev/null @@ -1,90 +0,0 @@ -use crate::steel_vm::builtin::BuiltInModule; -use crate::steel_vm::register_fn::RegisterFn; - -#[cfg(feature = "colors")] -use colored::{ColoredString, Colorize}; - -#[cfg(feature = "colors")] -impl crate::rvals::Custom for ColoredString { - fn fmt(&self) -> Option> { - Some(Ok(format!("{}", self))) - } -} - -macro_rules! wrap_coloring { - ($($name:ident),* $(,)?) => { - - - $ ( - #[cfg(feature = "colors")] - fn $name(string: String) -> ColoredString { - string.$name() - } - ) * - - - - $ ( - #[cfg(not(feature = "colors"))] - fn $name(string: String) -> String { - string - } - ) * - - pub fn string_coloring_module() -> BuiltInModule { - let mut module = BuiltInModule::new("steel/strings/colors".to_string()); - - $ ( - module.register_fn(stringify!($name), $name); - ) * - - module - - } - }; -} - -wrap_coloring! { - black, - red, - green, - yellow, - blue, - magenta, - purple, - cyan, - white, - bright_black, - bright_red, - bright_green, - bright_yellow, - bright_blue, - bright_white, - on_black, - on_red, - on_green, - on_yellow, - on_blue, - on_magenta, - on_purple, - on_cyan, - on_white, - on_bright_black, - on_bright_red, - on_bright_green, - on_bright_yellow, - on_bright_blue, - on_bright_magenta, - on_bright_purple, - on_bright_cyan, - on_bright_white, - normal, - bold, - dimmed, - italic, - underline, - blink, - reversed, - hidden, - strikethrough -} diff --git a/crates/steel-core/src/steel_vm/primitives.rs b/crates/steel-core/src/steel_vm/primitives.rs index 6402afdda..2239f850b 100644 --- a/crates/steel-core/src/steel_vm/primitives.rs +++ b/crates/steel-core/src/steel_vm/primitives.rs @@ -53,8 +53,6 @@ use crate::{ #[cfg(feature = "web")] use crate::primitives::web::{requests::requests_module, websockets::websockets_module}; -use crate::primitives::colors::string_coloring_module; - use crate::values::lists::List; use im_rc::HashMap; use num::{Signed, ToPrimitive}; @@ -322,7 +320,6 @@ thread_local! { #[cfg(feature = "blocking_requests")] pub static BLOCKING_REQUESTS_MODULE: BuiltInModule = crate::primitives::blocking_requests::blocking_requests_module(); - pub static STRING_COLORS_MODULE: BuiltInModule = string_coloring_module(); #[cfg(feature = "sqlite")] pub static SQLITE_MODULE: BuiltInModule = crate::primitives::sqlite::sqlite_module(); @@ -469,8 +466,6 @@ pub fn register_builtin_modules(engine: &mut Engine) { engine.register_module(MUTABLE_VECTOR_MODULE.with(|x| x.clone())); engine.register_module(PRIVATE_READER_MODULE.with(|x| x.clone())); - engine.register_module(STRING_COLORS_MODULE.with(|x| x.clone())); - #[cfg(feature = "web")] engine .register_module(WEBSOCKETS_MODULE.with(|x| x.clone()))