Update supports-color to v10.0.0
This commit is contained in:
parent
fc809b686d
commit
a204e5fea4
2 changed files with 30 additions and 13 deletions
11
source/vendor/supports-color/browser.js
vendored
11
source/vendor/supports-color/browser.js
vendored
|
|
@ -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 && brand.version > 93) {
|
||||
if (brand?.version > 93) {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) {
|
||||
if (/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
32
source/vendor/supports-color/index.js
vendored
32
source/vendor/supports-color/index.js
vendored
|
|
@ -31,17 +31,29 @@ if (
|
|||
}
|
||||
|
||||
function envForceColor() {
|
||||
if ('FORCE_COLOR' in env) {
|
||||
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 (!('FORCE_COLOR' in env)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (env.FORCE_COLOR === 'true') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (env.FORCE_COLOR === 'false') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue