@visulima/is-ansi-color-supported 1.0.0

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 ADDED
@@ -0,0 +1,11 @@
1
+ ## @visulima/is-ansi-color-supported 1.0.0 (2024-01-28)
2
+
3
+
4
+ ### Features
5
+
6
+ * added colorize and is-ansi-color-supported ([e2d9945](https://github.com/visulima/visulima/commit/e2d9945a5666bc8f3be0aea9b5aca45f2ba44284))
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fixed wrong package.json ([43dd507](https://github.com/visulima/visulima/commit/43dd507419c7020251396bfc26854a360e72d605))
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 visulima
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,134 @@
1
+ <div align="center">
2
+ <h3>Visulima is-ansi-color-supported</h3>
3
+ <p>
4
+ Detect whether a terminal, browser or edge supports ansi colors.
5
+ </p>
6
+ </div>
7
+
8
+ <br />
9
+
10
+ <div align="center">
11
+
12
+ [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ <div align="center">
19
+ <p>
20
+ <sup>
21
+ Daniel Bannert's open source work is supported by the community on <a href="https://github.com/sponsors/prisis">GitHub Sponsors</a>
22
+ </sup>
23
+ </p>
24
+ </div>
25
+
26
+ ---
27
+
28
+ ## Install
29
+
30
+ ```sh
31
+ npm install @visulima/is-ansi-color-supported
32
+ ```
33
+
34
+ ```sh
35
+ yarn add @visulima/is-ansi-color-supported
36
+ ```
37
+
38
+ ```sh
39
+ pnpm add @visulima/is-ansi-color-supported
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ ```typescript
45
+ import { isColorSupported } from "@visulima/is-ansi-color-supported";
46
+
47
+ /**
48
+ * Levels:
49
+ * - `0` - All colors disabled.
50
+ * - `1` - Basic 16 colors support.
51
+ * - `2` - ANSI 256 colors support.
52
+ * - `3` - Truecolor 16 million colors support.
53
+ */
54
+ console.log(isColorSupported()); // 3
55
+ ```
56
+
57
+ ## Environment variables
58
+
59
+ To force disable or enable colored output use environment variables `NO_COLOR` and `FORCE_COLOR`.
60
+
61
+ The `NO_COLOR` variable should be presents with any not empty value.
62
+ The value is not important, e.g., `NO_COLOR=1` `NO_COLOR=true` disable colors.
63
+ See standard description by [NO_COLOR](https://no-color.org/).
64
+
65
+ The `FORCE_COLOR` variable should be presents with one of values:\
66
+ `FORCE_COLOR=0` force disable colors\
67
+ `FORCE_COLOR=1` force enable colors
68
+
69
+ ## CLI arguments
70
+
71
+ Use arguments `--no-color` or `--color=false` to disable colors and `--color` to enable ones.
72
+
73
+ For example, an executable script _colors.js_:
74
+
75
+ ```js
76
+ #!/usr/bin/env node
77
+ import { isColorSupported } from "@visulima/is-ansi-color-supported";
78
+
79
+ console.log(isColorSupported());
80
+ ```
81
+
82
+ Execute the script in a terminal:
83
+
84
+ ```
85
+ $ ./colors.js # colored output in terminal
86
+ $ ./colors.js --no-color # non colored output in terminal
87
+ $ ./colors.js --color=false # non colored output in terminal
88
+
89
+ $ ./colors.js > log.txt # output in file without ANSI codes
90
+ $ ./colors.js --color > log.txt # output in file with ANSI codes
91
+ $ ./colors.js --color=true > log.txt # output in file with ANSI codes
92
+ ```
93
+
94
+ > **Warning**
95
+ >
96
+ > The command line arguments have a higher priority than environment variable.
97
+
98
+ ## Info
99
+
100
+ 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.
101
+
102
+ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
103
+
104
+ ## Related
105
+
106
+ - [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
107
+ - [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
108
+
109
+ ## Supported Node.js Versions
110
+
111
+ Libraries in this ecosystem make the best effort to track [Node.js’ release schedule](https://github.com/nodejs/release#release-schedule).
112
+ Here’s [a post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
113
+
114
+ ## Contributing
115
+
116
+ If you would like to help take a look at the [list of issues](https://github.com/visulima/visulima/issues) and check our [Contributing](.github/CONTRIBUTING.md) guild.
117
+
118
+ > **Note:** please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
119
+
120
+ ## Credits
121
+
122
+ - [Daniel Bannert](https://github.com/prisis)
123
+ - [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
124
+
125
+ ## License
126
+
127
+ The visulima is-ansi-color-supported is open-sourced software licensed under the [MIT][license-url]
128
+
129
+ [typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
130
+ [typescript-url]: "typescript"
131
+ [license-image]: https://img.shields.io/npm/l/@visulima/is-ansi-color-supported?color=blueviolet&style=for-the-badge
132
+ [license-url]: LICENSE.md "license"
133
+ [npm-image]: https://img.shields.io/npm/v/@visulima/is-ansi-color-supported/latest.svg?style=for-the-badge&logo=npm
134
+ [npm-url]: https://www.npmjs.com/package/@visulima/is-ansi-color-supported/v/latest "npm"
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var o=()=>(()=>{if(typeof navigator<"u"){if(navigator.userAgentData&&navigator.userAgentData.brands.find(({b:r})=>r==="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})();
4
+
5
+ exports.isColorSupported = o;
6
+ //# sourceMappingURL=out.js.map
7
+ //# sourceMappingURL=is-color-supported.browser.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/is-color-supported.browser.ts"],"names":["isColorSupported","b"],"mappings":"AAOO,IAAMA,EAAmB,KAC3B,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,MACD,QAAQ,IAAI,cAAmB,IAAI,SAAS,MAAM,EAElD,EAGf,CACX,GAAG","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 type { ColorSupportLevel } from \"./types\";\n\n// eslint-disable-next-line import/no-unused-modules\nexport const 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 3;\n }\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (/\\b(Chrome|Chromium)\\//.test(navigator.userAgent)) {\n return 1;\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 ? 1 : 0;\n }\n\n return 0;\n })();\n\n// eslint-disable-next-line import/no-unused-modules\nexport type { ColorSupportLevel } from \"./types\";\n"]}
@@ -0,0 +1,5 @@
1
+ import { C as ColorSupportLevel } from './types-tBMJqxWx.cjs';
2
+
3
+ declare const isColorSupported: () => ColorSupportLevel;
4
+
5
+ export { ColorSupportLevel, isColorSupported };
@@ -0,0 +1,5 @@
1
+ import { C as ColorSupportLevel } from './types-tBMJqxWx.js';
2
+
3
+ declare const isColorSupported: () => ColorSupportLevel;
4
+
5
+ export { ColorSupportLevel, isColorSupported };
@@ -0,0 +1,5 @@
1
+ var n=()=>(()=>{if(typeof navigator<"u"){if(navigator.userAgentData&&navigator.userAgentData.brands.find(({b:r})=>r==="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})();
2
+
3
+ export { n as isColorSupported };
4
+ //# sourceMappingURL=out.js.map
5
+ //# sourceMappingURL=is-color-supported.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/is-color-supported.browser.ts"],"names":["isColorSupported","b"],"mappings":"AAOO,IAAMA,EAAmB,KAC3B,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,MACD,QAAQ,IAAI,cAAmB,IAAI,SAAS,MAAM,EAElD,EAGf,CACX,GAAG","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 type { ColorSupportLevel } from \"./types\";\n\n// eslint-disable-next-line import/no-unused-modules\nexport const 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 3;\n }\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (/\\b(Chrome|Chromium)\\//.test(navigator.userAgent)) {\n return 1;\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 ? 1 : 0;\n }\n\n return 0;\n })();\n\n// eslint-disable-next-line import/no-unused-modules\nexport type { ColorSupportLevel } from \"./types\";\n"]}
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var _=T=>{let t=T??globalThis,s=t.Deno!=null,o=t.process??t.Deno??{},a=o.argv??o.args??[],l=e=>{let R=a.indexOf("--"),p=a.findIndex(E=>e.test(E));return p!==-1&&(R===-1||p<R)},r={};try{r=s?o.env.toObject():o.env??{};}catch{}let c="FORCE_COLOR",C=c in r,n=r[c]?String(r[c]):void 0,f=Object.prototype.toString.call(n).slice(8,-1)==="String",i=0;if(n==="true"?i=1:n==="false"?i=0:f&&n.length===0?i=1:f&&n.length>0&&(i=Math.min(Number.parseInt(n,10),3)),"NO_COLOR"in r||C&&i===0||l(/^-{1,2}(no-color|no-colors|color=false|color=never)$/))return 0;if(l(/^-{1,2}(color=256)$/))return 2;if(l(/^-{1,2}(color=16m|color=full|color=truecolor)$/))return 3;if(l(/^-{1,2}(color|colors|color=true|color=always)$/))return 1;let u=i||0;if("TF_BUILD"in r&&"AGENT_NAME"in r)return 1;if(r.TERM==="dumb")return u;if((s?t.Deno.build.os:o.platform)==="win32")try{let e=(s?t.Deno.osRelease():o.os.release()).split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}catch{}if("CI"in r)return "GITHUB_ACTIONS"in r||"GITEA_ACTIONS"in r?3:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE","GITLAB_CI"].some(e=>e in r)||r.CI_NAME==="codeship"?1:u;if("TEAMCITY_VERSION"in r)return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if(r.COLORTERM==="truecolor"||r.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in r){let e=Number.parseInt((r.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(r.TERM_PROGRAM==="iTerm.app")return e>=3?3:2;if(r.TERM_PROGRAM==="Apple_Terminal")return 2}return /-256(color)?$/i.test(r.TERM)?2:(s?t.Deno.isatty(1):o.stdout&&"isTTY"in o.stdout)&&/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:u};
4
+
5
+ exports.isColorSupported = _;
6
+ //# sourceMappingURL=out.js.map
7
+ //# sourceMappingURL=is-color-supported.server.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/is-color-supported.server.ts"],"names":["isColorSupported","mockThis","_this","isDeno","proc","argv","oneOfFlags","regex","terminatorPosition","position","flag","environment","FORCE_COLOR","hasForceColor","forceColorValue","forceColorValueIsString","forceColor","minColorLevel","osRelease","sign","version"],"mappings":"AAUO,IAAMA,EAAoBC,GAAsC,CAEnE,IAAMC,EAAQD,GAAY,WAEpBE,EAASD,EAAM,MAAQ,KAEvBE,EAA4BF,EAAM,SAAWA,EAAM,MAAQ,CAAC,EAE5DG,EAAkBD,EAAK,MAAWA,EAAK,MAAW,CAAC,EAQnDE,EAAcC,GAA2B,CAC3C,IAAMC,EAAqBH,EAAK,QAAQ,IAAI,EAEtCI,EAAWJ,EAAK,UAAWK,GAASH,EAAM,KAAKG,CAAI,CAAC,EAE1D,OAAOD,IAAa,KAAOD,IAAuB,IAAMC,EAAWD,EACvE,EAEIG,EAAkD,CAAC,EAEvD,GAAI,CAGAA,EAAcR,EAASC,EAAK,IAAO,SAAS,EAAIA,EAAK,KAAU,CAAC,CACpE,MAAQ,CAER,CAEA,IAAMQ,EAAc,cACdC,EAAgBD,KAAeD,EAE/BG,EAAkBH,EAAYC,CAAW,EAAI,OAAOD,EAAYC,CAAW,CAAC,EAAI,OAChFG,EAA0B,OAAO,UAAU,SAAS,KAAKD,CAAe,EAAE,MAAM,EAAG,EAAE,IAAM,SAE7FE,EAAgC,EAgBpC,GAdIF,IAAoB,OACpBE,EAAa,EACNF,IAAoB,QAC3BE,EAAa,EACND,GAA4BD,EAA2B,SAAW,EACzEE,EAAa,EACND,GAA4BD,EAA2B,OAAS,IACvEE,EAAa,KAAK,IAAI,OAAO,SAASF,EAA2B,EAAE,EAAG,CAAC,GAKvE,aAAcH,GAAgBE,GAAiBG,IAAe,GAAMV,EAAW,sDAAsD,EAGrI,MAAO,GAIX,GAAIA,EAAW,qBAAqB,EAChC,MAAO,GAIX,GAAIA,EAAW,gDAAgD,EAC3D,MAAO,GAMX,GAFuBA,EAAW,gDAAgD,EAG9E,MAAO,GAGX,IAAMW,EAAgBD,GAAc,EAIpC,GAAI,aAAcL,GAAe,eAAgBA,EAC7C,MAAO,GAKX,GAFgCA,EAAY,OAAY,OAGpD,OAAOM,EAIX,IAAKd,EAASD,EAAM,KAAK,MAAM,GAAKE,EAAK,YAAiB,QACtD,GAAI,CAMA,IAAMc,GAAaf,EAASD,EAAM,KAAK,UAAU,EAAIE,EAAK,GAAM,QAAQ,GAAG,MAAM,GAAG,EAGpF,OAAI,OAAOc,EAAU,CAAC,CAAC,GAAK,IAAM,OAAOA,EAAU,CAAC,CAAC,GAAK,MAE/C,OAAOA,EAAU,CAAC,CAAC,GAAK,MAAS,EAAI,EAGzC,CACX,MAAQ,CAER,CAGJ,GAAI,OAAQP,EACR,MAAI,mBAAoBA,GAAe,kBAAmBA,EAC/C,EAIP,CAAC,SAAU,WAAY,WAAY,YAAa,YAAa,QAAS,WAAW,EAAE,KAAMQ,GAASA,KAAQR,CAAW,GACrHA,EAAY,UAAe,WAEpB,EAGJM,EAGX,GAAI,qBAAsBN,EAGtB,MAAO,gCAAgC,KAAKA,EAAY,gBAA6B,EAAI,EAAI,EAOjG,GAJIA,EAAY,YAAiB,aAI7BA,EAAY,OAAY,cACxB,MAAO,GAGX,GAAI,iBAAkBA,EAAa,CAE/B,IAAMS,EAAU,OAAO,UAAWT,EAAY,sBAAsC,IAAI,MAAM,GAAG,EAAE,CAAC,EAAa,EAAE,EAEnH,GAAIA,EAAY,eAAoB,YAChC,OAAOS,GAAW,EAAI,EAAI,EAG9B,GAAIT,EAAY,eAAoB,iBAChC,MAAO,EAEf,CAGA,MAAI,iBAAiB,KAAaA,EAAY,IAAO,EAC1C,GAIGR,EAASD,EAAM,KAAK,OAAO,CAAC,EAAIE,EAAK,QAAa,UAAWA,EAAK,SAEnE,8DAA8D,KAAaO,EAAY,IAAO,GAIvG,cAAeA,EACR,EAGJM,CACX","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 type { ColorSupportLevel } from \"./types\";\n\n/**\n * @param {Object?} mockThis The mock object of globalThis, used by unit test only.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity,@typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nexport const isColorSupported = (mockThis?: any): ColorSupportLevel => {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const _this = mockThis ?? globalThis;\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-unsafe-member-access,@typescript-eslint/no-explicit-any\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 = 0;\n\n if (forceColorValue === \"true\") {\n forceColor = 1;\n } else if (forceColorValue === \"false\") {\n forceColor = 0;\n } else if (forceColorValueIsString && (forceColorValue as string).length === 0) {\n forceColor = 1;\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 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 0;\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (oneOfFlags(/^-{1,2}(color=256)$/)) {\n return 2;\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 3;\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 1;\n }\n\n const minColorLevel = forceColor || 0;\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 1;\n }\n\n const isDumbTerminal: boolean = environment[\"TERM\"] === \"dumb\";\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 ? 3 : 2;\n }\n\n return 1;\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 || \"GITEA_ACTIONS\" in environment) {\n return 3;\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 1;\n }\n\n return minColorLevel;\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) ? 1 : 0;\n }\n\n if (environment[\"COLORTERM\"] === \"truecolor\") {\n return 3;\n }\n\n if (environment[\"TERM\"] === \"xterm-kitty\") {\n return 3;\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 ? 3 : 2;\n }\n\n if (environment[\"TERM_PROGRAM\"] === \"Apple_Terminal\") {\n return 2;\n }\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (/-256(color)?$/i.test(<string>environment[\"TERM\"])) {\n return 2;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access\n const isTTY = isDeno ? _this.Deno.isatty(1) : proc[\"stdout\"] && \"isTTY\" in proc[\"stdout\"];\n\n if (isTTY && /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(<string>environment[\"TERM\"])) {\n return 1;\n }\n\n if (\"COLORTERM\" in environment) {\n return 1;\n }\n\n return minColorLevel;\n};\n\n// eslint-disable-next-line import/no-unused-modules\nexport type { ColorSupportLevel } from \"./types\";\n"]}
@@ -0,0 +1,5 @@
1
+ import { C as ColorSupportLevel } from './types-tBMJqxWx.cjs';
2
+
3
+ declare const isColorSupported: (mockThis?: any) => ColorSupportLevel;
4
+
5
+ export { ColorSupportLevel, isColorSupported };
@@ -0,0 +1,5 @@
1
+ import { C as ColorSupportLevel } from './types-tBMJqxWx.js';
2
+
3
+ declare const isColorSupported: (mockThis?: any) => ColorSupportLevel;
4
+
5
+ export { ColorSupportLevel, isColorSupported };
@@ -0,0 +1,5 @@
1
+ var M=T=>{let t=T??globalThis,s=t.Deno!=null,o=t.process??t.Deno??{},a=o.argv??o.args??[],l=e=>{let R=a.indexOf("--"),p=a.findIndex(E=>e.test(E));return p!==-1&&(R===-1||p<R)},r={};try{r=s?o.env.toObject():o.env??{};}catch{}let c="FORCE_COLOR",C=c in r,n=r[c]?String(r[c]):void 0,f=Object.prototype.toString.call(n).slice(8,-1)==="String",i=0;if(n==="true"?i=1:n==="false"?i=0:f&&n.length===0?i=1:f&&n.length>0&&(i=Math.min(Number.parseInt(n,10),3)),"NO_COLOR"in r||C&&i===0||l(/^-{1,2}(no-color|no-colors|color=false|color=never)$/))return 0;if(l(/^-{1,2}(color=256)$/))return 2;if(l(/^-{1,2}(color=16m|color=full|color=truecolor)$/))return 3;if(l(/^-{1,2}(color|colors|color=true|color=always)$/))return 1;let u=i||0;if("TF_BUILD"in r&&"AGENT_NAME"in r)return 1;if(r.TERM==="dumb")return u;if((s?t.Deno.build.os:o.platform)==="win32")try{let e=(s?t.Deno.osRelease():o.os.release()).split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}catch{}if("CI"in r)return "GITHUB_ACTIONS"in r||"GITEA_ACTIONS"in r?3:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE","GITLAB_CI"].some(e=>e in r)||r.CI_NAME==="codeship"?1:u;if("TEAMCITY_VERSION"in r)return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if(r.COLORTERM==="truecolor"||r.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in r){let e=Number.parseInt((r.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(r.TERM_PROGRAM==="iTerm.app")return e>=3?3:2;if(r.TERM_PROGRAM==="Apple_Terminal")return 2}return /-256(color)?$/i.test(r.TERM)?2:(s?t.Deno.isatty(1):o.stdout&&"isTTY"in o.stdout)&&/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:u};
2
+
3
+ export { M as isColorSupported };
4
+ //# sourceMappingURL=out.js.map
5
+ //# sourceMappingURL=is-color-supported.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/is-color-supported.server.ts"],"names":["isColorSupported","mockThis","_this","isDeno","proc","argv","oneOfFlags","regex","terminatorPosition","position","flag","environment","FORCE_COLOR","hasForceColor","forceColorValue","forceColorValueIsString","forceColor","minColorLevel","osRelease","sign","version"],"mappings":"AAUO,IAAMA,EAAoBC,GAAsC,CAEnE,IAAMC,EAAQD,GAAY,WAEpBE,EAASD,EAAM,MAAQ,KAEvBE,EAA4BF,EAAM,SAAWA,EAAM,MAAQ,CAAC,EAE5DG,EAAkBD,EAAK,MAAWA,EAAK,MAAW,CAAC,EAQnDE,EAAcC,GAA2B,CAC3C,IAAMC,EAAqBH,EAAK,QAAQ,IAAI,EAEtCI,EAAWJ,EAAK,UAAWK,GAASH,EAAM,KAAKG,CAAI,CAAC,EAE1D,OAAOD,IAAa,KAAOD,IAAuB,IAAMC,EAAWD,EACvE,EAEIG,EAAkD,CAAC,EAEvD,GAAI,CAGAA,EAAcR,EAASC,EAAK,IAAO,SAAS,EAAIA,EAAK,KAAU,CAAC,CACpE,MAAQ,CAER,CAEA,IAAMQ,EAAc,cACdC,EAAgBD,KAAeD,EAE/BG,EAAkBH,EAAYC,CAAW,EAAI,OAAOD,EAAYC,CAAW,CAAC,EAAI,OAChFG,EAA0B,OAAO,UAAU,SAAS,KAAKD,CAAe,EAAE,MAAM,EAAG,EAAE,IAAM,SAE7FE,EAAgC,EAgBpC,GAdIF,IAAoB,OACpBE,EAAa,EACNF,IAAoB,QAC3BE,EAAa,EACND,GAA4BD,EAA2B,SAAW,EACzEE,EAAa,EACND,GAA4BD,EAA2B,OAAS,IACvEE,EAAa,KAAK,IAAI,OAAO,SAASF,EAA2B,EAAE,EAAG,CAAC,GAKvE,aAAcH,GAAgBE,GAAiBG,IAAe,GAAMV,EAAW,sDAAsD,EAGrI,MAAO,GAIX,GAAIA,EAAW,qBAAqB,EAChC,MAAO,GAIX,GAAIA,EAAW,gDAAgD,EAC3D,MAAO,GAMX,GAFuBA,EAAW,gDAAgD,EAG9E,MAAO,GAGX,IAAMW,EAAgBD,GAAc,EAIpC,GAAI,aAAcL,GAAe,eAAgBA,EAC7C,MAAO,GAKX,GAFgCA,EAAY,OAAY,OAGpD,OAAOM,EAIX,IAAKd,EAASD,EAAM,KAAK,MAAM,GAAKE,EAAK,YAAiB,QACtD,GAAI,CAMA,IAAMc,GAAaf,EAASD,EAAM,KAAK,UAAU,EAAIE,EAAK,GAAM,QAAQ,GAAG,MAAM,GAAG,EAGpF,OAAI,OAAOc,EAAU,CAAC,CAAC,GAAK,IAAM,OAAOA,EAAU,CAAC,CAAC,GAAK,MAE/C,OAAOA,EAAU,CAAC,CAAC,GAAK,MAAS,EAAI,EAGzC,CACX,MAAQ,CAER,CAGJ,GAAI,OAAQP,EACR,MAAI,mBAAoBA,GAAe,kBAAmBA,EAC/C,EAIP,CAAC,SAAU,WAAY,WAAY,YAAa,YAAa,QAAS,WAAW,EAAE,KAAMQ,GAASA,KAAQR,CAAW,GACrHA,EAAY,UAAe,WAEpB,EAGJM,EAGX,GAAI,qBAAsBN,EAGtB,MAAO,gCAAgC,KAAKA,EAAY,gBAA6B,EAAI,EAAI,EAOjG,GAJIA,EAAY,YAAiB,aAI7BA,EAAY,OAAY,cACxB,MAAO,GAGX,GAAI,iBAAkBA,EAAa,CAE/B,IAAMS,EAAU,OAAO,UAAWT,EAAY,sBAAsC,IAAI,MAAM,GAAG,EAAE,CAAC,EAAa,EAAE,EAEnH,GAAIA,EAAY,eAAoB,YAChC,OAAOS,GAAW,EAAI,EAAI,EAG9B,GAAIT,EAAY,eAAoB,iBAChC,MAAO,EAEf,CAGA,MAAI,iBAAiB,KAAaA,EAAY,IAAO,EAC1C,GAIGR,EAASD,EAAM,KAAK,OAAO,CAAC,EAAIE,EAAK,QAAa,UAAWA,EAAK,SAEnE,8DAA8D,KAAaO,EAAY,IAAO,GAIvG,cAAeA,EACR,EAGJM,CACX","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 type { ColorSupportLevel } from \"./types\";\n\n/**\n * @param {Object?} mockThis The mock object of globalThis, used by unit test only.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity,@typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any\nexport const isColorSupported = (mockThis?: any): ColorSupportLevel => {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const _this = mockThis ?? globalThis;\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-unsafe-member-access,@typescript-eslint/no-explicit-any\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 = 0;\n\n if (forceColorValue === \"true\") {\n forceColor = 1;\n } else if (forceColorValue === \"false\") {\n forceColor = 0;\n } else if (forceColorValueIsString && (forceColorValue as string).length === 0) {\n forceColor = 1;\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 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 0;\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (oneOfFlags(/^-{1,2}(color=256)$/)) {\n return 2;\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 3;\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 1;\n }\n\n const minColorLevel = forceColor || 0;\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 1;\n }\n\n const isDumbTerminal: boolean = environment[\"TERM\"] === \"dumb\";\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 ? 3 : 2;\n }\n\n return 1;\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 || \"GITEA_ACTIONS\" in environment) {\n return 3;\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 1;\n }\n\n return minColorLevel;\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) ? 1 : 0;\n }\n\n if (environment[\"COLORTERM\"] === \"truecolor\") {\n return 3;\n }\n\n if (environment[\"TERM\"] === \"xterm-kitty\") {\n return 3;\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 ? 3 : 2;\n }\n\n if (environment[\"TERM_PROGRAM\"] === \"Apple_Terminal\") {\n return 2;\n }\n }\n\n // eslint-disable-next-line regexp/no-unused-capturing-group\n if (/-256(color)?$/i.test(<string>environment[\"TERM\"])) {\n return 2;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access\n const isTTY = isDeno ? _this.Deno.isatty(1) : proc[\"stdout\"] && \"isTTY\" in proc[\"stdout\"];\n\n if (isTTY && /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(<string>environment[\"TERM\"])) {\n return 1;\n }\n\n if (\"COLORTERM\" in environment) {\n return 1;\n }\n\n return minColorLevel;\n};\n\n// eslint-disable-next-line import/no-unused-modules\nexport type { ColorSupportLevel } from \"./types\";\n"]}
@@ -0,0 +1,3 @@
1
+ type ColorSupportLevel = 0 | 1 | 2 | 3;
2
+
3
+ export type { ColorSupportLevel as C };
@@ -0,0 +1,3 @@
1
+ type ColorSupportLevel = 0 | 1 | 2 | 3;
2
+
3
+ export type { ColorSupportLevel as C };
package/package.json ADDED
@@ -0,0 +1,149 @@
1
+ {
2
+ "name": "@visulima/is-ansi-color-supported",
3
+ "version": "1.0.0",
4
+ "description": "Detect whether a terminal or browser supports ansi colors.",
5
+ "keywords": [
6
+ "anolilab",
7
+ "visulima",
8
+ "colorize",
9
+ "ansi",
10
+ "colour",
11
+ "color",
12
+ "colors",
13
+ "styles",
14
+ "terminal",
15
+ "xterm",
16
+ "console",
17
+ "cli",
18
+ "truecolor",
19
+ "FORCE_COLOR",
20
+ "NO_COLOR",
21
+ "ansi-colors",
22
+ "style",
23
+ "tty",
24
+ "256",
25
+ "detect",
26
+ "edge",
27
+ "next.js",
28
+ "nextjs",
29
+ "support",
30
+ "supports",
31
+ "capability",
32
+ "shell",
33
+ "command-line"
34
+ ],
35
+ "homepage": "https://www.visulima.com/docs/package/is-ansi-color-supported",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/visulima/visulima.git",
39
+ "directory": "packages/is-ansi-color-supported"
40
+ },
41
+ "funding": [
42
+ {
43
+ "type": "github",
44
+ "url": "https://github.com/sponsors/prisis"
45
+ },
46
+ {
47
+ "type": "consulting",
48
+ "url": "https://anolilab.com/support"
49
+ }
50
+ ],
51
+ "license": "MIT",
52
+ "author": {
53
+ "name": "Daniel Bannert",
54
+ "email": "d.bannert@anolilab.de"
55
+ },
56
+ "sideEffects": false,
57
+ "type": "module",
58
+ "exports": {
59
+ ".": {
60
+ "browser": "./dist/is-color-supported.browser.js",
61
+ "require": {
62
+ "types": "./dist/is-color-supported.server.d.cts",
63
+ "default": "./dist/is-color-supported.server.cjs"
64
+ },
65
+ "import": {
66
+ "types": "./dist/is-color-supported.server.d.ts",
67
+ "default": "./dist/is-color-supported.server.js"
68
+ }
69
+ },
70
+ "./package.json": "./package.json"
71
+ },
72
+ "main": "dist/is-color-supported.server.cjs",
73
+ "module": "dist/is-color-supported.server.js",
74
+ "browser": "./dist/is-color-supported.browser.js",
75
+ "types": "dist/is-color-supported.server.d.ts",
76
+ "files": [
77
+ "dist/**",
78
+ "README.md",
79
+ "CHANGELOG.md",
80
+ "LICENSE.md"
81
+ ],
82
+ "scripts": {
83
+ "build": "cross-env NODE_ENV=development tsup",
84
+ "build:prod": "cross-env NODE_ENV=production tsup",
85
+ "clean": "rimraf node_modules dist .eslintcache",
86
+ "dev": "pnpm run build --watch",
87
+ "lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
88
+ "lint:eslint:fix": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs --fix",
89
+ "lint:packagejson": "publint --strict",
90
+ "lint:prettier": "prettier --config=.prettierrc.cjs --check .",
91
+ "lint:prettier:fix": "prettier --config=.prettierrc.cjs --write .",
92
+ "lint:types": "tsc --noEmit",
93
+ "test": "vitest run",
94
+ "test:coverage": "vitest run --coverage",
95
+ "test:ui": "vitest --ui --coverage.enabled=true",
96
+ "test:watch": "vitest"
97
+ },
98
+ "devDependencies": {
99
+ "@anolilab/eslint-config": "^15.0.3",
100
+ "@anolilab/prettier-config": "^5.0.14",
101
+ "@anolilab/semantic-release-preset": "^8.0.3",
102
+ "@babel/core": "^7.23.7",
103
+ "@rushstack/eslint-plugin-security": "^0.8.0",
104
+ "@secretlint/secretlint-rule-preset-recommend": "^8.1.0",
105
+ "@types/micromatch": "^4.0.6",
106
+ "@types/node": "18.18.8",
107
+ "@vitest/coverage-v8": "^1.2.1",
108
+ "@vitest/ui": "^1.2.1",
109
+ "cross-env": "^7.0.3",
110
+ "eslint": "^8.56.0",
111
+ "eslint-plugin-deprecation": "^2.0.0",
112
+ "eslint-plugin-etc": "^2.0.3",
113
+ "eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
114
+ "eslint-plugin-mdx": "^3.1.5",
115
+ "eslint-plugin-vitest": "^0.3.20",
116
+ "eslint-plugin-vitest-globals": "^1.4.0",
117
+ "prettier": "^3.2.4",
118
+ "rimraf": "^5.0.5",
119
+ "secretlint": "8.1.0",
120
+ "semantic-release": "^23.0.0",
121
+ "sort-package-json": "^2.6.0",
122
+ "tsup": "^8.0.1",
123
+ "typescript": "^5.3.3",
124
+ "vitest": "^1.2.1"
125
+ },
126
+ "engines": {
127
+ "node": ">=18.* <=21.*"
128
+ },
129
+ "publishConfig": {
130
+ "access": "public",
131
+ "provenance": true
132
+ },
133
+ "anolilab": {
134
+ "eslint-config": {
135
+ "plugin": {
136
+ "tsdoc": false
137
+ },
138
+ "warn_on_unsupported_typescript_version": false,
139
+ "info_on_disabling_jsx_react_rule": false,
140
+ "info_on_disabling_prettier_conflict_rule": false,
141
+ "info_on_disabling_jsonc_sort_keys_rule": false,
142
+ "info_on_disabling_etc_no_deprecated": false
143
+ }
144
+ },
145
+ "sources": [
146
+ "src/is-color-supported.browser.ts",
147
+ "src/is-color-supported.server.ts"
148
+ ]
149
+ }