@visulima/is-ansi-color-supported 2.3.1 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## @visulima/is-ansi-color-supported [2.3.3](https://github.com/visulima/visulima/compare/@visulima/is-ansi-color-supported@2.3.2...@visulima/is-ansi-color-supported@2.3.3) (2025-11-07)
2
+
3
+ ### Bug Fixes
4
+
5
+ * update TypeScript configurations and improve linting across multiple packages ([6f25ec7](https://github.com/visulima/visulima/commit/6f25ec7841da7246f8f9166efc5292a7089d37ee))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * update npm and pnpm configurations for monorepo optimization ([#564](https://github.com/visulima/visulima/issues/564)) ([5512b42](https://github.com/visulima/visulima/commit/5512b42f672c216b6a3c9e39035199a4ebd9a4b8))
10
+
11
+ ## @visulima/is-ansi-color-supported [2.3.2](https://github.com/visulima/visulima/compare/@visulima/is-ansi-color-supported@2.3.1...@visulima/is-ansi-color-supported@2.3.2) (2025-11-05)
12
+
13
+ ### Bug Fixes
14
+
15
+ * update dependencies across multiple packages ([36a47f2](https://github.com/visulima/visulima/commit/36a47f26d65d25a7b4d8371186710e7d0ab61a2b))
16
+
17
+ ### Miscellaneous Chores
18
+
19
+ * update dependencies across multiple packages ([c526462](https://github.com/visulima/visulima/commit/c52646260c2ae8bbf85692e642f305f47a158d4e))
20
+ * update package dependencies and configurations ([7bfe7e7](https://github.com/visulima/visulima/commit/7bfe7e71869580900aab50efb064b4293994ed9a))
21
+
1
22
  ## @visulima/is-ansi-color-supported [2.3.1](https://github.com/visulima/visulima/compare/@visulima/is-ansi-color-supported@2.3.0...@visulima/is-ansi-color-supported@2.3.1) (2025-10-21)
2
23
 
3
24
  ### Bug Fixes
@@ -19,7 +40,7 @@
19
40
  ### Bug Fixes
20
41
 
21
42
  * restore require exports in package.json and update packem configuration ([c38aafb](https://github.com/visulima/visulima/commit/c38aafbedebf0557ad05b1e181940f256e76bf2a))
22
- * update @visulima/packem to 2.0.0-alpha.30 across multiple packages for improved compatibility ([27b346e](https://github.com/visulima/visulima/commit/27b346eaa1c0fb0e420d9a9824482028307f4249))
43
+ * update @visulima/packem to 2.0.0-alpha.32 across multiple packages for improved compatibility ([27b346e](https://github.com/visulima/visulima/commit/27b346eaa1c0fb0e420d9a9824482028307f4249))
23
44
 
24
45
  ### Miscellaneous Chores
25
46
 
@@ -1 +1,29 @@
1
- "use strict";var C=Object.defineProperty;var o=(e,t)=>C(e,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./packem_shared/SPACE_16_COLORS-CIFY-d7-.cjs");var u=Object.defineProperty,O=o((e,t)=>u(e,"name",{value:t,configurable:!0}),"t");const S=O(()=>(()=>{if(typeof navigator<"u"){if(navigator.userAgentData&&navigator.userAgentData.brands.find(({b:e})=>e==="Chromium")?.version>93)return r.SPACE_TRUE_COLORS;if(/\b(Chrome|Chromium)\//.test(navigator.userAgent))return r.SPACE_16_COLORS}return r.SPACE_MONO})(),"isColorSupported"),i=S,_=S;exports.SPACE_16_COLORS=r.SPACE_16_COLORS;exports.SPACE_256_COLORS=r.SPACE_256_COLORS;exports.SPACE_MONO=r.SPACE_MONO;exports.SPACE_TRUE_COLORS=r.SPACE_TRUE_COLORS;exports.isStderrColorSupported=_;exports.isStdoutColorSupported=i;
1
+ 'use strict';
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+
5
+ const SPACE_MONO = require('./packem_shared/SPACE_MONO-Cwv43lY6.cjs');
6
+
7
+ const isColorSupported = () => (() => {
8
+ if (typeof navigator !== "undefined") {
9
+ if (navigator.userAgentData) {
10
+ const brand = navigator.userAgentData.brands.find(({ b }) => b === "Chromium");
11
+ if (brand?.version > 93) {
12
+ return SPACE_MONO.SPACE_TRUE_COLORS;
13
+ }
14
+ }
15
+ if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) {
16
+ return SPACE_MONO.SPACE_16_COLORS;
17
+ }
18
+ }
19
+ return SPACE_MONO.SPACE_MONO;
20
+ })();
21
+ const isStdoutColorSupported = isColorSupported;
22
+ const isStderrColorSupported = isColorSupported;
23
+
24
+ exports.SPACE_16_COLORS = SPACE_MONO.SPACE_16_COLORS;
25
+ exports.SPACE_256_COLORS = SPACE_MONO.SPACE_256_COLORS;
26
+ exports.SPACE_MONO = SPACE_MONO.SPACE_MONO;
27
+ exports.SPACE_TRUE_COLORS = SPACE_MONO.SPACE_TRUE_COLORS;
28
+ exports.isStderrColorSupported = isStderrColorSupported;
29
+ exports.isStdoutColorSupported = isStdoutColorSupported;
@@ -1 +1,21 @@
1
- var a=Object.defineProperty;var e=(r,t)=>a(r,"name",{value:t,configurable:!0});import{SPACE_TRUE_COLORS as n,SPACE_16_COLORS as i,SPACE_MONO as u}from"./packem_shared/SPACE_16_COLORS-BEQbKWNs.mjs";import{SPACE_256_COLORS as g}from"./packem_shared/SPACE_16_COLORS-BEQbKWNs.mjs";var C=Object.defineProperty,p=e((r,t)=>C(r,"name",{value:t,configurable:!0}),"t");const o=p(()=>(()=>{if(typeof navigator<"u"){if(navigator.userAgentData&&navigator.userAgentData.brands.find(({b:r})=>r==="Chromium")?.version>93)return n;if(/\b(Chrome|Chromium)\//.test(navigator.userAgent))return i}return u})(),"isColorSupported"),f=o,m=o;export{i as SPACE_16_COLORS,g as SPACE_256_COLORS,u as SPACE_MONO,n as SPACE_TRUE_COLORS,m as isStderrColorSupported,f as isStdoutColorSupported};
1
+ import { SPACE_TRUE_COLORS, SPACE_16_COLORS, SPACE_MONO } from './packem_shared/SPACE_MONO-VdlYcTli.mjs';
2
+ export { SPACE_256_COLORS } from './packem_shared/SPACE_MONO-VdlYcTli.mjs';
3
+
4
+ const isColorSupported = () => (() => {
5
+ if (typeof navigator !== "undefined") {
6
+ if (navigator.userAgentData) {
7
+ const brand = navigator.userAgentData.brands.find(({ b }) => b === "Chromium");
8
+ if (brand?.version > 93) {
9
+ return SPACE_TRUE_COLORS;
10
+ }
11
+ }
12
+ if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) {
13
+ return SPACE_16_COLORS;
14
+ }
15
+ }
16
+ return SPACE_MONO;
17
+ })();
18
+ const isStdoutColorSupported = isColorSupported;
19
+ const isStderrColorSupported = isColorSupported;
20
+
21
+ export { SPACE_16_COLORS, SPACE_MONO, SPACE_TRUE_COLORS, isStderrColorSupported, isStdoutColorSupported };
@@ -1 +1,37 @@
1
- "use strict";var u=Object.defineProperty;var t=(r,o)=>u(r,"name",{value:o,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./packem_shared/SPACE_16_COLORS-CIFY-d7-.cjs");var C=Object.defineProperty,i=t((r,o)=>C(r,"name",{value:o,configurable:!0}),"t$1");const n=i(()=>(()=>{if(typeof navigator<"u"){if(navigator.userAgentData&&navigator.userAgentData.brands.find(({b:r})=>r==="Chromium")?.version>93)return e.SPACE_TRUE_COLORS;if(/\b(Chrome|Chromium)\//.test(navigator.userAgent))return e.SPACE_16_COLORS}return e.SPACE_MONO})(),"isColorSupported"),O=n;var s=Object.defineProperty,_=t((r,o)=>s(r,"name",{value:o,configurable:!0}),"o");const S=_(()=>process.env.NEXT_RUNTIME!==void 0&&process.env.NEXT_RUNTIME.includes("edge")?e.SPACE_16_COLORS:O(),"isColorSupported"),a=S,d=S;exports.SPACE_16_COLORS=e.SPACE_16_COLORS;exports.SPACE_256_COLORS=e.SPACE_256_COLORS;exports.SPACE_MONO=e.SPACE_MONO;exports.SPACE_TRUE_COLORS=e.SPACE_TRUE_COLORS;exports.isStderrColorSupported=d;exports.isStdoutColorSupported=a;
1
+ 'use strict';
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+
5
+ const SPACE_MONO = require('./packem_shared/SPACE_MONO-Cwv43lY6.cjs');
6
+
7
+ const isColorSupported$1 = () => (() => {
8
+ if (typeof navigator !== "undefined") {
9
+ if (navigator.userAgentData) {
10
+ const brand = navigator.userAgentData.brands.find(({ b }) => b === "Chromium");
11
+ if (brand?.version > 93) {
12
+ return SPACE_MONO.SPACE_TRUE_COLORS;
13
+ }
14
+ }
15
+ if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) {
16
+ return SPACE_MONO.SPACE_16_COLORS;
17
+ }
18
+ }
19
+ return SPACE_MONO.SPACE_MONO;
20
+ })();
21
+ const isStdoutColorSupported$1 = isColorSupported$1;
22
+
23
+ const isColorSupported = () => (() => {
24
+ if (process.env.NEXT_RUNTIME !== void 0 && process.env.NEXT_RUNTIME.includes("edge")) {
25
+ return SPACE_MONO.SPACE_16_COLORS;
26
+ }
27
+ return isStdoutColorSupported$1();
28
+ })();
29
+ const isStdoutColorSupported = isColorSupported;
30
+ const isStderrColorSupported = isColorSupported;
31
+
32
+ exports.SPACE_16_COLORS = SPACE_MONO.SPACE_16_COLORS;
33
+ exports.SPACE_256_COLORS = SPACE_MONO.SPACE_256_COLORS;
34
+ exports.SPACE_MONO = SPACE_MONO.SPACE_MONO;
35
+ exports.SPACE_TRUE_COLORS = SPACE_MONO.SPACE_TRUE_COLORS;
36
+ exports.isStderrColorSupported = isStderrColorSupported;
37
+ exports.isStdoutColorSupported = isStdoutColorSupported;
@@ -1 +1,29 @@
1
- var a=Object.defineProperty;var o=(r,e)=>a(r,"name",{value:e,configurable:!0});import{SPACE_TRUE_COLORS as i,SPACE_16_COLORS as t,SPACE_MONO as u}from"./packem_shared/SPACE_16_COLORS-BEQbKWNs.mjs";import{SPACE_256_COLORS as E}from"./packem_shared/SPACE_16_COLORS-BEQbKWNs.mjs";var s=Object.defineProperty,p=o((r,e)=>s(r,"name",{value:e,configurable:!0}),"t$1");const d=p(()=>(()=>{if(typeof navigator<"u"){if(navigator.userAgentData&&navigator.userAgentData.brands.find(({b:r})=>r==="Chromium")?.version>93)return i;if(/\b(Chrome|Chromium)\//.test(navigator.userAgent))return t}return u})(),"isColorSupported"),C=d;var S=Object.defineProperty,v=o((r,e)=>S(r,"name",{value:e,configurable:!0}),"o");const n=v(()=>process.env.NEXT_RUNTIME!==void 0&&process.env.NEXT_RUNTIME.includes("edge")?t:C(),"isColorSupported"),g=n,l=n;export{t as SPACE_16_COLORS,E as SPACE_256_COLORS,u as SPACE_MONO,i as SPACE_TRUE_COLORS,l as isStderrColorSupported,g as isStdoutColorSupported};
1
+ import { SPACE_TRUE_COLORS, SPACE_16_COLORS, SPACE_MONO } from './packem_shared/SPACE_MONO-VdlYcTli.mjs';
2
+ export { SPACE_256_COLORS } from './packem_shared/SPACE_MONO-VdlYcTli.mjs';
3
+
4
+ const isColorSupported$1 = () => (() => {
5
+ if (typeof navigator !== "undefined") {
6
+ if (navigator.userAgentData) {
7
+ const brand = navigator.userAgentData.brands.find(({ b }) => b === "Chromium");
8
+ if (brand?.version > 93) {
9
+ return SPACE_TRUE_COLORS;
10
+ }
11
+ }
12
+ if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) {
13
+ return SPACE_16_COLORS;
14
+ }
15
+ }
16
+ return SPACE_MONO;
17
+ })();
18
+ const isStdoutColorSupported$1 = isColorSupported$1;
19
+
20
+ const isColorSupported = () => (() => {
21
+ if (process.env.NEXT_RUNTIME !== void 0 && process.env.NEXT_RUNTIME.includes("edge")) {
22
+ return SPACE_16_COLORS;
23
+ }
24
+ return isStdoutColorSupported$1();
25
+ })();
26
+ const isStdoutColorSupported = isColorSupported;
27
+ const isStderrColorSupported = isColorSupported;
28
+
29
+ export { SPACE_16_COLORS, SPACE_MONO, SPACE_TRUE_COLORS, isStderrColorSupported, isStdoutColorSupported };
@@ -1 +1,138 @@
1
- "use strict";var a=Object.defineProperty;var c=(S,t)=>a(S,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./packem_shared/SPACE_16_COLORS-CIFY-d7-.cjs");var f=Object.defineProperty,E=c((S,t)=>f(S,"name",{value:t,configurable:!0}),"f");const L=E(S=>{const t=globalThis,i=t.Deno!=null,C=t.process??t.Deno??{},u=C.argv??C.args??[],R=E(o=>{const T=u.indexOf("--"),P=u.findIndex(M=>o.test(M));return P!==-1&&(T===-1||P<T)},"oneOfFlags");let e={};try{e=i?C.env.toObject():C.env??{}}catch{}const l="FORCE_COLOR",d=l in e,_=e[l]?String(e[l]):void 0,A=Object.prototype.toString.call(_).slice(8,-1)==="String";let O;if(_==="true"?O=r.SPACE_16_COLORS:_==="false"?O=r.SPACE_MONO:A&&_.length===0?O=r.SPACE_16_COLORS:A&&_.length>0&&(O=Math.min(Number.parseInt(_,10),3)),_!=="true"&&_!=="false"&&O!==void 0&&O<4)return O;if("NO_COLOR"in e||d&&O===0||R(/^-{1,2}(no-color|no-colors|color=false|color=never)$/))return r.SPACE_MONO;if(R(/^-{1,2}(color=256)$/))return r.SPACE_256_COLORS;if(R(/^-{1,2}(color=16m|color=full|color=truecolor)$/))return r.SPACE_TRUE_COLORS;if(R(/^-{1,2}(color|colors|color=true|color=always)$/))return r.SPACE_16_COLORS;const s=O||r.SPACE_MONO;if("TF_BUILD"in e&&"AGENT_NAME"in e)return r.SPACE_16_COLORS;if(e.TERM&&/-mono|dumb/i.test(e.TERM))return s;if((i?t.Deno.build.os:C.platform)==="win32")try{const o=(i?t.Deno.osRelease():C.os.release()).split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?r.SPACE_TRUE_COLORS:r.SPACE_256_COLORS:r.SPACE_16_COLORS}catch{}if("CI"in e)return["GITEA_ACTIONS","CIRCLECI","GITHUB_WORKFLOW","GITHUB_ACTIONS"].some(o=>o in e)?r.SPACE_TRUE_COLORS:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(o=>o in e)||e.CI_NAME==="codeship"?r.SPACE_16_COLORS:s;if(e.TERMINAL_EMULATOR?.includes("JediTerm"))return r.SPACE_TRUE_COLORS;if("TEAMCITY_VERSION"in e)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(e.TEAMCITY_VERSION)?r.SPACE_16_COLORS:r.SPACE_MONO;if(e.COLORTERM==="truecolor"||e.TERM==="xterm-kitty"||e.TERM==="xterm-ghostty"||e.TERM==="wezterm")return r.SPACE_TRUE_COLORS;if("TERM_PROGRAM"in e){const o=Number.parseInt((e.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(e.TERM_PROGRAM==="iTerm.app")return o>=3?r.SPACE_TRUE_COLORS:r.SPACE_256_COLORS;if(e.TERM_PROGRAM==="Apple_Terminal")return r.SPACE_256_COLORS}if(/-256(color)?$/i.test(e.TERM))return r.SPACE_256_COLORS;let n=!1;return i?S==="out"?n=t.Deno.stdout.isTerminal():S==="err"&&(n=t.Deno.stderr.isTerminal()):"PM2_HOME"in e&&"pm_id"in e?n=!0:n=C[`std${S}`]&&"isTTY"in C[`std${S}`],n&&/^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i.test(e.TERM)||"COLORTERM"in e?r.SPACE_16_COLORS:s},"isColorSupportedFactory"),p=E(()=>L("out"),"isStdoutColorSupported"),m=E(()=>L("err"),"isStderrColorSupported");exports.SPACE_16_COLORS=r.SPACE_16_COLORS;exports.SPACE_256_COLORS=r.SPACE_256_COLORS;exports.SPACE_MONO=r.SPACE_MONO;exports.SPACE_TRUE_COLORS=r.SPACE_TRUE_COLORS;exports.isStderrColorSupported=m;exports.isStdoutColorSupported=p;
1
+ 'use strict';
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+
5
+ const SPACE_MONO = require('./packem_shared/SPACE_MONO-Cwv43lY6.cjs');
6
+
7
+ const isColorSupportedFactory = (stdName) => {
8
+ const _this = globalThis;
9
+ const isDeno = _this.Deno != void 0;
10
+ const proc = _this.process ?? _this.Deno ?? {};
11
+ const argv = proc.argv ?? proc.args ?? [];
12
+ const oneOfFlags = (regex) => {
13
+ const terminatorPosition = argv.indexOf("--");
14
+ const position = argv.findIndex((flag) => regex.test(flag));
15
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
16
+ };
17
+ let environment = {};
18
+ try {
19
+ environment = isDeno ? proc.env.toObject() : proc.env ?? {};
20
+ } catch {
21
+ }
22
+ const FORCE_COLOR = "FORCE_COLOR";
23
+ const hasForceColor = FORCE_COLOR in environment;
24
+ const forceColorValue = environment[FORCE_COLOR] ? String(environment[FORCE_COLOR]) : void 0;
25
+ const forceColorValueIsString = Object.prototype.toString.call(forceColorValue).slice(8, -1) === "String";
26
+ let forceColor;
27
+ if (forceColorValue === "true") {
28
+ forceColor = SPACE_MONO.SPACE_16_COLORS;
29
+ } else if (forceColorValue === "false") {
30
+ forceColor = SPACE_MONO.SPACE_MONO;
31
+ } else if (forceColorValueIsString && forceColorValue.length === 0) {
32
+ forceColor = SPACE_MONO.SPACE_16_COLORS;
33
+ } else if (forceColorValueIsString && forceColorValue.length > 0) {
34
+ forceColor = Math.min(Number.parseInt(forceColorValue, 10), 3);
35
+ }
36
+ if (forceColorValue !== "true" && forceColorValue !== "false" && forceColor !== void 0 && forceColor < 4) {
37
+ return forceColor;
38
+ }
39
+ const isForceDisabled = "NO_COLOR" in environment || hasForceColor && forceColor === 0 || oneOfFlags(/^-{1,2}(no-color|no-colors|color=false|color=never)$/);
40
+ if (isForceDisabled) {
41
+ return SPACE_MONO.SPACE_MONO;
42
+ }
43
+ if (oneOfFlags(/^-{1,2}(color=256)$/)) {
44
+ return SPACE_MONO.SPACE_256_COLORS;
45
+ }
46
+ if (oneOfFlags(/^-{1,2}(color=16m|color=full|color=truecolor)$/)) {
47
+ return SPACE_MONO.SPACE_TRUE_COLORS;
48
+ }
49
+ const isForceEnabled = oneOfFlags(/^-{1,2}(color|colors|color=true|color=always)$/);
50
+ if (isForceEnabled) {
51
+ return SPACE_MONO.SPACE_16_COLORS;
52
+ }
53
+ const minColorLevel = forceColor || SPACE_MONO.SPACE_MONO;
54
+ if ("TF_BUILD" in environment && "AGENT_NAME" in environment) {
55
+ return SPACE_MONO.SPACE_16_COLORS;
56
+ }
57
+ const isDumbTerminal = environment.TERM && /-mono|dumb/i.test(environment.TERM);
58
+ if (isDumbTerminal) {
59
+ return minColorLevel;
60
+ }
61
+ if ((isDeno ? _this.Deno.build.os : proc.platform) === "win32") {
62
+ try {
63
+ const osRelease = (isDeno ? _this.Deno.osRelease() : proc.os.release()).split(".");
64
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
65
+ return Number(osRelease[2]) >= 14931 ? SPACE_MONO.SPACE_TRUE_COLORS : SPACE_MONO.SPACE_256_COLORS;
66
+ }
67
+ return SPACE_MONO.SPACE_16_COLORS;
68
+ } catch {
69
+ }
70
+ }
71
+ if ("CI" in environment) {
72
+ if (["GITEA_ACTIONS", "CIRCLECI", "GITHUB_WORKFLOW", "GITHUB_ACTIONS"].some((sign) => sign in environment)) {
73
+ return SPACE_MONO.SPACE_TRUE_COLORS;
74
+ }
75
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in environment) || environment.CI_NAME === "codeship") {
76
+ return SPACE_MONO.SPACE_16_COLORS;
77
+ }
78
+ return minColorLevel;
79
+ }
80
+ if (environment.TERMINAL_EMULATOR?.includes("JediTerm")) {
81
+ return SPACE_MONO.SPACE_TRUE_COLORS;
82
+ }
83
+ if ("TEAMCITY_VERSION" in environment) {
84
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(environment.TEAMCITY_VERSION) ? SPACE_MONO.SPACE_16_COLORS : SPACE_MONO.SPACE_MONO;
85
+ }
86
+ if (environment.COLORTERM === "truecolor") {
87
+ return SPACE_MONO.SPACE_TRUE_COLORS;
88
+ }
89
+ if (environment.TERM === "xterm-kitty") {
90
+ return SPACE_MONO.SPACE_TRUE_COLORS;
91
+ }
92
+ if (environment.TERM === "xterm-ghostty") {
93
+ return SPACE_MONO.SPACE_TRUE_COLORS;
94
+ }
95
+ if (environment.TERM === "wezterm") {
96
+ return SPACE_MONO.SPACE_TRUE_COLORS;
97
+ }
98
+ if ("TERM_PROGRAM" in environment) {
99
+ const version = Number.parseInt((environment.TERM_PROGRAM_VERSION ?? "").split(".")[0], 10);
100
+ if (environment.TERM_PROGRAM === "iTerm.app") {
101
+ return version >= 3 ? SPACE_MONO.SPACE_TRUE_COLORS : SPACE_MONO.SPACE_256_COLORS;
102
+ }
103
+ if (environment.TERM_PROGRAM === "Apple_Terminal") {
104
+ return SPACE_MONO.SPACE_256_COLORS;
105
+ }
106
+ }
107
+ if (/-256(color)?$/i.test(environment.TERM)) {
108
+ return SPACE_MONO.SPACE_256_COLORS;
109
+ }
110
+ let isTTY = false;
111
+ if (isDeno) {
112
+ if (stdName === "out") {
113
+ isTTY = _this.Deno.stdout.isTerminal();
114
+ } else if (stdName === "err") {
115
+ isTTY = _this.Deno.stderr.isTerminal();
116
+ }
117
+ } else if ("PM2_HOME" in environment && "pm_id" in environment) {
118
+ isTTY = true;
119
+ } else {
120
+ isTTY = proc[`std${stdName}`] && "isTTY" in proc[`std${stdName}`];
121
+ }
122
+ if (isTTY && /^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i.test(environment.TERM)) {
123
+ return SPACE_MONO.SPACE_16_COLORS;
124
+ }
125
+ if ("COLORTERM" in environment) {
126
+ return SPACE_MONO.SPACE_16_COLORS;
127
+ }
128
+ return minColorLevel;
129
+ };
130
+ const isStdoutColorSupported = () => isColorSupportedFactory("out");
131
+ const isStderrColorSupported = () => isColorSupportedFactory("err");
132
+
133
+ exports.SPACE_16_COLORS = SPACE_MONO.SPACE_16_COLORS;
134
+ exports.SPACE_256_COLORS = SPACE_MONO.SPACE_256_COLORS;
135
+ exports.SPACE_MONO = SPACE_MONO.SPACE_MONO;
136
+ exports.SPACE_TRUE_COLORS = SPACE_MONO.SPACE_TRUE_COLORS;
137
+ exports.isStderrColorSupported = isStderrColorSupported;
138
+ exports.isStdoutColorSupported = isStdoutColorSupported;
@@ -1 +1,129 @@
1
- var N=Object.defineProperty;var p=(l,e)=>N(l,"name",{value:e,configurable:!0});import{SPACE_MONO as E,SPACE_256_COLORS as c,SPACE_TRUE_COLORS as n,SPACE_16_COLORS as i}from"./packem_shared/SPACE_16_COLORS-BEQbKWNs.mjs";var L=Object.defineProperty,f=p((l,e)=>L(l,"name",{value:e,configurable:!0}),"f");const S=f(l=>{const e=globalThis,T=e.Deno!=null,s=e.process??e.Deno??{},m=s.argv??s.args??[],O=f(t=>{const M=m.indexOf("--"),_=m.findIndex(A=>t.test(A));return _!==-1&&(M===-1||_<M)},"oneOfFlags");let r={};try{r=T?s.env.toObject():s.env??{}}catch{}const a="FORCE_COLOR",I=a in r,u=r[a]?String(r[a]):void 0,C=Object.prototype.toString.call(u).slice(8,-1)==="String";let o;if(u==="true"?o=i:u==="false"?o=E:C&&u.length===0?o=i:C&&u.length>0&&(o=Math.min(Number.parseInt(u,10),3)),u!=="true"&&u!=="false"&&o!==void 0&&o<4)return o;if("NO_COLOR"in r||I&&o===0||O(/^-{1,2}(no-color|no-colors|color=false|color=never)$/))return E;if(O(/^-{1,2}(color=256)$/))return c;if(O(/^-{1,2}(color=16m|color=full|color=truecolor)$/))return n;if(O(/^-{1,2}(color|colors|color=true|color=always)$/))return i;const d=o||E;if("TF_BUILD"in r&&"AGENT_NAME"in r)return i;if(r.TERM&&/-mono|dumb/i.test(r.TERM))return d;if((T?e.Deno.build.os:s.platform)==="win32")try{const t=(T?e.Deno.osRelease():s.os.release()).split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?n:c:i}catch{}if("CI"in r)return["GITEA_ACTIONS","CIRCLECI","GITHUB_WORKFLOW","GITHUB_ACTIONS"].some(t=>t in r)?n:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(t=>t in r)||r.CI_NAME==="codeship"?i:d;if(r.TERMINAL_EMULATOR?.includes("JediTerm"))return n;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?i:E;if(r.COLORTERM==="truecolor")return n;if(r.TERM==="xterm-kitty")return n;if(r.TERM==="xterm-ghostty")return n;if(r.TERM==="wezterm")return n;if("TERM_PROGRAM"in r){const t=Number.parseInt((r.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(r.TERM_PROGRAM==="iTerm.app")return t>=3?n:c;if(r.TERM_PROGRAM==="Apple_Terminal")return c}if(/-256(color)?$/i.test(r.TERM))return c;let R=!1;return T?l==="out"?R=e.Deno.stdout.isTerminal():l==="err"&&(R=e.Deno.stderr.isTerminal()):"PM2_HOME"in r&&"pm_id"in r?R=!0:R=s[`std${l}`]&&"isTTY"in s[`std${l}`],R&&/^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i.test(r.TERM)?i:"COLORTERM"in r?i:d},"isColorSupportedFactory"),P=f(()=>S("out"),"isStdoutColorSupported"),v=f(()=>S("err"),"isStderrColorSupported");export{i as SPACE_16_COLORS,c as SPACE_256_COLORS,E as SPACE_MONO,n as SPACE_TRUE_COLORS,v as isStderrColorSupported,P as isStdoutColorSupported};
1
+ import { SPACE_MONO, SPACE_256_COLORS, SPACE_TRUE_COLORS, SPACE_16_COLORS } from './packem_shared/SPACE_MONO-VdlYcTli.mjs';
2
+
3
+ const isColorSupportedFactory = (stdName) => {
4
+ const _this = globalThis;
5
+ const isDeno = _this.Deno != void 0;
6
+ const proc = _this.process ?? _this.Deno ?? {};
7
+ const argv = proc.argv ?? proc.args ?? [];
8
+ const oneOfFlags = (regex) => {
9
+ const terminatorPosition = argv.indexOf("--");
10
+ const position = argv.findIndex((flag) => regex.test(flag));
11
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
12
+ };
13
+ let environment = {};
14
+ try {
15
+ environment = isDeno ? proc.env.toObject() : proc.env ?? {};
16
+ } catch {
17
+ }
18
+ const FORCE_COLOR = "FORCE_COLOR";
19
+ const hasForceColor = FORCE_COLOR in environment;
20
+ const forceColorValue = environment[FORCE_COLOR] ? String(environment[FORCE_COLOR]) : void 0;
21
+ const forceColorValueIsString = Object.prototype.toString.call(forceColorValue).slice(8, -1) === "String";
22
+ let forceColor;
23
+ if (forceColorValue === "true") {
24
+ forceColor = SPACE_16_COLORS;
25
+ } else if (forceColorValue === "false") {
26
+ forceColor = SPACE_MONO;
27
+ } else if (forceColorValueIsString && forceColorValue.length === 0) {
28
+ forceColor = SPACE_16_COLORS;
29
+ } else if (forceColorValueIsString && forceColorValue.length > 0) {
30
+ forceColor = Math.min(Number.parseInt(forceColorValue, 10), 3);
31
+ }
32
+ if (forceColorValue !== "true" && forceColorValue !== "false" && forceColor !== void 0 && forceColor < 4) {
33
+ return forceColor;
34
+ }
35
+ const isForceDisabled = "NO_COLOR" in environment || hasForceColor && forceColor === 0 || oneOfFlags(/^-{1,2}(no-color|no-colors|color=false|color=never)$/);
36
+ if (isForceDisabled) {
37
+ return SPACE_MONO;
38
+ }
39
+ if (oneOfFlags(/^-{1,2}(color=256)$/)) {
40
+ return SPACE_256_COLORS;
41
+ }
42
+ if (oneOfFlags(/^-{1,2}(color=16m|color=full|color=truecolor)$/)) {
43
+ return SPACE_TRUE_COLORS;
44
+ }
45
+ const isForceEnabled = oneOfFlags(/^-{1,2}(color|colors|color=true|color=always)$/);
46
+ if (isForceEnabled) {
47
+ return SPACE_16_COLORS;
48
+ }
49
+ const minColorLevel = forceColor || SPACE_MONO;
50
+ if ("TF_BUILD" in environment && "AGENT_NAME" in environment) {
51
+ return SPACE_16_COLORS;
52
+ }
53
+ const isDumbTerminal = environment.TERM && /-mono|dumb/i.test(environment.TERM);
54
+ if (isDumbTerminal) {
55
+ return minColorLevel;
56
+ }
57
+ if ((isDeno ? _this.Deno.build.os : proc.platform) === "win32") {
58
+ try {
59
+ const osRelease = (isDeno ? _this.Deno.osRelease() : proc.os.release()).split(".");
60
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
61
+ return Number(osRelease[2]) >= 14931 ? SPACE_TRUE_COLORS : SPACE_256_COLORS;
62
+ }
63
+ return SPACE_16_COLORS;
64
+ } catch {
65
+ }
66
+ }
67
+ if ("CI" in environment) {
68
+ if (["GITEA_ACTIONS", "CIRCLECI", "GITHUB_WORKFLOW", "GITHUB_ACTIONS"].some((sign) => sign in environment)) {
69
+ return SPACE_TRUE_COLORS;
70
+ }
71
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in environment) || environment.CI_NAME === "codeship") {
72
+ return SPACE_16_COLORS;
73
+ }
74
+ return minColorLevel;
75
+ }
76
+ if (environment.TERMINAL_EMULATOR?.includes("JediTerm")) {
77
+ return SPACE_TRUE_COLORS;
78
+ }
79
+ if ("TEAMCITY_VERSION" in environment) {
80
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(environment.TEAMCITY_VERSION) ? SPACE_16_COLORS : SPACE_MONO;
81
+ }
82
+ if (environment.COLORTERM === "truecolor") {
83
+ return SPACE_TRUE_COLORS;
84
+ }
85
+ if (environment.TERM === "xterm-kitty") {
86
+ return SPACE_TRUE_COLORS;
87
+ }
88
+ if (environment.TERM === "xterm-ghostty") {
89
+ return SPACE_TRUE_COLORS;
90
+ }
91
+ if (environment.TERM === "wezterm") {
92
+ return SPACE_TRUE_COLORS;
93
+ }
94
+ if ("TERM_PROGRAM" in environment) {
95
+ const version = Number.parseInt((environment.TERM_PROGRAM_VERSION ?? "").split(".")[0], 10);
96
+ if (environment.TERM_PROGRAM === "iTerm.app") {
97
+ return version >= 3 ? SPACE_TRUE_COLORS : SPACE_256_COLORS;
98
+ }
99
+ if (environment.TERM_PROGRAM === "Apple_Terminal") {
100
+ return SPACE_256_COLORS;
101
+ }
102
+ }
103
+ if (/-256(color)?$/i.test(environment.TERM)) {
104
+ return SPACE_256_COLORS;
105
+ }
106
+ let isTTY = false;
107
+ if (isDeno) {
108
+ if (stdName === "out") {
109
+ isTTY = _this.Deno.stdout.isTerminal();
110
+ } else if (stdName === "err") {
111
+ isTTY = _this.Deno.stderr.isTerminal();
112
+ }
113
+ } else if ("PM2_HOME" in environment && "pm_id" in environment) {
114
+ isTTY = true;
115
+ } else {
116
+ isTTY = proc[`std${stdName}`] && "isTTY" in proc[`std${stdName}`];
117
+ }
118
+ if (isTTY && /^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i.test(environment.TERM)) {
119
+ return SPACE_16_COLORS;
120
+ }
121
+ if ("COLORTERM" in environment) {
122
+ return SPACE_16_COLORS;
123
+ }
124
+ return minColorLevel;
125
+ };
126
+ const isStdoutColorSupported = () => isColorSupportedFactory("out");
127
+ const isStderrColorSupported = () => isColorSupportedFactory("err");
128
+
129
+ export { SPACE_16_COLORS, SPACE_256_COLORS, SPACE_MONO, SPACE_TRUE_COLORS, isStderrColorSupported, isStdoutColorSupported };
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+
5
+ const SPACE_MONO = 0;
6
+ const SPACE_16_COLORS = 1;
7
+ const SPACE_256_COLORS = 2;
8
+ const SPACE_TRUE_COLORS = 3;
9
+
10
+ exports.SPACE_16_COLORS = SPACE_16_COLORS;
11
+ exports.SPACE_256_COLORS = SPACE_256_COLORS;
12
+ exports.SPACE_MONO = SPACE_MONO;
13
+ exports.SPACE_TRUE_COLORS = SPACE_TRUE_COLORS;
@@ -0,0 +1,6 @@
1
+ const SPACE_MONO = 0;
2
+ const SPACE_16_COLORS = 1;
3
+ const SPACE_256_COLORS = 2;
4
+ const SPACE_TRUE_COLORS = 3;
5
+
6
+ export { SPACE_16_COLORS, SPACE_256_COLORS, SPACE_MONO, SPACE_TRUE_COLORS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/is-ansi-color-supported",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "Detect whether a terminal or browser supports ansi colors.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -1 +0,0 @@
1
- const O=0,C=1,S=2,_=3;export{C as SPACE_16_COLORS,S as SPACE_256_COLORS,O as SPACE_MONO,_ as SPACE_TRUE_COLORS};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const O=0,S=1,_=2,C=3;exports.SPACE_16_COLORS=S;exports.SPACE_256_COLORS=_;exports.SPACE_MONO=O;exports.SPACE_TRUE_COLORS=C;