Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Feb 26, 2025
1 parent c3810bc commit ab17523
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 27 deletions.
9 changes: 7 additions & 2 deletions node_modules/supports-color/browser.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/* eslint-env browser */
/* eslint-disable n/no-unsupported-features/node-builtins */

const level = (() => {
if (navigator.userAgentData) {
if (!('navigator' in globalThis)) {
return 0;
}

if (globalThis.navigator.userAgentData) {
const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
if (brand?.version > 93) {
return 3;
}
}

if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) {
if (/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)) {
return 1;
}

Expand Down
32 changes: 22 additions & 10 deletions node_modules/supports-color/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,29 @@ if (
}

function envForceColor() {
if ('FORCE_COLOR' in env) {
if (env.FORCE_COLOR === 'true') {
return 1;
}
if (!('FORCE_COLOR' in env)) {
return;
}

if (env.FORCE_COLOR === 'false') {
return 0;
}
if (env.FORCE_COLOR === 'true') {
return 1;
}

if (env.FORCE_COLOR === 'false') {
return 0;
}

return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
if (env.FORCE_COLOR.length === 0) {
return 1;
}

const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);

if (![0, 1, 2, 3].includes(level)) {
return;
}

return level;
}

function translateLevel(level) {
Expand Down Expand Up @@ -112,11 +124,11 @@ function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
}

if ('CI' in env) {
if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
if (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {
return 3;
}

if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
if (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
return 1;
}

Expand Down
22 changes: 13 additions & 9 deletions node_modules/supports-color/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supports-color",
"version": "9.4.0",
"version": "10.0.0",
"description": "Detect whether a terminal supports color",
"license": "MIT",
"repository": "chalk/supports-color",
Expand All @@ -12,15 +12,16 @@
},
"type": "module",
"exports": {
"types": "./index.d.ts",
"node": "./index.js",
"default": "./browser.js"
},
"sideEffects": false,
"engines": {
"node": ">=12"
"node": ">=18"
},
"scripts": {
"//test": "xo && ava && tsd",
"test": "tsd"
"test": "xo && ava && tsd"
},
"files": [
"index.js",
Expand Down Expand Up @@ -51,10 +52,13 @@
"16m"
],
"devDependencies": {
"@types/node": "^20.3.2",
"ava": "^5.3.1",
"import-fresh": "^3.3.0",
"tsd": "^0.18.0",
"xo": "^0.54.2"
"@types/node": "^22.10.2",
"ava": "^6.2.0",
"tsd": "^0.31.2",
"xo": "^0.60.0"
},
"ava": {
"serial": true,
"workerThreads": false
}
}
10 changes: 5 additions & 5 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"semver": "^7.7.1",
"spdx-expression-parse": "^4.0.0",
"ssri": "^12.0.0",
"supports-color": "^9.4.0",
"supports-color": "^10.0.0",
"tar": "^6.2.1",
"text-table": "~0.2.0",
"tiny-relative-date": "^1.3.0",
Expand Down Expand Up @@ -15129,13 +15129,13 @@
}
},
"node_modules/supports-color": {
"version": "9.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.4.0.tgz",
"integrity": "sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw==",
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.0.0.tgz",
"integrity": "sha512-HRVVSbCCMbj7/kdWF9Q+bbckjBHLtHMEoJWlkmYzzdwhYMkjkOwubLM6t7NbWKjgKamGDrWL1++KrjUO1t9oAQ==",
"inBundle": true,
"license": "MIT",
"engines": {
"node": ">=12"
"node": ">=18"
},
"funding": {
"url": "https://github.com/chalk/supports-color?sponsor=1"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"semver": "^7.7.1",
"spdx-expression-parse": "^4.0.0",
"ssri": "^12.0.0",
"supports-color": "^9.4.0",
"supports-color": "^10.0.0",
"tar": "^6.2.1",
"text-table": "~0.2.0",
"tiny-relative-date": "^1.3.0",
Expand Down

0 comments on commit ab17523

Please sign in to comment.