From ee2e6933403811d398540e0e8275b2d216546dd8 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Fri, 19 Jul 2024 12:39:05 +0200 Subject: fix(node): support `tty.hasColors()` and `tty.getColorDepth()` (#24619) This PR adds support for [`tty.WriteStream.prototype.hasColors()`](https://nodejs.org/api/tty.html#writestreamhascolorscount-env) and [`tty.WriteStream.prototype.getColorDepth()`](https://nodejs.org/api/tty.html#writestreamgetcolordepthenv). I couldn't find any usage on GitHub which passes parameters to it. Therefore I've skipped adding support for the `env` parameter to keep our snapshot size small. Based on https://github.com/denoland/deno_terminal/pull/3 Fixes https://github.com/denoland/deno/issues/24616 --- cli/worker.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cli') diff --git a/cli/worker.rs b/cli/worker.rs index 9125f28be..36435d634 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -571,6 +571,7 @@ impl CliMainWorkerFactory { no_color: !colors::use_color(), is_stdout_tty: deno_terminal::is_stdout_tty(), is_stderr_tty: deno_terminal::is_stderr_tty(), + color_level: colors::get_color_level(), unstable: shared.options.unstable, unstable_features, user_agent: version::get_user_agent().to_string(), @@ -773,6 +774,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(), + color_level: colors::get_color_level(), is_stdout_tty: deno_terminal::is_stdout_tty(), is_stderr_tty: deno_terminal::is_stderr_tty(), unstable: shared.options.unstable, -- cgit v1.2.3