Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: downgrade supports-color to same version as chalk #7887

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@ graph LR;
string-width-->is-fullwidth-code-point;
string-width-->strip-ansi;
strip-ansi-->ansi-regex;
supports-color-->has-flag;
tar-->chownr;
tar-->fs-minipass;
tar-->isaacs-fs-minipass["@isaacs/fs-minipass"];
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,14 @@ class Display {
}) {
// get createSupportsColor from chalk directly if this lands
// https://github.com/chalk/chalk/pull/600
const [{ Chalk }, { createSupportsColor }] = await Promise.all([
const [{ Chalk }, supportsColor] = await Promise.all([
import('chalk'),
import('supports-color'),
])
// we get the chalk level based on a null stream meaning chalk will only use
// what it knows about the environment to get color support since we already
// determined in our definitions that we want to show colors.
const level = Math.max(createSupportsColor(null).level, 1)
const level = Math.max(supportsColor.level, 1)
this.#noColorChalk = new Chalk({ level: 0 })
this.#stdoutColor = stdoutColor
this.#stdoutChalk = stdoutColor ? new Chalk({ level }) : this.#noColorChalk
Expand Down
3 changes: 3 additions & 0 deletions node_modules/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@
!/strip-ansi-cjs
!/strip-ansi
!/supports-color
!/supports-color/node_modules/
/supports-color/node_modules/*
!/supports-color/node_modules/has-flag
!/tar
!/tar/node_modules/
/tar/node_modules/*
Expand Down
14 changes: 0 additions & 14 deletions node_modules/sprintf-js/bower.json

This file was deleted.

20 changes: 0 additions & 20 deletions node_modules/sprintf-js/demo/angular.html

This file was deleted.

36 changes: 0 additions & 36 deletions node_modules/sprintf-js/gruntfile.js

This file was deleted.

82 changes: 0 additions & 82 deletions node_modules/sprintf-js/test/test.js

This file was deleted.

33 changes: 4 additions & 29 deletions node_modules/supports-color/browser.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
/* eslint-env browser */

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

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

return 0;
})();

const colorSupport = level !== 0 && {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3,
'use strict';
module.exports = {
stdout: false,
stderr: false
};

const supportsColor = {
stdout: colorSupport,
stderr: colorSupport,
};

export default supportsColor;
Loading
Loading