Update supports-color to 9.4.0

Produced via `cp ../supports-color/{index,browser}.{js,d.ts} source/vendor/supports-color`
This commit is contained in:
silverwind 2023-06-28 19:31:37 +02:00
parent a370f468a4
commit bf8a5b290f
No known key found for this signature in database
GPG key ID: 2E62B41C93869443
3 changed files with 7 additions and 6 deletions

View file

@ -3,7 +3,7 @@
const level = (() => { const level = (() => {
if (navigator.userAgentData) { if (navigator.userAgentData) {
const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium'); const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
if (brand && brand.version > 93) { if (brand?.version > 93) {
return 3; return 3;
} }
} }

View file

@ -1,13 +1,13 @@
import type {WriteStream} from 'node:tty'; import type {WriteStream} from 'node:tty';
export type Options = { export interface Options {
/** /**
Whether `process.argv` should be sniffed for `--color` and `--no-color` flags. Whether `process.argv` should be sniffed for `--color` and `--no-color` flags.
@default true @default true
*/ */
readonly sniffFlags?: boolean; readonly sniffFlags?: boolean;
}; }
/** /**
Levels: Levels:
@ -21,7 +21,7 @@ export type ColorSupportLevel = 0 | 1 | 2 | 3;
/** /**
Detect whether the terminal supports color. Detect whether the terminal supports color.
*/ */
export type ColorSupport = { export interface ColorSupport {
/** /**
The color level. The color level.
*/ */
@ -41,7 +41,7 @@ export type ColorSupport = {
Whether Truecolor 16 million colors are supported. Whether Truecolor 16 million colors are supported.
*/ */
has16m: boolean; has16m: boolean;
}; }
export type ColorInfo = ColorSupport | false; export type ColorInfo = ColorSupport | false;

View file

@ -3,6 +3,7 @@ import os from 'node:os';
import tty from 'node:tty'; import tty from 'node:tty';
// From: https://github.com/sindresorhus/has-flag/blob/main/index.js // From: https://github.com/sindresorhus/has-flag/blob/main/index.js
/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) { function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const position = argv.indexOf(prefix + flag); const position = argv.indexOf(prefix + flag);
@ -111,7 +112,7 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
} }
if ('CI' in env) { if ('CI' in env) {
if ('GITHUB_ACTIONS' in env) { if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
return 3; return 3;
} }