@visulima/is-ansi-color-supported 2.2.1 → 2.2.2
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 +18 -0
- package/README.md +1 -0
- package/dist/is-color-supported.browser.cjs +1 -26
- package/dist/is-color-supported.browser.mjs +1 -0
- package/dist/is-color-supported.server.cjs +1 -26
- package/dist/is-color-supported.server.d.cts +7 -3
- package/dist/is-color-supported.server.d.mts +11 -0
- package/dist/is-color-supported.server.d.ts +7 -3
- package/dist/is-color-supported.server.mjs +1 -0
- package/dist/shared/is-ansi-color-supported.1A1Svxa5.cjs +1 -0
- package/dist/shared/is-ansi-color-supported.BOPU_k0i.mjs +1 -0
- package/package.json +18 -16
- package/dist/chunk-ARYGRP3O.js +0 -5
- package/dist/chunk-ARYGRP3O.js.map +0 -1
- package/dist/chunk-VGFXSNOZ.cjs +0 -10
- package/dist/chunk-VGFXSNOZ.cjs.map +0 -1
- package/dist/color-spaces-DeN59JDX.d.cts +0 -8
- package/dist/color-spaces-DeN59JDX.d.ts +0 -8
- package/dist/is-color-supported.browser.cjs.map +0 -1
- package/dist/is-color-supported.browser.d.cts +0 -7
- package/dist/is-color-supported.browser.d.ts +0 -7
- package/dist/is-color-supported.browser.js +0 -7
- package/dist/is-color-supported.browser.js.map +0 -1
- package/dist/is-color-supported.server.cjs.map +0 -1
- package/dist/is-color-supported.server.js +0 -7
- package/dist/is-color-supported.server.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## @visulima/is-ansi-color-supported [2.2.2](https://github.com/visulima/visulima/compare/@visulima/is-ansi-color-supported@2.2.1...@visulima/is-ansi-color-supported@2.2.2) (2024-06-13)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **is-ansi-color-supported:** switched from tsup to packem ([d13332f](https://github.com/visulima/visulima/commit/d13332f6784aba59259fb9c09c47ae1d67962ec6))
|
|
6
|
+
|
|
7
|
+
### Styles
|
|
8
|
+
|
|
9
|
+
* cs fixes ([253af1e](https://github.com/visulima/visulima/commit/253af1e788c9544a2286dc0018c6549f62ca6c7b))
|
|
10
|
+
|
|
11
|
+
### Miscellaneous Chores
|
|
12
|
+
|
|
13
|
+
* updated all dev deps ([ef143ce](https://github.com/visulima/visulima/commit/ef143ce2e15952a0910aa5c8bd78d25de9ebd7f3))
|
|
14
|
+
|
|
15
|
+
### Build System
|
|
16
|
+
|
|
17
|
+
* fixed found audit error, updated all dev package deps, updated deps in apps and examples ([4c51950](https://github.com/visulima/visulima/commit/4c519500dc5504579d35725572920658999885cb))
|
|
18
|
+
|
|
1
19
|
## @visulima/is-ansi-color-supported [2.2.1](https://github.com/visulima/visulima/compare/@visulima/is-ansi-color-supported@2.2.0...@visulima/is-ansi-color-supported@2.2.1) (2024-06-06)
|
|
2
20
|
|
|
3
21
|
|
package/README.md
CHANGED
|
@@ -88,6 +88,7 @@ Combine that with the knowledge about which operating system the program is runn
|
|
|
88
88
|
| Terminal emulator Kitty | ✅ | ✅ | ✅ | xterm-kitty | | |
|
|
89
89
|
|
|
90
90
|
[^1]: Colors supported depends on actual terminal.
|
|
91
|
+
|
|
91
92
|
[^2]: The Windows terminal supports true color since Windows 10 revision 14931 (2016-09-21).
|
|
92
93
|
|
|
93
94
|
See also:
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var chunkVGFXSNOZ_cjs = require('./chunk-VGFXSNOZ.cjs');
|
|
4
|
-
|
|
5
|
-
var t=()=>(()=>{if(typeof navigator<"u"){if(navigator.userAgentData&&navigator.userAgentData.brands.find(({b:p})=>p==="Chromium")?.version>93)return 3;if(/\b(Chrome|Chromium)\//.test(navigator.userAgent))return 1}return typeof process<"u"?(process.env.NEXT_RUNTIME??"").includes("edge")?1:0:0})(),S=t,C=t;
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "SPACE_16_COLORS", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return chunkVGFXSNOZ_cjs.b; }
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(exports, "SPACE_256_COLORS", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return chunkVGFXSNOZ_cjs.c; }
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(exports, "SPACE_MONO", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function () { return chunkVGFXSNOZ_cjs.a; }
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "SPACE_TRUE_COLORS", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () { return chunkVGFXSNOZ_cjs.d; }
|
|
22
|
-
});
|
|
23
|
-
exports.isStderrColorSupported = C;
|
|
24
|
-
exports.isStdoutColorSupported = S;
|
|
25
|
-
//# sourceMappingURL=out.js.map
|
|
26
|
-
//# sourceMappingURL=is-color-supported.browser.cjs.map
|
|
1
|
+
"use strict";var C=Object.defineProperty;var t=(e,o)=>C(e,"name",{value:o,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./shared/is-ansi-color-supported.1A1Svxa5.cjs");var O=Object.defineProperty,i=t((e,o)=>O(e,"name",{value:o,configurable:!0}),"e");const S=i(()=>(()=>{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 typeof process<"u"&&(process.env.NEXT_RUNTIME??"").includes("edge")?r.SPACE_16_COLORS:r.SPACE_MONO})(),"isColorSupported"),u=S,n=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=n;exports.isStdoutColorSupported=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=Object.defineProperty;var o=(r,e)=>s(r,"name",{value:e,configurable:!0});import{S as i,a as t,b as a}from"./shared/is-ansi-color-supported.BOPU_k0i.mjs";import{c as v}from"./shared/is-ansi-color-supported.BOPU_k0i.mjs";var u=Object.defineProperty,p=o((r,e)=>u(r,"name",{value:e,configurable:!0}),"e");const n=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 typeof process<"u"?(process.env.NEXT_RUNTIME??"").includes("edge")?t:a:a})(),"isColorSupported"),d=n,f=n;export{t as SPACE_16_COLORS,v as SPACE_256_COLORS,a as SPACE_MONO,i as SPACE_TRUE_COLORS,f as isStderrColorSupported,d as isStdoutColorSupported};
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var chunkVGFXSNOZ_cjs = require('./chunk-VGFXSNOZ.cjs');
|
|
4
|
-
|
|
5
|
-
var d=a=>{let l=globalThis,R=l.Deno!=null,n=l.process??l.Deno??{},E=n.argv??n.args??[],O=t=>{let _=E.indexOf("--"),S=E.findIndex(A=>t.test(A));return S!==-1&&(_===-1||S<_)},r={};try{r=R?n.env.toObject():n.env??{};}catch{}let p="FORCE_COLOR",m=p in r,i=r[p]?String(r[p]):void 0,T=Object.prototype.toString.call(i).slice(8,-1)==="String",o;if(i==="true"?o=1:i==="false"?o=0:T&&i.length===0?o=1:T&&i.length>0&&(o=Math.min(Number.parseInt(i,10),3)),i!=="true"&&i!=="false"&&o!==void 0&&o<4)return o;if("NO_COLOR"in r||m&&o===0||O(/^-{1,2}(no-color|no-colors|color=false|color=never)$/))return 0;if(O(/^-{1,2}(color=256)$/))return 2;if(O(/^-{1,2}(color=16m|color=full|color=truecolor)$/))return 3;if(O(/^-{1,2}(color|colors|color=true|color=always)$/))return 1;let C=o||0;if("TF_BUILD"in r&&"AGENT_NAME"in r)return 1;if(r.TERM&&/-mono|dumb/i.test(r.TERM))return C;if((R?l.Deno.build.os:n.platform)==="win32")try{let t=(R?l.Deno.osRelease():n.os.release()).split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}catch{}if("CI"in r)return "GITHUB_ACTIONS"in r||"GITHUB_WORKFLOW"in r||"GITEA_ACTIONS"in r?3:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE","GITLAB_CI"].some(t=>t in r)||r.CI_NAME==="codeship"?1:C;if(r.TERMINAL_EMULATOR?.includes("JediTerm"))return 3;if("TEAMCITY_VERSION"in r)return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if(r.COLORTERM==="truecolor")return 3;if(r.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in r){let t=Number.parseInt((r.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(r.TERM_PROGRAM==="iTerm.app")return t>=3?3:2;if(r.TERM_PROGRAM==="Apple_Terminal")return 2}if(/-256(color)?$/i.test(r.TERM))return 2;let c=!1;return R?a==="out"?c=l.Deno.stdout.isTerminal():a==="err"&&(c=l.Deno.stderr.isTerminal()):"PM2_HOME"in r&&"pm_id"in r?c=!0:c=n["std"+a]&&"isTTY"in n["std"+a],c&&/^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i.test(r.TERM)?1:"COLORTERM"in r?1:C},b=()=>d("out"),v=()=>d("err");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "SPACE_16_COLORS", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return chunkVGFXSNOZ_cjs.b; }
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(exports, "SPACE_256_COLORS", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return chunkVGFXSNOZ_cjs.c; }
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(exports, "SPACE_MONO", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function () { return chunkVGFXSNOZ_cjs.a; }
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "SPACE_TRUE_COLORS", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () { return chunkVGFXSNOZ_cjs.d; }
|
|
22
|
-
});
|
|
23
|
-
exports.isStderrColorSupported = v;
|
|
24
|
-
exports.isStdoutColorSupported = b;
|
|
25
|
-
//# sourceMappingURL=out.js.map
|
|
26
|
-
//# sourceMappingURL=is-color-supported.server.cjs.map
|
|
1
|
+
"use strict";var p=Object.defineProperty;var P=(S,t)=>p(S,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./shared/is-ansi-color-supported.1A1Svxa5.cjs");var M=Object.defineProperty,E=P((S,t)=>M(S,"name",{value:t,configurable:!0}),"f");const L=E(S=>{const t=globalThis,i=t.Deno!=null,C=t.process??t.Deno??{},A=C.argv??C.args??[],R=E(O=>{const T=A.indexOf("--"),c=A.findIndex(a=>O.test(a));return c!==-1&&(T===-1||c<T)},"oneOfFlags");let r={};try{r=i?C.env.toObject():C.env??{}}catch{}const l="FORCE_COLOR",d=l in r,n=r[l]?String(r[l]):void 0,u=Object.prototype.toString.call(n).slice(8,-1)==="String";let o;if(n==="true"?o=e.SPACE_16_COLORS:n==="false"?o=e.SPACE_MONO:u&&n.length===0?o=e.SPACE_16_COLORS:u&&n.length>0&&(o=Math.min(Number.parseInt(n,10),3)),n!=="true"&&n!=="false"&&o!==void 0&&o<4)return o;if("NO_COLOR"in r||d&&o===0||R(/^-{1,2}(no-color|no-colors|color=false|color=never)$/))return e.SPACE_MONO;if(R(/^-{1,2}(color=256)$/))return e.SPACE_256_COLORS;if(R(/^-{1,2}(color=16m|color=full|color=truecolor)$/))return e.SPACE_TRUE_COLORS;if(R(/^-{1,2}(color|colors|color=true|color=always)$/))return e.SPACE_16_COLORS;const s=o||e.SPACE_MONO;if("TF_BUILD"in r&&"AGENT_NAME"in r)return e.SPACE_16_COLORS;if(r.TERM&&/-mono|dumb/i.test(r.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?e.SPACE_TRUE_COLORS:e.SPACE_256_COLORS:e.SPACE_16_COLORS}catch{}if("CI"in r)return"GITHUB_ACTIONS"in r||"GITHUB_WORKFLOW"in r||"GITEA_ACTIONS"in r?e.SPACE_TRUE_COLORS:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE","GITLAB_CI"].some(O=>O in r)||r.CI_NAME==="codeship"?e.SPACE_16_COLORS:s;if(r.TERMINAL_EMULATOR?.includes("JediTerm"))return e.SPACE_TRUE_COLORS;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?e.SPACE_16_COLORS:e.SPACE_MONO;if(r.COLORTERM==="truecolor"||r.TERM==="xterm-kitty")return e.SPACE_TRUE_COLORS;if("TERM_PROGRAM"in r){const O=Number.parseInt((r.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(r.TERM_PROGRAM==="iTerm.app")return O>=3?e.SPACE_TRUE_COLORS:e.SPACE_256_COLORS;if(r.TERM_PROGRAM==="Apple_Terminal")return e.SPACE_256_COLORS}if(/-256(color)?$/i.test(r.TERM))return e.SPACE_256_COLORS;let _=!1;return i?S==="out"?_=t.Deno.stdout.isTerminal():S==="err"&&(_=t.Deno.stderr.isTerminal()):"PM2_HOME"in r&&"pm_id"in r?_=!0:_=C["std"+S]&&"isTTY"in C["std"+S],_&&/^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?e.SPACE_16_COLORS:s},"isColorSupportedFactory"),f=E(()=>L("out"),"isStdoutColorSupported"),I=E(()=>L("err"),"isStderrColorSupported");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=I;exports.isStdoutColorSupported=f;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type ColorSupportLevel = 0 | 1 | 2 | 3;
|
|
2
|
+
|
|
3
|
+
declare const SPACE_MONO = 0;
|
|
4
|
+
declare const SPACE_16_COLORS = 1;
|
|
5
|
+
declare const SPACE_256_COLORS = 2;
|
|
6
|
+
declare const SPACE_TRUE_COLORS = 3;
|
|
3
7
|
|
|
4
8
|
declare const isStdoutColorSupported: () => ColorSupportLevel;
|
|
5
9
|
declare const isStderrColorSupported: () => ColorSupportLevel;
|
|
6
10
|
|
|
7
|
-
export { ColorSupportLevel, isStderrColorSupported, isStdoutColorSupported };
|
|
11
|
+
export { type ColorSupportLevel, SPACE_16_COLORS, SPACE_256_COLORS, SPACE_MONO, SPACE_TRUE_COLORS, isStderrColorSupported, isStdoutColorSupported };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type ColorSupportLevel = 0 | 1 | 2 | 3;
|
|
2
|
+
|
|
3
|
+
declare const SPACE_MONO = 0;
|
|
4
|
+
declare const SPACE_16_COLORS = 1;
|
|
5
|
+
declare const SPACE_256_COLORS = 2;
|
|
6
|
+
declare const SPACE_TRUE_COLORS = 3;
|
|
7
|
+
|
|
8
|
+
declare const isStdoutColorSupported: () => ColorSupportLevel;
|
|
9
|
+
declare const isStderrColorSupported: () => ColorSupportLevel;
|
|
10
|
+
|
|
11
|
+
export { type ColorSupportLevel, SPACE_16_COLORS, SPACE_256_COLORS, SPACE_MONO, SPACE_TRUE_COLORS, isStderrColorSupported, isStdoutColorSupported };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type ColorSupportLevel = 0 | 1 | 2 | 3;
|
|
2
|
+
|
|
3
|
+
declare const SPACE_MONO = 0;
|
|
4
|
+
declare const SPACE_16_COLORS = 1;
|
|
5
|
+
declare const SPACE_256_COLORS = 2;
|
|
6
|
+
declare const SPACE_TRUE_COLORS = 3;
|
|
3
7
|
|
|
4
8
|
declare const isStdoutColorSupported: () => ColorSupportLevel;
|
|
5
9
|
declare const isStderrColorSupported: () => ColorSupportLevel;
|
|
6
10
|
|
|
7
|
-
export { ColorSupportLevel, isStderrColorSupported, isStdoutColorSupported };
|
|
11
|
+
export { type ColorSupportLevel, SPACE_16_COLORS, SPACE_256_COLORS, SPACE_MONO, SPACE_TRUE_COLORS, isStderrColorSupported, isStdoutColorSupported };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var N=Object.defineProperty;var I=(i,e)=>N(i,"name",{value:e,configurable:!0});import{a as n,b as a,c as R,S as u}from"./shared/is-ansi-color-supported.BOPU_k0i.mjs";var L=Object.defineProperty,E=I((i,e)=>L(i,"name",{value:e,configurable:!0}),"f");const m=E(i=>{const e=globalThis,O=e.Deno!=null,s=e.process??e.Deno??{},C=s.argv??s.args??[],T=E(o=>{const p=C.indexOf("--"),S=C.findIndex(A=>o.test(A));return S!==-1&&(p===-1||S<p)},"oneOfFlags");let r={};try{r=O?s.env.toObject():s.env??{}}catch{}const d="FORCE_COLOR",M=d in r,l=r[d]?String(r[d]):void 0,_=Object.prototype.toString.call(l).slice(8,-1)==="String";let t;if(l==="true"?t=n:l==="false"?t=a:_&&l.length===0?t=n:_&&l.length>0&&(t=Math.min(Number.parseInt(l,10),3)),l!=="true"&&l!=="false"&&t!==void 0&&t<4)return t;if("NO_COLOR"in r||M&&t===0||T(/^-{1,2}(no-color|no-colors|color=false|color=never)$/))return a;if(T(/^-{1,2}(color=256)$/))return R;if(T(/^-{1,2}(color=16m|color=full|color=truecolor)$/))return u;if(T(/^-{1,2}(color|colors|color=true|color=always)$/))return n;const f=t||a;if("TF_BUILD"in r&&"AGENT_NAME"in r)return n;if(r.TERM&&/-mono|dumb/i.test(r.TERM))return f;if((O?e.Deno.build.os:s.platform)==="win32")try{const o=(O?e.Deno.osRelease():s.os.release()).split(".");return Number(o[0])>=10&&Number(o[2])>=10586?Number(o[2])>=14931?u:R:n}catch{}if("CI"in r)return"GITHUB_ACTIONS"in r||"GITHUB_WORKFLOW"in r||"GITEA_ACTIONS"in r?u:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE","GITLAB_CI"].some(o=>o in r)||r.CI_NAME==="codeship"?n:f;if(r.TERMINAL_EMULATOR?.includes("JediTerm"))return u;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?n:a;if(r.COLORTERM==="truecolor")return u;if(r.TERM==="xterm-kitty")return u;if("TERM_PROGRAM"in r){const o=Number.parseInt((r.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(r.TERM_PROGRAM==="iTerm.app")return o>=3?u:R;if(r.TERM_PROGRAM==="Apple_Terminal")return R}if(/-256(color)?$/i.test(r.TERM))return R;let c=!1;return O?i==="out"?c=e.Deno.stdout.isTerminal():i==="err"&&(c=e.Deno.stderr.isTerminal()):"PM2_HOME"in r&&"pm_id"in r?c=!0:c=s["std"+i]&&"isTTY"in s["std"+i],c&&/^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i.test(r.TERM)?n:"COLORTERM"in r?n:f},"isColorSupportedFactory"),g=E(()=>m("out"),"isStdoutColorSupported"),v=E(()=>m("err"),"isStderrColorSupported");export{n as SPACE_16_COLORS,R as SPACE_256_COLORS,a as SPACE_MONO,u as SPACE_TRUE_COLORS,v as isStderrColorSupported,g as isStdoutColorSupported};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.SPACE_16_COLORS=1;exports.SPACE_256_COLORS=2;exports.SPACE_MONO=0;exports.SPACE_TRUE_COLORS=3;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const O=0,S=1,C=2,_=3;export{_ as S,S as a,O as b,C as c};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/is-ansi-color-supported",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "Detect whether a terminal or browser supports ansi colors.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -57,21 +57,21 @@
|
|
|
57
57
|
"type": "module",
|
|
58
58
|
"exports": {
|
|
59
59
|
".": {
|
|
60
|
-
"browser": "./dist/is-color-supported.browser.
|
|
60
|
+
"browser": "./dist/is-color-supported.browser.mjs",
|
|
61
61
|
"require": {
|
|
62
62
|
"types": "./dist/is-color-supported.server.d.cts",
|
|
63
63
|
"default": "./dist/is-color-supported.server.cjs"
|
|
64
64
|
},
|
|
65
65
|
"import": {
|
|
66
|
-
"types": "./dist/is-color-supported.server.d.
|
|
67
|
-
"default": "./dist/is-color-supported.server.
|
|
66
|
+
"types": "./dist/is-color-supported.server.d.mts",
|
|
67
|
+
"default": "./dist/is-color-supported.server.mjs"
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"./package.json": "./package.json"
|
|
71
71
|
},
|
|
72
72
|
"main": "dist/is-color-supported.server.cjs",
|
|
73
|
-
"module": "dist/is-color-supported.server.
|
|
74
|
-
"browser": "./dist/is-color-supported.browser.
|
|
73
|
+
"module": "dist/is-color-supported.server.mjs",
|
|
74
|
+
"browser": "./dist/is-color-supported.browser.mjs",
|
|
75
75
|
"types": "dist/is-color-supported.server.d.ts",
|
|
76
76
|
"files": [
|
|
77
77
|
"dist/**",
|
|
@@ -82,16 +82,19 @@
|
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@anolilab/eslint-config": "^15.0.3",
|
|
84
84
|
"@anolilab/prettier-config": "^5.0.14",
|
|
85
|
-
"@anolilab/semantic-release-pnpm": "^1.1.
|
|
86
|
-
"@anolilab/semantic-release-preset": "^
|
|
87
|
-
"@babel/core": "^7.24.
|
|
85
|
+
"@anolilab/semantic-release-pnpm": "^1.1.3",
|
|
86
|
+
"@anolilab/semantic-release-preset": "^9.0.0",
|
|
87
|
+
"@babel/core": "^7.24.7",
|
|
88
88
|
"@rushstack/eslint-plugin-security": "^0.8.1",
|
|
89
89
|
"@secretlint/secretlint-rule-preset-recommend": "^8.2.4",
|
|
90
90
|
"@types/micromatch": "^4.0.7",
|
|
91
|
-
"@types/node": "18.
|
|
91
|
+
"@types/node": "18.19.15",
|
|
92
|
+
"@visulima/packem": "^1.0.0-alpha.41",
|
|
92
93
|
"@vitest/coverage-v8": "^1.6.0",
|
|
93
94
|
"@vitest/ui": "^1.6.0",
|
|
95
|
+
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
94
96
|
"cross-env": "^7.0.3",
|
|
97
|
+
"esbuild": "^0.21.5",
|
|
95
98
|
"eslint": "^8.57.0",
|
|
96
99
|
"eslint-plugin-deprecation": "^3.0.0",
|
|
97
100
|
"eslint-plugin-etc": "^2.0.3",
|
|
@@ -99,11 +102,10 @@
|
|
|
99
102
|
"eslint-plugin-mdx": "^3.1.5",
|
|
100
103
|
"eslint-plugin-vitest": "^0.4.1",
|
|
101
104
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
102
|
-
"prettier": "^3.3.
|
|
105
|
+
"prettier": "^3.3.2",
|
|
103
106
|
"rimraf": "^5.0.7",
|
|
104
|
-
"secretlint": "8.2.
|
|
105
|
-
"semantic-release": "
|
|
106
|
-
"tsup": "^8.1.0",
|
|
107
|
+
"secretlint": "8.2.4",
|
|
108
|
+
"semantic-release": "24.0.0",
|
|
107
109
|
"typescript": "^5.4.5",
|
|
108
110
|
"vitest": "^1.6.0"
|
|
109
111
|
},
|
|
@@ -136,8 +138,8 @@
|
|
|
136
138
|
"src/is-color-supported.server.ts"
|
|
137
139
|
],
|
|
138
140
|
"scripts": {
|
|
139
|
-
"build": "cross-env NODE_ENV=development
|
|
140
|
-
"build:prod": "cross-env NODE_ENV=production
|
|
141
|
+
"build": "cross-env NODE_ENV=development packem build",
|
|
142
|
+
"build:prod": "cross-env NODE_ENV=production packem build",
|
|
141
143
|
"clean": "rimraf node_modules dist .eslintcache",
|
|
142
144
|
"dev": "pnpm run build --watch",
|
|
143
145
|
"lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
|
package/dist/chunk-ARYGRP3O.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/color-spaces.ts"],"names":["SPACE_MONO","SPACE_16_COLORS","SPACE_256_COLORS","SPACE_TRUE_COLORS"],"mappings":"AAAO,IAAMA,EAAa,EACbC,EAAkB,EAClBC,EAAmB,EACnBC,EAAoB","sourcesContent":["export const SPACE_MONO = 0;\nexport const SPACE_16_COLORS = 1;\nexport const SPACE_256_COLORS = 2;\nexport const SPACE_TRUE_COLORS = 3;\n"]}
|
package/dist/chunk-VGFXSNOZ.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/color-spaces.ts"],"names":["SPACE_MONO","SPACE_16_COLORS","SPACE_256_COLORS","SPACE_TRUE_COLORS"],"mappings":"AAAO,IAAMA,EAAa,EACbC,EAAkB,EAClBC,EAAmB,EACnBC,EAAoB","sourcesContent":["export const SPACE_MONO = 0;\nexport const SPACE_16_COLORS = 1;\nexport const SPACE_256_COLORS = 2;\nexport const SPACE_TRUE_COLORS = 3;\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type ColorSupportLevel = 0 | 1 | 2 | 3;
|
|
2
|
-
|
|
3
|
-
declare const SPACE_MONO = 0;
|
|
4
|
-
declare const SPACE_16_COLORS = 1;
|
|
5
|
-
declare const SPACE_256_COLORS = 2;
|
|
6
|
-
declare const SPACE_TRUE_COLORS = 3;
|
|
7
|
-
|
|
8
|
-
export { type ColorSupportLevel as C, SPACE_16_COLORS as S, SPACE_256_COLORS as a, SPACE_MONO as b, SPACE_TRUE_COLORS as c };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type ColorSupportLevel = 0 | 1 | 2 | 3;
|
|
2
|
-
|
|
3
|
-
declare const SPACE_MONO = 0;
|
|
4
|
-
declare const SPACE_16_COLORS = 1;
|
|
5
|
-
declare const SPACE_256_COLORS = 2;
|
|
6
|
-
declare const SPACE_TRUE_COLORS = 3;
|
|
7
|
-
|
|
8
|
-
export { type ColorSupportLevel as C, SPACE_16_COLORS as S, SPACE_256_COLORS as a, SPACE_MONO as b, SPACE_TRUE_COLORS as c };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/is-color-supported.browser.ts"],"names":["isColorSupported","b","isStdoutColorSupported","isStderrColorSupported"],"mappings":"8DAOA,IAAMA,EAAmB,KACpB,IAAM,CACH,GAAI,OAAO,UAAc,IAAa,CAElC,GAAI,UAAU,eAGI,UAAU,cAAc,OAAO,KAAK,CAAC,CAAE,EAAAC,CAAE,IAAqBA,IAAM,UAAU,GAGjF,QAAU,GACjB,MAAO,GAKf,GAAI,wBAAwB,KAAK,UAAU,SAAS,EAChD,MAAO,EAEf,CAIA,OAAI,OAAO,QAAY,KACD,QAAQ,IAAI,cAAgB,IAAI,SAAS,MAAM,EAE/C,EAAkB,EAGjC,CACX,GAAG,EAEMC,EAAyBF,EAEzBG,EAAyBH","sourcesContent":["// Some of this code is taken from https://github.com/chalk/supports-color/blob/main/index.js\n// MIT License\n// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\nimport { SPACE_16_COLORS, SPACE_MONO, SPACE_TRUE_COLORS } from \"./color-spaces\";\nimport type { ColorSupportLevel } from \"./types\";\n\nconst isColorSupported = (): ColorSupportLevel =>\n (() => {\n if (typeof navigator !== \"undefined\") {\n // @ts-expect-error - `navigator` is not defined in Node.\n if (navigator.userAgentData) {\n // @ts-expect-error - `navigator` is not defined in Node.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access\n const brand = navigator.userAgentData.brands.find(({ b }: { b: string }) => b === \"Chromium\");\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (brand?.version > 93) {\n return SPACE_TRUE_COLORS;\n }\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (/\\b(Chrome|Chromium)\\//.test(navigator.userAgent)) {\n return SPACE_16_COLORS;\n }\n }\n\n // when Next.JS runtime is `edge`, process.stdout is undefined, but colors output is supported\n // runtime values supported colors: `nodejs`, `edge`, `experimental-edge`\n if (typeof process !== \"undefined\") {\n const isNextJS = (process.env.NEXT_RUNTIME ?? \"\").includes(\"edge\");\n\n return isNextJS ? SPACE_16_COLORS : SPACE_MONO;\n }\n\n return SPACE_MONO;\n })();\n\nexport const isStdoutColorSupported = isColorSupported;\n\nexport const isStderrColorSupported = isColorSupported;\n// eslint-disable-next-line import/no-unused-modules\nexport { SPACE_16_COLORS, SPACE_256_COLORS, SPACE_MONO, SPACE_TRUE_COLORS } from \"./color-spaces\";\n// eslint-disable-next-line import/no-unused-modules\nexport type { ColorSupportLevel } from \"./types\";\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { C as ColorSupportLevel } from './color-spaces-DeN59JDX.cjs';
|
|
2
|
-
export { S as SPACE_16_COLORS, a as SPACE_256_COLORS, b as SPACE_MONO, c as SPACE_TRUE_COLORS } from './color-spaces-DeN59JDX.cjs';
|
|
3
|
-
|
|
4
|
-
declare const isStdoutColorSupported: () => ColorSupportLevel;
|
|
5
|
-
declare const isStderrColorSupported: () => ColorSupportLevel;
|
|
6
|
-
|
|
7
|
-
export { ColorSupportLevel, isStderrColorSupported, isStdoutColorSupported };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { C as ColorSupportLevel } from './color-spaces-DeN59JDX.js';
|
|
2
|
-
export { S as SPACE_16_COLORS, a as SPACE_256_COLORS, b as SPACE_MONO, c as SPACE_TRUE_COLORS } from './color-spaces-DeN59JDX.js';
|
|
3
|
-
|
|
4
|
-
declare const isStdoutColorSupported: () => ColorSupportLevel;
|
|
5
|
-
declare const isStderrColorSupported: () => ColorSupportLevel;
|
|
6
|
-
|
|
7
|
-
export { ColorSupportLevel, isStderrColorSupported, isStdoutColorSupported };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { b as SPACE_16_COLORS, c as SPACE_256_COLORS, a as SPACE_MONO, d as SPACE_TRUE_COLORS } from './chunk-ARYGRP3O.js';
|
|
2
|
-
|
|
3
|
-
var t=()=>(()=>{if(typeof navigator<"u"){if(navigator.userAgentData&&navigator.userAgentData.brands.find(({b:p})=>p==="Chromium")?.version>93)return 3;if(/\b(Chrome|Chromium)\//.test(navigator.userAgent))return 1}return typeof process<"u"?(process.env.NEXT_RUNTIME??"").includes("edge")?1:0:0})(),C=t,u=t;
|
|
4
|
-
|
|
5
|
-
export { u as isStderrColorSupported, C as isStdoutColorSupported };
|
|
6
|
-
//# sourceMappingURL=out.js.map
|
|
7
|
-
//# sourceMappingURL=is-color-supported.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/is-color-supported.browser.ts"],"names":["isColorSupported","b","isStdoutColorSupported","isStderrColorSupported"],"mappings":"6DAOA,IAAMA,EAAmB,KACpB,IAAM,CACH,GAAI,OAAO,UAAc,IAAa,CAElC,GAAI,UAAU,eAGI,UAAU,cAAc,OAAO,KAAK,CAAC,CAAE,EAAAC,CAAE,IAAqBA,IAAM,UAAU,GAGjF,QAAU,GACjB,MAAO,GAKf,GAAI,wBAAwB,KAAK,UAAU,SAAS,EAChD,MAAO,EAEf,CAIA,OAAI,OAAO,QAAY,KACD,QAAQ,IAAI,cAAgB,IAAI,SAAS,MAAM,EAE/C,EAAkB,EAGjC,CACX,GAAG,EAEMC,EAAyBF,EAEzBG,EAAyBH","sourcesContent":["// Some of this code is taken from https://github.com/chalk/supports-color/blob/main/index.js\n// MIT License\n// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\nimport { SPACE_16_COLORS, SPACE_MONO, SPACE_TRUE_COLORS } from \"./color-spaces\";\nimport type { ColorSupportLevel } from \"./types\";\n\nconst isColorSupported = (): ColorSupportLevel =>\n (() => {\n if (typeof navigator !== \"undefined\") {\n // @ts-expect-error - `navigator` is not defined in Node.\n if (navigator.userAgentData) {\n // @ts-expect-error - `navigator` is not defined in Node.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access\n const brand = navigator.userAgentData.brands.find(({ b }: { b: string }) => b === \"Chromium\");\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (brand?.version > 93) {\n return SPACE_TRUE_COLORS;\n }\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (/\\b(Chrome|Chromium)\\//.test(navigator.userAgent)) {\n return SPACE_16_COLORS;\n }\n }\n\n // when Next.JS runtime is `edge`, process.stdout is undefined, but colors output is supported\n // runtime values supported colors: `nodejs`, `edge`, `experimental-edge`\n if (typeof process !== \"undefined\") {\n const isNextJS = (process.env.NEXT_RUNTIME ?? \"\").includes(\"edge\");\n\n return isNextJS ? SPACE_16_COLORS : SPACE_MONO;\n }\n\n return SPACE_MONO;\n })();\n\nexport const isStdoutColorSupported = isColorSupported;\n\nexport const isStderrColorSupported = isColorSupported;\n// eslint-disable-next-line import/no-unused-modules\nexport { SPACE_16_COLORS, SPACE_256_COLORS, SPACE_MONO, SPACE_TRUE_COLORS } from \"./color-spaces\";\n// eslint-disable-next-line import/no-unused-modules\nexport type { ColorSupportLevel } from \"./types\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/is-color-supported.server.ts"],"names":["isColorSupportedFactory","stdName","_this","isDeno","proc","argv","oneOfFlags","regex","terminatorPosition","position","flag","environment","FORCE_COLOR","hasForceColor","forceColorValue","forceColorValueIsString","forceColor","minColorLevel","osRelease","sign","version","isTTY","isStdoutColorSupported","isStderrColorSupported"],"mappings":"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","sourcesContent":["// Some of this code is taken from https://github.com/chalk/supports-color/blob/main/index.js\n// MIT License\n// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\nimport { SPACE_16_COLORS, SPACE_256_COLORS, SPACE_MONO, SPACE_TRUE_COLORS } from \"./color-spaces\";\nimport type { ColorSupportLevel } from \"./types\";\n\n/**\n * @param {string} stdName The standard name of the stream, either \"err\" or \"out\".\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst isColorSupportedFactory = (stdName: \"err\" | \"out\"): ColorSupportLevel => {\n // eslint-disable-next-line @typescript-eslint/naming-convention,@typescript-eslint/no-explicit-any\n const _this = globalThis as any;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const isDeno = _this.Deno != null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access\n const proc: Record<string, any> = _this.process ?? _this.Deno ?? {};\n // Node -> `argv`, Deno -> `args`\n const argv: string[] = (proc.argv ?? proc.args ?? []) as string[];\n\n /**\n * Detect whether flags exist with `-` or `--` prefix in command-line arguments.\n *\n * @param {RegExp} regex The RegEx to match all possible flags.\n * @return {boolean}\n */\n const oneOfFlags = (regex: RegExp): boolean => {\n const terminatorPosition = argv.indexOf(\"--\");\n\n const position = argv.findIndex((flag) => regex.test(flag));\n\n return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n };\n\n let environment: Record<string, string | undefined> = {};\n\n try {\n // Deno requires the permission for the access to env, use the `--allow-env` flag: deno run --allow-env ./app.js\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access\n environment = isDeno ? proc.env.toObject() : proc.env ?? {};\n } catch {\n // Deno: if interactive permission is not granted, do nothing, no colors\n }\n\n const FORCE_COLOR = \"FORCE_COLOR\";\n const hasForceColor = FORCE_COLOR in environment;\n // eslint-disable-next-line security/detect-object-injection\n const forceColorValue = environment[FORCE_COLOR] ? String(environment[FORCE_COLOR]) : undefined;\n const forceColorValueIsString = Object.prototype.toString.call(forceColorValue).slice(8, -1) === \"String\";\n\n let forceColor: ColorSupportLevel | undefined;\n\n if (forceColorValue === \"true\") {\n forceColor = SPACE_16_COLORS;\n } else if (forceColorValue === \"false\") {\n forceColor = SPACE_MONO;\n } else if (forceColorValueIsString && (forceColorValue as string).length === 0) {\n forceColor = SPACE_16_COLORS;\n } else if (forceColorValueIsString && (forceColorValue as string).length > 0) {\n forceColor = Math.min(Number.parseInt(forceColorValue as string, 10), 3) as ColorSupportLevel;\n }\n\n if (forceColorValue !== \"true\" && forceColorValue !== \"false\" && forceColor !== undefined && forceColor < 4) {\n return forceColor;\n }\n\n const isForceDisabled =\n // eslint-disable-next-line regexp/no-unused-capturing-group\n \"NO_COLOR\" in environment || (hasForceColor && forceColor === 0) || oneOfFlags(/^-{1,2}(no-color|no-colors|color=false|color=never)$/);\n\n if (isForceDisabled) {\n return SPACE_MONO;\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (oneOfFlags(/^-{1,2}(color=256)$/)) {\n return SPACE_256_COLORS;\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (oneOfFlags(/^-{1,2}(color=16m|color=full|color=truecolor)$/)) {\n return SPACE_TRUE_COLORS;\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n const isForceEnabled = oneOfFlags(/^-{1,2}(color|colors|color=true|color=always)$/);\n\n if (isForceEnabled) {\n return SPACE_16_COLORS;\n }\n\n // note: the order of checks is important\n // many terminals that support truecolor have TERM as `xterm-256colors` but do not set COLORTERM to `truecolor`\n // therefore they can be detected by specific EVN variables\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const minColorLevel = forceColor || SPACE_MONO;\n\n // Check for Azure DevOps pipelines.\n // Has to be above the `stream isTTY` check.\n if (\"TF_BUILD\" in environment && \"AGENT_NAME\" in environment) {\n return SPACE_16_COLORS;\n }\n\n const isDumbTerminal: boolean = (environment.TERM && /-mono|dumb/i.test(environment.TERM)) as boolean;\n\n if (isDumbTerminal) {\n return minColorLevel;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if ((isDeno ? _this.Deno.build.os : proc.platform) === \"win32\") {\n try {\n // Deno requires the permission for the access to the operating system, use the `--allow-sys` flag: deno run --allow-sys ./app.js\n\n // Windows 10 build 10586 is the first Windows release that supports 256 colors.\n // Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access\n const osRelease = (isDeno ? _this.Deno.osRelease() : proc.os.release()).split(\".\");\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10_586) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return Number(osRelease[2]) >= 14_931 ? SPACE_TRUE_COLORS : SPACE_256_COLORS;\n }\n\n return SPACE_16_COLORS;\n } catch {\n // Deno: if interactive permission is not granted, do nothing, no colors\n }\n }\n\n if (\"CI\" in environment) {\n if (\"GITHUB_ACTIONS\" in environment || \"GITHUB_WORKFLOW\" in environment || \"GITEA_ACTIONS\" in environment) {\n return SPACE_TRUE_COLORS;\n }\n\n if (\n [\"TRAVIS\", \"CIRCLECI\", \"APPVEYOR\", \"GITLAB_CI\", \"BUILDKITE\", \"DRONE\", \"GITLAB_CI\"].some((sign) => sign in environment) ||\n environment.CI_NAME === \"codeship\"\n ) {\n return SPACE_16_COLORS;\n }\n\n return minColorLevel;\n }\n\n // JetBrains IDEA: JetBrains-JediTerm\n if (environment.TERMINAL_EMULATOR?.includes(\"JediTerm\")) {\n return SPACE_TRUE_COLORS;\n }\n\n if (\"TEAMCITY_VERSION\" in environment) {\n // https://www.jetbrains.com/help/teamcity/build-script-interaction-with-teamcity.html#BuildScriptInteractionwithTeamCity-ReportingMessages\n // eslint-disable-next-line regexp/no-unused-capturing-group\n return /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(environment.TEAMCITY_VERSION as string) ? SPACE_16_COLORS : SPACE_MONO;\n }\n\n if (environment.COLORTERM === \"truecolor\") {\n return SPACE_TRUE_COLORS;\n }\n\n // kitty is GPU based terminal emulator\n if (environment.TERM === \"xterm-kitty\") {\n return SPACE_TRUE_COLORS;\n }\n\n if (\"TERM_PROGRAM\" in environment) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const version = Number.parseInt(((environment.TERM_PROGRAM_VERSION as string) ?? \"\").split(\".\")[0] as string, 10);\n\n if (environment.TERM_PROGRAM === \"iTerm.app\") {\n return version >= 3 ? SPACE_TRUE_COLORS : SPACE_256_COLORS;\n }\n\n if (environment.TERM_PROGRAM === \"Apple_Terminal\") {\n return SPACE_256_COLORS;\n }\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (/-256(color)?$/i.test(<string>environment.TERM)) {\n return SPACE_256_COLORS;\n }\n\n let isTTY = false;\n\n if (isDeno) {\n if (stdName === \"out\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call\n isTTY = _this.Deno.stdout.isTerminal();\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n } else if (stdName === \"err\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call\n isTTY = _this.Deno.stderr.isTerminal();\n }\n } else if (\"PM2_HOME\" in environment && \"pm_id\" in environment) {\n // PM2 does not set process.stdout.isTTY, but colors may be supported (depends on actual terminal)\n isTTY = true;\n } else {\n isTTY = proc[\"std\" + stdName] && \"isTTY\" in proc[\"std\" + stdName];\n }\n\n if (isTTY && /^screen|^tmux|^xterm|^vt[1-5]\\d\\d|^ansi|color|mintty|rxvt|cygwin|linux/i.test(<string>environment.TERM)) {\n return SPACE_16_COLORS;\n }\n\n if (\"COLORTERM\" in environment) {\n return SPACE_16_COLORS;\n }\n\n return minColorLevel;\n};\n\nexport const isStdoutColorSupported = (): ColorSupportLevel => isColorSupportedFactory(\"out\");\n\nexport const isStderrColorSupported = (): ColorSupportLevel => isColorSupportedFactory(\"err\");\n// eslint-disable-next-line import/no-unused-modules\nexport { SPACE_16_COLORS, SPACE_256_COLORS, SPACE_MONO, SPACE_TRUE_COLORS } from \"./color-spaces\";\n// eslint-disable-next-line import/no-unused-modules\nexport type { ColorSupportLevel } from \"./types\";\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { b as SPACE_16_COLORS, c as SPACE_256_COLORS, a as SPACE_MONO, d as SPACE_TRUE_COLORS } from './chunk-ARYGRP3O.js';
|
|
2
|
-
|
|
3
|
-
var d=a=>{let l=globalThis,R=l.Deno!=null,n=l.process??l.Deno??{},E=n.argv??n.args??[],O=t=>{let _=E.indexOf("--"),S=E.findIndex(A=>t.test(A));return S!==-1&&(_===-1||S<_)},r={};try{r=R?n.env.toObject():n.env??{};}catch{}let p="FORCE_COLOR",m=p in r,i=r[p]?String(r[p]):void 0,T=Object.prototype.toString.call(i).slice(8,-1)==="String",o;if(i==="true"?o=1:i==="false"?o=0:T&&i.length===0?o=1:T&&i.length>0&&(o=Math.min(Number.parseInt(i,10),3)),i!=="true"&&i!=="false"&&o!==void 0&&o<4)return o;if("NO_COLOR"in r||m&&o===0||O(/^-{1,2}(no-color|no-colors|color=false|color=never)$/))return 0;if(O(/^-{1,2}(color=256)$/))return 2;if(O(/^-{1,2}(color=16m|color=full|color=truecolor)$/))return 3;if(O(/^-{1,2}(color|colors|color=true|color=always)$/))return 1;let C=o||0;if("TF_BUILD"in r&&"AGENT_NAME"in r)return 1;if(r.TERM&&/-mono|dumb/i.test(r.TERM))return C;if((R?l.Deno.build.os:n.platform)==="win32")try{let t=(R?l.Deno.osRelease():n.os.release()).split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}catch{}if("CI"in r)return "GITHUB_ACTIONS"in r||"GITHUB_WORKFLOW"in r||"GITEA_ACTIONS"in r?3:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE","GITLAB_CI"].some(t=>t in r)||r.CI_NAME==="codeship"?1:C;if(r.TERMINAL_EMULATOR?.includes("JediTerm"))return 3;if("TEAMCITY_VERSION"in r)return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if(r.COLORTERM==="truecolor")return 3;if(r.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in r){let t=Number.parseInt((r.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(r.TERM_PROGRAM==="iTerm.app")return t>=3?3:2;if(r.TERM_PROGRAM==="Apple_Terminal")return 2}if(/-256(color)?$/i.test(r.TERM))return 2;let c=!1;return R?a==="out"?c=l.Deno.stdout.isTerminal():a==="err"&&(c=l.Deno.stderr.isTerminal()):"PM2_HOME"in r&&"pm_id"in r?c=!0:c=n["std"+a]&&"isTTY"in n["std"+a],c&&/^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i.test(r.TERM)?1:"COLORTERM"in r?1:C},v=()=>d("out"),P=()=>d("err");
|
|
4
|
-
|
|
5
|
-
export { P as isStderrColorSupported, v as isStdoutColorSupported };
|
|
6
|
-
//# sourceMappingURL=out.js.map
|
|
7
|
-
//# sourceMappingURL=is-color-supported.server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/is-color-supported.server.ts"],"names":["isColorSupportedFactory","stdName","_this","isDeno","proc","argv","oneOfFlags","regex","terminatorPosition","position","flag","environment","FORCE_COLOR","hasForceColor","forceColorValue","forceColorValueIsString","forceColor","minColorLevel","osRelease","sign","version","isTTY","isStdoutColorSupported","isStderrColorSupported"],"mappings":"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","sourcesContent":["// Some of this code is taken from https://github.com/chalk/supports-color/blob/main/index.js\n// MIT License\n// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\nimport { SPACE_16_COLORS, SPACE_256_COLORS, SPACE_MONO, SPACE_TRUE_COLORS } from \"./color-spaces\";\nimport type { ColorSupportLevel } from \"./types\";\n\n/**\n * @param {string} stdName The standard name of the stream, either \"err\" or \"out\".\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nconst isColorSupportedFactory = (stdName: \"err\" | \"out\"): ColorSupportLevel => {\n // eslint-disable-next-line @typescript-eslint/naming-convention,@typescript-eslint/no-explicit-any\n const _this = globalThis as any;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const isDeno = _this.Deno != null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access\n const proc: Record<string, any> = _this.process ?? _this.Deno ?? {};\n // Node -> `argv`, Deno -> `args`\n const argv: string[] = (proc.argv ?? proc.args ?? []) as string[];\n\n /**\n * Detect whether flags exist with `-` or `--` prefix in command-line arguments.\n *\n * @param {RegExp} regex The RegEx to match all possible flags.\n * @return {boolean}\n */\n const oneOfFlags = (regex: RegExp): boolean => {\n const terminatorPosition = argv.indexOf(\"--\");\n\n const position = argv.findIndex((flag) => regex.test(flag));\n\n return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n };\n\n let environment: Record<string, string | undefined> = {};\n\n try {\n // Deno requires the permission for the access to env, use the `--allow-env` flag: deno run --allow-env ./app.js\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access\n environment = isDeno ? proc.env.toObject() : proc.env ?? {};\n } catch {\n // Deno: if interactive permission is not granted, do nothing, no colors\n }\n\n const FORCE_COLOR = \"FORCE_COLOR\";\n const hasForceColor = FORCE_COLOR in environment;\n // eslint-disable-next-line security/detect-object-injection\n const forceColorValue = environment[FORCE_COLOR] ? String(environment[FORCE_COLOR]) : undefined;\n const forceColorValueIsString = Object.prototype.toString.call(forceColorValue).slice(8, -1) === \"String\";\n\n let forceColor: ColorSupportLevel | undefined;\n\n if (forceColorValue === \"true\") {\n forceColor = SPACE_16_COLORS;\n } else if (forceColorValue === \"false\") {\n forceColor = SPACE_MONO;\n } else if (forceColorValueIsString && (forceColorValue as string).length === 0) {\n forceColor = SPACE_16_COLORS;\n } else if (forceColorValueIsString && (forceColorValue as string).length > 0) {\n forceColor = Math.min(Number.parseInt(forceColorValue as string, 10), 3) as ColorSupportLevel;\n }\n\n if (forceColorValue !== \"true\" && forceColorValue !== \"false\" && forceColor !== undefined && forceColor < 4) {\n return forceColor;\n }\n\n const isForceDisabled =\n // eslint-disable-next-line regexp/no-unused-capturing-group\n \"NO_COLOR\" in environment || (hasForceColor && forceColor === 0) || oneOfFlags(/^-{1,2}(no-color|no-colors|color=false|color=never)$/);\n\n if (isForceDisabled) {\n return SPACE_MONO;\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (oneOfFlags(/^-{1,2}(color=256)$/)) {\n return SPACE_256_COLORS;\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (oneOfFlags(/^-{1,2}(color=16m|color=full|color=truecolor)$/)) {\n return SPACE_TRUE_COLORS;\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n const isForceEnabled = oneOfFlags(/^-{1,2}(color|colors|color=true|color=always)$/);\n\n if (isForceEnabled) {\n return SPACE_16_COLORS;\n }\n\n // note: the order of checks is important\n // many terminals that support truecolor have TERM as `xterm-256colors` but do not set COLORTERM to `truecolor`\n // therefore they can be detected by specific EVN variables\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const minColorLevel = forceColor || SPACE_MONO;\n\n // Check for Azure DevOps pipelines.\n // Has to be above the `stream isTTY` check.\n if (\"TF_BUILD\" in environment && \"AGENT_NAME\" in environment) {\n return SPACE_16_COLORS;\n }\n\n const isDumbTerminal: boolean = (environment.TERM && /-mono|dumb/i.test(environment.TERM)) as boolean;\n\n if (isDumbTerminal) {\n return minColorLevel;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if ((isDeno ? _this.Deno.build.os : proc.platform) === \"win32\") {\n try {\n // Deno requires the permission for the access to the operating system, use the `--allow-sys` flag: deno run --allow-sys ./app.js\n\n // Windows 10 build 10586 is the first Windows release that supports 256 colors.\n // Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access\n const osRelease = (isDeno ? _this.Deno.osRelease() : proc.os.release()).split(\".\");\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10_586) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return Number(osRelease[2]) >= 14_931 ? SPACE_TRUE_COLORS : SPACE_256_COLORS;\n }\n\n return SPACE_16_COLORS;\n } catch {\n // Deno: if interactive permission is not granted, do nothing, no colors\n }\n }\n\n if (\"CI\" in environment) {\n if (\"GITHUB_ACTIONS\" in environment || \"GITHUB_WORKFLOW\" in environment || \"GITEA_ACTIONS\" in environment) {\n return SPACE_TRUE_COLORS;\n }\n\n if (\n [\"TRAVIS\", \"CIRCLECI\", \"APPVEYOR\", \"GITLAB_CI\", \"BUILDKITE\", \"DRONE\", \"GITLAB_CI\"].some((sign) => sign in environment) ||\n environment.CI_NAME === \"codeship\"\n ) {\n return SPACE_16_COLORS;\n }\n\n return minColorLevel;\n }\n\n // JetBrains IDEA: JetBrains-JediTerm\n if (environment.TERMINAL_EMULATOR?.includes(\"JediTerm\")) {\n return SPACE_TRUE_COLORS;\n }\n\n if (\"TEAMCITY_VERSION\" in environment) {\n // https://www.jetbrains.com/help/teamcity/build-script-interaction-with-teamcity.html#BuildScriptInteractionwithTeamCity-ReportingMessages\n // eslint-disable-next-line regexp/no-unused-capturing-group\n return /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(environment.TEAMCITY_VERSION as string) ? SPACE_16_COLORS : SPACE_MONO;\n }\n\n if (environment.COLORTERM === \"truecolor\") {\n return SPACE_TRUE_COLORS;\n }\n\n // kitty is GPU based terminal emulator\n if (environment.TERM === \"xterm-kitty\") {\n return SPACE_TRUE_COLORS;\n }\n\n if (\"TERM_PROGRAM\" in environment) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const version = Number.parseInt(((environment.TERM_PROGRAM_VERSION as string) ?? \"\").split(\".\")[0] as string, 10);\n\n if (environment.TERM_PROGRAM === \"iTerm.app\") {\n return version >= 3 ? SPACE_TRUE_COLORS : SPACE_256_COLORS;\n }\n\n if (environment.TERM_PROGRAM === \"Apple_Terminal\") {\n return SPACE_256_COLORS;\n }\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (/-256(color)?$/i.test(<string>environment.TERM)) {\n return SPACE_256_COLORS;\n }\n\n let isTTY = false;\n\n if (isDeno) {\n if (stdName === \"out\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call\n isTTY = _this.Deno.stdout.isTerminal();\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n } else if (stdName === \"err\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call\n isTTY = _this.Deno.stderr.isTerminal();\n }\n } else if (\"PM2_HOME\" in environment && \"pm_id\" in environment) {\n // PM2 does not set process.stdout.isTTY, but colors may be supported (depends on actual terminal)\n isTTY = true;\n } else {\n isTTY = proc[\"std\" + stdName] && \"isTTY\" in proc[\"std\" + stdName];\n }\n\n if (isTTY && /^screen|^tmux|^xterm|^vt[1-5]\\d\\d|^ansi|color|mintty|rxvt|cygwin|linux/i.test(<string>environment.TERM)) {\n return SPACE_16_COLORS;\n }\n\n if (\"COLORTERM\" in environment) {\n return SPACE_16_COLORS;\n }\n\n return minColorLevel;\n};\n\nexport const isStdoutColorSupported = (): ColorSupportLevel => isColorSupportedFactory(\"out\");\n\nexport const isStderrColorSupported = (): ColorSupportLevel => isColorSupportedFactory(\"err\");\n// eslint-disable-next-line import/no-unused-modules\nexport { SPACE_16_COLORS, SPACE_256_COLORS, SPACE_MONO, SPACE_TRUE_COLORS } from \"./color-spaces\";\n// eslint-disable-next-line import/no-unused-modules\nexport type { ColorSupportLevel } from \"./types\";\n"]}
|