Skip to content

Commit

Permalink
Update supports-color to 9.4.0
Browse files Browse the repository at this point in the history
Produced via `cp ../supports-color/{index,browser}.{js,d.ts} source/vendor/supports-color`
  • Loading branch information
silverwind committed Jun 28, 2023
1 parent a370f46 commit bf8a5b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/vendor/supports-color/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const level = (() => {
if (navigator.userAgentData) {
const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
if (brand && brand.version > 93) {
if (brand?.version > 93) {
return 3;
}
}
Expand Down
8 changes: 4 additions & 4 deletions source/vendor/supports-color/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type {WriteStream} from 'node:tty';

export type Options = {
export interface Options {
/**
Whether `process.argv` should be sniffed for `--color` and `--no-color` flags.
@default true
*/
readonly sniffFlags?: boolean;
};
}

/**
Levels:
Expand All @@ -21,7 +21,7 @@ export type ColorSupportLevel = 0 | 1 | 2 | 3;
/**
Detect whether the terminal supports color.
*/
export type ColorSupport = {
export interface ColorSupport {
/**
The color level.
*/
Expand All @@ -41,7 +41,7 @@ export type ColorSupport = {
Whether Truecolor 16 million colors are supported.
*/
has16m: boolean;
};
}

export type ColorInfo = ColorSupport | false;

Expand Down
3 changes: 2 additions & 1 deletion source/vendor/supports-color/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import os from 'node:os';
import tty from 'node:tty';

// 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) {
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const position = argv.indexOf(prefix + flag);
Expand Down Expand Up @@ -111,7 +112,7 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
}

if ('CI' in env) {
if ('GITHUB_ACTIONS' in env) {
if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
return 3;
}

Expand Down

0 comments on commit bf8a5b2

Please sign in to comment.