Ignore:
Timestamp:
12/12/24 17:06:06 (5 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
d565449
Message:

Pred finalna verzija

Location:
imaps-frontend/node_modules/supports-color
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/supports-color/index.js

    rd565449 r0c6b92a  
    11'use strict';
    22const os = require('os');
     3const tty = require('tty');
    34const hasFlag = require('has-flag');
    45
    5 const env = process.env;
     6const {env} = process;
    67
    78let forceColor;
    89if (hasFlag('no-color') ||
    910        hasFlag('no-colors') ||
    10         hasFlag('color=false')) {
    11         forceColor = false;
     11        hasFlag('color=false') ||
     12        hasFlag('color=never')) {
     13        forceColor = 0;
    1214} else if (hasFlag('color') ||
    1315        hasFlag('colors') ||
    1416        hasFlag('color=true') ||
    1517        hasFlag('color=always')) {
    16         forceColor = true;
     18        forceColor = 1;
    1719}
     20
    1821if ('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        }
    2029}
    2130
     
    3342}
    3443
    35 function supportsColor(stream) {
    36         if (forceColor === false) {
     44function supportsColor(haveStream, streamIsTTY) {
     45        if (forceColor === 0) {
    3746                return 0;
    3847        }
     
    4857        }
    4958
    50         if (stream && !stream.isTTY && forceColor !== true) {
     59        if (haveStream && !streamIsTTY && forceColor === undefined) {
    5160                return 0;
    5261        }
    5362
    54         const min = forceColor ? 1 : 0;
     63        const min = forceColor || 0;
     64
     65        if (env.TERM === 'dumb') {
     66                return min;
     67        }
    5568
    5669        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.
    6372                const osRelease = os.release().split('.');
    6473                if (
    65                         Number(process.versions.node.split('.')[0]) >= 8 &&
    6674                        Number(osRelease[0]) >= 10 &&
    6775                        Number(osRelease[2]) >= 10586
     
    7482
    7583        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') {
    7785                        return 1;
    7886                }
     
    113121        }
    114122
    115         if (env.TERM === 'dumb') {
    116                 return min;
    117         }
    118 
    119123        return min;
    120124}
    121125
    122126function getSupportLevel(stream) {
    123         const level = supportsColor(stream);
     127        const level = supportsColor(stream, stream && stream.isTTY);
    124128        return translateLevel(level);
    125129}
     
    127131module.exports = {
    128132        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)))
    131135};
  • imaps-frontend/node_modules/supports-color/package.json

    rd565449 r0c6b92a  
    11{
    22        "name": "supports-color",
    3         "version": "5.5.0",
     3        "version": "7.2.0",
    44        "description": "Detect whether a terminal supports color",
    55        "license": "MIT",
     
    1111        },
    1212        "engines": {
    13                 "node": ">=4"
     13                "node": ">=8"
    1414        },
    1515        "scripts": {
     
    4343        ],
    4444        "dependencies": {
    45                 "has-flag": "^3.0.0"
     45                "has-flag": "^4.0.0"
    4646        },
    4747        "devDependencies": {
    48                 "ava": "^0.25.0",
    49                 "import-fresh": "^2.0.0",
    50                 "xo": "^0.20.0"
     48                "ava": "^1.4.1",
     49                "import-fresh": "^3.0.0",
     50                "xo": "^0.24.0"
    5151        },
    5252        "browser": "browser.js"
  • imaps-frontend/node_modules/supports-color/readme.md

    rd565449 r0c6b92a  
    4545It obeys the `--color` and `--no-color` CLI flags.
    4646
    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 color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
     47For 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.
    4848
    4949Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
     
    6262
    6363
    64 ## License
     64---
    6565
    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.