From 83d72e5c1c0b983f4b63f3f64f9a1de7600985f4 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 7 Feb 2024 11:25:14 -0500 Subject: [PATCH] refactor: extract out `runtime::colors` to `deno_terminal::colors` (#22324) --- Cargo.lock | 13 +- Cargo.toml | 1 + cli/Cargo.toml | 1 + cli/args/mod.rs | 2 +- cli/diagnostics.rs | 2 +- cli/main.rs | 2 +- cli/module_loader.rs | 2 +- cli/tools/bundle.rs | 2 +- cli/tools/check.rs | 2 +- cli/tools/compile.rs | 2 +- cli/tools/info.rs | 2 +- cli/tools/jupyter/mod.rs | 2 +- cli/tools/registry/mod.rs | 2 +- cli/tools/run/hmr.rs | 2 +- cli/tsc/diagnostics.rs | 2 +- cli/util/progress_bar/renderer.rs | 2 +- cli/worker.rs | 6 +- runtime/Cargo.toml | 2 +- runtime/colors.rs | 230 ------------------------------ runtime/fmt_errors.rs | 8 +- runtime/lib.rs | 1 - runtime/permissions/mod.rs | 2 +- runtime/permissions/prompter.rs | 2 +- runtime/web_worker.rs | 2 +- runtime/worker_bootstrap.rs | 4 +- 25 files changed, 40 insertions(+), 258 deletions(-) delete mode 100644 runtime/colors.rs diff --git a/Cargo.lock b/Cargo.lock index 345323b583..d9ac616634 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -994,6 +994,7 @@ dependencies = [ "deno_runtime", "deno_semver", "deno_task_shell", + "deno_terminal", "dissimilar", "dotenvy", "dprint-plugin-json", @@ -1681,6 +1682,7 @@ dependencies = [ "deno_napi", "deno_net", "deno_node", + "deno_terminal", "deno_tls", "deno_url", "deno_web", @@ -1712,7 +1714,6 @@ dependencies = [ "rustyline", "serde", "signal-hook-registry", - "termcolor", "test_util", "tokio", "tokio-metrics", @@ -1752,6 +1753,16 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "deno_terminal" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b847702ef57565e1417fad2291f65a3c8a5ecf2ba38d64e56f02828e7546d891" +dependencies = [ + "once_cell", + "termcolor", +] + [[package]] name = "deno_tls" version = "0.123.0" diff --git a/Cargo.toml b/Cargo.toml index e081f8c670..c4d2ca0147 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,6 +48,7 @@ deno_bench_util = { version = "0.130.0", path = "./bench_util" } deno_lockfile = "0.18.0" deno_media_type = { version = "0.1.1", features = ["module_specifier"] } deno_runtime = { version = "0.144.0", path = "./runtime" } +deno_terminal = "0.1.0" napi_sym = { version = "0.66.0", path = "./cli/napi/sym" } test_util = { path = "./test_util" } diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 145544f58e..a60e56a4f3 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -66,6 +66,7 @@ deno_npm = "=0.16.0" deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_semver = "=0.5.4" deno_task_shell = "=0.14.3" +deno_terminal.workspace = true eszip = "=0.60.0" napi_sym.workspace = true diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 6af39ff458..419066fbaa 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -42,7 +42,6 @@ use deno_core::normalize_path; use deno_core::parking_lot::Mutex; use deno_core::serde_json; use deno_core::url::Url; -use deno_runtime::colors; use deno_runtime::deno_node::PackageJson; use deno_runtime::deno_tls::deno_native_certs::load_native_certs; use deno_runtime::deno_tls::rustls; @@ -51,6 +50,7 @@ use deno_runtime::deno_tls::rustls_pemfile; use deno_runtime::deno_tls::webpki_roots; use deno_runtime::inspector_server::InspectorServer; use deno_runtime::permissions::PermissionsOptions; +use deno_terminal::colors; use dotenvy::from_filename; use once_cell::sync::Lazy; use once_cell::sync::OnceCell; diff --git a/cli/diagnostics.rs b/cli/diagnostics.rs index f6f68e1d02..7eff66d768 100644 --- a/cli/diagnostics.rs +++ b/cli/diagnostics.rs @@ -11,7 +11,7 @@ use deno_ast::SourcePos; use deno_ast::SourceRange; use deno_ast::SourceRanged; use deno_ast::SourceTextInfo; -use deno_runtime::colors; +use deno_terminal::colors; use unicode_width::UnicodeWidthStr; use crate::cache::LazyGraphSourceParser; diff --git a/cli/main.rs b/cli/main.rs index 3f49677d8d..9d0ade0858 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -42,9 +42,9 @@ use deno_core::error::JsError; use deno_core::futures::FutureExt; use deno_core::unsync::JoinHandle; use deno_npm::resolution::SnapshotFromLockfileError; -use deno_runtime::colors; use deno_runtime::fmt_errors::format_js_error; use deno_runtime::tokio_util::create_and_run_current_thread_with_maybe_metrics; +use deno_terminal::colors; use factory::CliFactory; use std::env; use std::env::current_exe; diff --git a/cli/module_loader.rs b/cli/module_loader.rs index 0058b9be07..4b120796b2 100644 --- a/cli/module_loader.rs +++ b/cli/module_loader.rs @@ -52,10 +52,10 @@ use deno_graph::JsonModule; use deno_graph::Module; use deno_graph::Resolution; use deno_lockfile::Lockfile; -use deno_runtime::colors; use deno_runtime::deno_fs; use deno_runtime::permissions::PermissionsContainer; use deno_semver::npm::NpmPackageReqReference; +use deno_terminal::colors; use std::borrow::Cow; use std::collections::HashSet; use std::pin::Pin; diff --git a/cli/tools/bundle.rs b/cli/tools/bundle.rs index 33ec78fc95..4099ad41ae 100644 --- a/cli/tools/bundle.rs +++ b/cli/tools/bundle.rs @@ -4,7 +4,7 @@ use std::path::PathBuf; use deno_core::error::AnyError; use deno_graph::Module; -use deno_runtime::colors; +use deno_terminal::colors; use crate::args::BundleFlags; use crate::args::CliOptions; diff --git a/cli/tools/check.rs b/cli/tools/check.rs index 90a1d0299d..6e14d09f50 100644 --- a/cli/tools/check.rs +++ b/cli/tools/check.rs @@ -9,8 +9,8 @@ use deno_ast::ModuleSpecifier; use deno_core::error::AnyError; use deno_graph::Module; use deno_graph::ModuleGraph; -use deno_runtime::colors; use deno_runtime::deno_node::NodeResolver; +use deno_terminal::colors; use once_cell::sync::Lazy; use regex::Regex; diff --git a/cli/tools/compile.rs b/cli/tools/compile.rs index a97ddcdf8d..70baed6696 100644 --- a/cli/tools/compile.rs +++ b/cli/tools/compile.rs @@ -11,7 +11,7 @@ use deno_core::error::generic_error; use deno_core::error::AnyError; use deno_core::resolve_url_or_path; use deno_graph::GraphKind; -use deno_runtime::colors; +use deno_terminal::colors; use std::path::Path; use std::path::PathBuf; use std::sync::Arc; diff --git a/cli/tools/info.rs b/cli/tools/info.rs index a9d6a8c59b..30ceb98e46 100644 --- a/cli/tools/info.rs +++ b/cli/tools/info.rs @@ -20,10 +20,10 @@ use deno_graph::Resolution; use deno_npm::resolution::NpmResolutionSnapshot; use deno_npm::NpmPackageId; use deno_npm::NpmResolutionPackage; -use deno_runtime::colors; use deno_semver::npm::NpmPackageNvReference; use deno_semver::npm::NpmPackageReqReference; use deno_semver::package::PackageNv; +use deno_terminal::colors; use crate::args::Flags; use crate::args::InfoFlags; diff --git a/cli/tools/jupyter/mod.rs b/cli/tools/jupyter/mod.rs index c74b295867..ea58328bb0 100644 --- a/cli/tools/jupyter/mod.rs +++ b/cli/tools/jupyter/mod.rs @@ -13,11 +13,11 @@ use deno_core::located_script_name; use deno_core::resolve_url_or_path; use deno_core::serde::Deserialize; use deno_core::serde_json; -use deno_runtime::colors; use deno_runtime::deno_io::Stdio; use deno_runtime::deno_io::StdioPipe; use deno_runtime::permissions::Permissions; use deno_runtime::permissions::PermissionsContainer; +use deno_terminal::colors; use tokio::sync::mpsc; use tokio::sync::mpsc::unbounded_channel; use tokio::sync::mpsc::UnboundedSender; diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs index 22f53dab41..5f03fa6fd4 100644 --- a/cli/tools/registry/mod.rs +++ b/cli/tools/registry/mod.rs @@ -15,8 +15,8 @@ use deno_core::futures::FutureExt; use deno_core::serde_json; use deno_core::serde_json::json; use deno_core::unsync::JoinSet; -use deno_runtime::colors; use deno_runtime::deno_fetch::reqwest; +use deno_terminal::colors; use import_map::ImportMap; use lsp_types::Url; use serde::Serialize; diff --git a/cli/tools/run/hmr.rs b/cli/tools/run/hmr.rs index bfed22d07a..88f90f680a 100644 --- a/cli/tools/run/hmr.rs +++ b/cli/tools/run/hmr.rs @@ -11,7 +11,7 @@ use deno_core::serde_json::json; use deno_core::serde_json::{self}; use deno_core::url::Url; use deno_core::LocalInspectorSession; -use deno_runtime::colors; +use deno_terminal::colors; use std::collections::HashMap; use std::path::PathBuf; use std::sync::Arc; diff --git a/cli/tsc/diagnostics.rs b/cli/tsc/diagnostics.rs index 2030b5ba2f..362385c07a 100644 --- a/cli/tsc/diagnostics.rs +++ b/cli/tsc/diagnostics.rs @@ -2,7 +2,7 @@ use deno_ast::ModuleSpecifier; use deno_graph::ModuleGraph; -use deno_runtime::colors; +use deno_terminal::colors; use deno_core::serde::Deserialize; use deno_core::serde::Deserializer; diff --git a/cli/util/progress_bar/renderer.rs b/cli/util/progress_bar/renderer.rs index aed4c54b95..a8eb076369 100644 --- a/cli/util/progress_bar/renderer.rs +++ b/cli/util/progress_bar/renderer.rs @@ -2,7 +2,7 @@ use std::time::Duration; -use deno_runtime::colors; +use deno_terminal::colors; use crate::util::display::human_download_size; diff --git a/cli/worker.rs b/cli/worker.rs index 4423f32280..e5a7505979 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -23,7 +23,6 @@ use deno_core::PollEventLoopOptions; use deno_core::SharedArrayBufferStore; use deno_core::SourceMapGetter; use deno_lockfile::Lockfile; -use deno_runtime::colors; use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel; use deno_runtime::deno_fs; use deno_runtime::deno_node; @@ -44,6 +43,7 @@ use deno_runtime::BootstrapOptions; use deno_runtime::WorkerLogLevel; use deno_semver::npm::NpmPackageReqReference; use deno_semver::package::PackageReqReference; +use deno_terminal::colors; use tokio::select; use crate::args::package_json::PackageJsonDeps; @@ -583,7 +583,7 @@ impl CliMainWorkerFactory { locale: deno_core::v8::icu::get_language_tag(), location: shared.options.location.clone(), no_color: !colors::use_color(), - is_tty: colors::is_tty(), + is_tty: deno_terminal::is_stdout_tty(), unstable: shared.options.unstable, unstable_features, user_agent: version::get_user_agent().to_string(), @@ -789,7 +789,7 @@ fn create_web_worker_callback( locale: deno_core::v8::icu::get_language_tag(), location: Some(args.main_module.clone()), no_color: !colors::use_color(), - is_tty: colors::is_tty(), + is_tty: deno_terminal::is_stdout_tty(), unstable: shared.options.unstable, unstable_features, user_agent: version::get_user_agent().to_string(), diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 083d8005f7..1c897b9383 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -90,6 +90,7 @@ deno_kv.workspace = true deno_napi.workspace = true deno_net.workspace = true deno_node.workspace = true +deno_terminal.workspace = true deno_tls.workspace = true deno_url.workspace = true deno_web.workspace = true @@ -119,7 +120,6 @@ ring.workspace = true rustyline = { workspace = true, features = ["custom-bindings"] } serde.workspace = true signal-hook-registry = "1.4.0" -termcolor = "1.1.3" tokio.workspace = true tokio-metrics.workspace = true uuid.workspace = true diff --git a/runtime/colors.rs b/runtime/colors.rs deleted file mode 100644 index ff9ee24dbc..0000000000 --- a/runtime/colors.rs +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - -use once_cell::sync::Lazy; -use std::fmt; -use std::fmt::Write as _; -use std::io::IsTerminal; -use termcolor::Ansi; -use termcolor::Color::Ansi256; -use termcolor::Color::Black; -use termcolor::Color::Blue; -use termcolor::Color::Cyan; -use termcolor::Color::Green; -use termcolor::Color::Magenta; -use termcolor::Color::Red; -use termcolor::Color::White; -use termcolor::Color::Yellow; -use termcolor::ColorSpec; -use termcolor::WriteColor; - -#[cfg(windows)] -use termcolor::BufferWriter; -#[cfg(windows)] -use termcolor::ColorChoice; - -static NO_COLOR: Lazy = Lazy::new(|| { - std::env::var_os("NO_COLOR") - .map(|v| !v.is_empty()) - .unwrap_or(false) -}); - -static IS_TTY: Lazy = Lazy::new(|| std::io::stdout().is_terminal()); - -pub fn is_tty() -> bool { - *IS_TTY -} - -pub fn use_color() -> bool { - !(*NO_COLOR) -} - -#[cfg(windows)] -pub fn enable_ansi() { - BufferWriter::stdout(ColorChoice::AlwaysAnsi); -} - -/// A struct that can adapt a `fmt::Write` to a `std::io::Write`. If anything -/// that can not be represented as UTF-8 is written to this writer, it will -/// return an error. -struct StdFmtStdIoWriter<'a>(&'a mut dyn fmt::Write); - -impl std::io::Write for StdFmtStdIoWriter<'_> { - fn write(&mut self, buf: &[u8]) -> std::io::Result { - let str = std::str::from_utf8(buf).map_err(|_| { - std::io::Error::new( - std::io::ErrorKind::Other, - "failed to convert bytes to str", - ) - })?; - match self.0.write_str(str) { - Ok(_) => Ok(buf.len()), - Err(_) => Err(std::io::Error::new( - std::io::ErrorKind::Other, - "failed to write to fmt::Write", - )), - } - } - - fn flush(&mut self) -> std::io::Result<()> { - Ok(()) - } -} - -/// A struct that can adapt a `std::io::Write` to a `fmt::Write`. -struct StdIoStdFmtWriter<'a>(&'a mut dyn std::io::Write); - -impl fmt::Write for StdIoStdFmtWriter<'_> { - fn write_str(&mut self, s: &str) -> fmt::Result { - self.0.write_all(s.as_bytes()).map_err(|_| fmt::Error)?; - Ok(()) - } -} - -pub struct Style { - colorspec: ColorSpec, - inner: I, -} - -impl fmt::Display for Style { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if !use_color() { - return fmt::Display::fmt(&self.inner, f); - } - let mut ansi_writer = Ansi::new(StdFmtStdIoWriter(f)); - ansi_writer - .set_color(&self.colorspec) - .map_err(|_| fmt::Error)?; - write!(StdIoStdFmtWriter(&mut ansi_writer), "{}", self.inner)?; - ansi_writer.reset().map_err(|_| fmt::Error)?; - Ok(()) - } -} - -#[inline] -fn style<'a, S: fmt::Display + 'a>(s: S, colorspec: ColorSpec) -> Style { - Style { - colorspec, - inner: s, - } -} - -pub fn red_bold<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Red)).set_bold(true); - style(s, style_spec) -} - -pub fn green_bold<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Green)).set_bold(true); - style(s, style_spec) -} - -pub fn yellow_bold<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Yellow)).set_bold(true); - style(s, style_spec) -} - -pub fn italic<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_italic(true); - style(s, style_spec) -} - -pub fn italic_gray<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Ansi256(8))).set_italic(true); - style(s, style_spec) -} - -pub fn italic_bold<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_bold(true).set_italic(true); - style(s, style_spec) -} - -pub fn white_on_red<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_bg(Some(Red)).set_fg(Some(White)); - style(s, style_spec) -} - -pub fn black_on_green<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_bg(Some(Green)).set_fg(Some(Black)); - style(s, style_spec) -} - -pub fn yellow<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Yellow)); - style(s, style_spec) -} - -pub fn cyan<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Cyan)); - style(s, style_spec) -} - -pub fn cyan_with_underline<'a>( - s: impl fmt::Display + 'a, -) -> impl fmt::Display + 'a { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Cyan)).set_underline(true); - style(s, style_spec) -} - -pub fn cyan_bold<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Cyan)).set_bold(true); - style(s, style_spec) -} - -pub fn magenta<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Magenta)); - style(s, style_spec) -} - -pub fn red<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Red)); - style(s, style_spec) -} - -pub fn green<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Green)); - style(s, style_spec) -} - -pub fn bold<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_bold(true); - style(s, style_spec) -} - -pub fn gray<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Ansi256(245))); - style(s, style_spec) -} - -pub fn intense_blue<'a, S: fmt::Display + 'a>(s: S) -> Style { - let mut style_spec = ColorSpec::new(); - style_spec.set_fg(Some(Blue)).set_intense(true); - style(s, style_spec) -} - -pub fn white_bold_on_red<'a>( - s: impl fmt::Display + 'a, -) -> impl fmt::Display + 'a { - let mut style_spec = ColorSpec::new(); - style_spec - .set_bold(true) - .set_bg(Some(Red)) - .set_fg(Some(White)); - style(s, style_spec) -} diff --git a/runtime/fmt_errors.rs b/runtime/fmt_errors.rs index 6ec63c007c..af7d760519 100644 --- a/runtime/fmt_errors.rs +++ b/runtime/fmt_errors.rs @@ -1,12 +1,12 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. //! This mod provides DenoError to unify errors across Deno. -use crate::colors::cyan; -use crate::colors::italic_bold; -use crate::colors::red; -use crate::colors::yellow; use deno_core::error::format_file_name; use deno_core::error::JsError; use deno_core::error::JsStackFrame; +use deno_terminal::colors::cyan; +use deno_terminal::colors::italic_bold; +use deno_terminal::colors::red; +use deno_terminal::colors::yellow; use std::fmt::Write as _; #[derive(Debug, Clone)] diff --git a/runtime/lib.rs b/runtime/lib.rs index fd791974db..b63fd41340 100644 --- a/runtime/lib.rs +++ b/runtime/lib.rs @@ -24,7 +24,6 @@ pub use deno_webidl; pub use deno_websocket; pub use deno_webstorage; -pub mod colors; pub mod errors; pub mod fmt_errors; pub mod fs_util; diff --git a/runtime/permissions/mod.rs b/runtime/permissions/mod.rs index bdefe4f12a..2cdbc60148 100644 --- a/runtime/permissions/mod.rs +++ b/runtime/permissions/mod.rs @@ -1,6 +1,5 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::colors; use crate::fs_util::resolve_from_cwd; use deno_core::error::custom_error; use deno_core::error::type_error; @@ -15,6 +14,7 @@ use deno_core::serde_json; use deno_core::url; use deno_core::url::Url; use deno_core::ModuleSpecifier; +use deno_terminal::colors; use log; use once_cell::sync::Lazy; use std::borrow::Cow; diff --git a/runtime/permissions/prompter.rs b/runtime/permissions/prompter.rs index 145e0a82e8..f054b31f38 100644 --- a/runtime/permissions/prompter.rs +++ b/runtime/permissions/prompter.rs @@ -1,8 +1,8 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::colors; use deno_core::error::AnyError; use deno_core::parking_lot::Mutex; +use deno_terminal::colors; use once_cell::sync::Lazy; use std::fmt::Write; use std::io::BufRead; diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index 78674af021..b21833a2e4 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -1,5 +1,4 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -use crate::colors; use crate::inspector_server::InspectorServer; use crate::ops; use crate::permissions::PermissionsContainer; @@ -45,6 +44,7 @@ use deno_fs::FileSystem; use deno_http::DefaultHttpPropertyExtractor; use deno_io::Stdio; use deno_kv::dynamic::MultiBackendDbHandler; +use deno_terminal::colors; use deno_tls::RootCertStoreProvider; use deno_web::create_entangled_message_port; use deno_web::BlobStore; diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs index 519abf74cd..ca2d4d8ece 100644 --- a/runtime/worker_bootstrap.rs +++ b/runtime/worker_bootstrap.rs @@ -6,7 +6,7 @@ use serde::Serialize; use std::cell::RefCell; use std::thread; -use crate::colors; +use deno_terminal::colors; /// The log level to use when printing diagnostic log messages, warnings, /// or errors in the worker. @@ -77,7 +77,7 @@ impl Default for BootstrapOptions { user_agent, cpu_count, no_color: !colors::use_color(), - is_tty: colors::is_tty(), + is_tty: deno_terminal::is_stdout_tty(), enable_op_summary_metrics: Default::default(), enable_testing_features: Default::default(), log_level: Default::default(),