Changeset 0c6b92a for imaps-frontend/node_modules/supports-color
- Timestamp:
- 12/12/24 17:06:06 (5 weeks ago)
- Branches:
- main
- Parents:
- d565449
- Location:
- imaps-frontend/node_modules/supports-color
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/supports-color/index.js
rd565449 r0c6b92a 1 1 'use strict'; 2 2 const os = require('os'); 3 const tty = require('tty'); 3 4 const hasFlag = require('has-flag'); 4 5 5 const env = process.env;6 const {env} = process; 6 7 7 8 let forceColor; 8 9 if (hasFlag('no-color') || 9 10 hasFlag('no-colors') || 10 hasFlag('color=false')) { 11 forceColor = false; 11 hasFlag('color=false') || 12 hasFlag('color=never')) { 13 forceColor = 0; 12 14 } else if (hasFlag('color') || 13 15 hasFlag('colors') || 14 16 hasFlag('color=true') || 15 17 hasFlag('color=always')) { 16 forceColor = true;18 forceColor = 1; 17 19 } 20 18 21 if ('FORCE_COLOR' in env) { 19 forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; 22 if (env.FORCE_COLOR === 'true') { 23 forceColor = 1; 24 } else if (env.FORCE_COLOR === 'false') { 25 forceColor = 0; 26 } else { 27 forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); 28 } 20 29 } 21 30 … … 33 42 } 34 43 35 function supportsColor( stream) {36 if (forceColor === false) {44 function supportsColor(haveStream, streamIsTTY) { 45 if (forceColor === 0) { 37 46 return 0; 38 47 } … … 48 57 } 49 58 50 if ( stream && !stream.isTTY && forceColor !== true) {59 if (haveStream && !streamIsTTY && forceColor === undefined) { 51 60 return 0; 52 61 } 53 62 54 const min = forceColor ? 1 : 0; 63 const min = forceColor || 0; 64 65 if (env.TERM === 'dumb') { 66 return min; 67 } 55 68 56 69 if (process.platform === 'win32') { 57 // Node.js 7.5.0 is the first version of Node.js to include a patch to 58 // libuv that enables 256 color output on Windows. Anything earlier and it 59 // won't work. However, here we target Node.js 8 at minimum as it is an LTS 60 // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows 61 // release that supports 256 colors. Windows 10 build 14931 is the first release 62 // that supports 16m/TrueColor. 70 // Windows 10 build 10586 is the first Windows release that supports 256 colors. 71 // Windows 10 build 14931 is the first release that supports 16m/TrueColor. 63 72 const osRelease = os.release().split('.'); 64 73 if ( 65 Number(process.versions.node.split('.')[0]) >= 8 &&66 74 Number(osRelease[0]) >= 10 && 67 75 Number(osRelease[2]) >= 10586 … … 74 82 75 83 if ('CI' in env) { 76 if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI' ].some(sign => sign in env) || env.CI_NAME === 'codeship') {84 if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { 77 85 return 1; 78 86 } … … 113 121 } 114 122 115 if (env.TERM === 'dumb') {116 return min;117 }118 119 123 return min; 120 124 } 121 125 122 126 function getSupportLevel(stream) { 123 const level = supportsColor(stream );127 const level = supportsColor(stream, stream && stream.isTTY); 124 128 return translateLevel(level); 125 129 } … … 127 131 module.exports = { 128 132 supportsColor: getSupportLevel, 129 stdout: getSupportLevel(process.stdout),130 stderr: getSupportLevel(process.stderr)133 stdout: translateLevel(supportsColor(true, tty.isatty(1))), 134 stderr: translateLevel(supportsColor(true, tty.isatty(2))) 131 135 }; -
imaps-frontend/node_modules/supports-color/package.json
rd565449 r0c6b92a 1 1 { 2 2 "name": "supports-color", 3 "version": " 5.5.0",3 "version": "7.2.0", 4 4 "description": "Detect whether a terminal supports color", 5 5 "license": "MIT", … … 11 11 }, 12 12 "engines": { 13 "node": ">= 4"13 "node": ">=8" 14 14 }, 15 15 "scripts": { … … 43 43 ], 44 44 "dependencies": { 45 "has-flag": "^ 3.0.0"45 "has-flag": "^4.0.0" 46 46 }, 47 47 "devDependencies": { 48 "ava": "^ 0.25.0",49 "import-fresh": "^ 2.0.0",50 "xo": "^0.2 0.0"48 "ava": "^1.4.1", 49 "import-fresh": "^3.0.0", 50 "xo": "^0.24.0" 51 51 }, 52 52 "browser": "browser.js" -
imaps-frontend/node_modules/supports-color/readme.md
rd565449 r0c6b92a 45 45 It obeys the `--color` and `--no-color` CLI flags. 46 46 47 Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable coloror `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.47 For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks. 48 48 49 49 Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. … … 62 62 63 63 64 ## License 64 --- 65 65 66 MIT 66 <div align="center"> 67 <b> 68 <a href="https://tidelift.com/subscription/pkg/npm-supports-color?utm_source=npm-supports-color&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> 69 </b> 70 <br> 71 <sub> 72 Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. 73 </sub> 74 </div> 75 76 ---
Note:
See TracChangeset
for help on using the changeset viewer.