formacao
This commit is contained in:
+7
-3
@@ -56,7 +56,11 @@ type Colors = ColorsMethods & {
|
||||
};
|
||||
declare function getDefaultColors(): Colors;
|
||||
declare function isSupported(): boolean;
|
||||
declare function createColors(): Colors;
|
||||
declare const _default: Colors;
|
||||
declare function createColors({ force }?: {
|
||||
force?: boolean;
|
||||
}): Colors;
|
||||
declare const colors: Colors;
|
||||
declare function disableDefaultColors(): void;
|
||||
declare function enabledDefaultColors(): void;
|
||||
|
||||
export { Colors, Formatter, createColors, _default as default, getDefaultColors, isSupported };
|
||||
export { Colors, Formatter, createColors, colors as default, disableDefaultColors, enabledDefaultColors, getDefaultColors, isSupported };
|
||||
|
||||
+47
-38
@@ -1,5 +1,5 @@
|
||||
// src/index.ts
|
||||
var d = {
|
||||
var b = {
|
||||
reset: [0, 0],
|
||||
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
||||
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
||||
@@ -42,54 +42,63 @@ var d = {
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49]
|
||||
};
|
||||
function g(e) {
|
||||
function i(e) {
|
||||
return String(e);
|
||||
}
|
||||
g.open = "";
|
||||
g.close = "";
|
||||
function B() {
|
||||
i.open = "";
|
||||
i.close = "";
|
||||
function p() {
|
||||
let e = {
|
||||
isColorSupported: !1,
|
||||
reset: g
|
||||
reset: i
|
||||
};
|
||||
for (let n in d)
|
||||
e[n] = g;
|
||||
for (let r in b)
|
||||
e[r] = i;
|
||||
return e;
|
||||
}
|
||||
function h() {
|
||||
let e = typeof process != "undefined" ? process : void 0, n = (e == null ? void 0 : e.env) || {}, a = n.FORCE_TTY !== "false", i = (e == null ? void 0 : e.argv) || [];
|
||||
return !("NO_COLOR" in n || i.includes("--no-color")) && ("FORCE_COLOR" in n || i.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && n.TERM !== "dumb" || "CI" in n) || typeof window != "undefined" && !!window.chrome;
|
||||
function B() {
|
||||
let e = typeof process != "undefined" ? process : void 0, r = (e == null ? void 0 : e.env) || {}, a = r.FORCE_TTY !== "false", l = (e == null ? void 0 : e.argv) || [];
|
||||
return !("NO_COLOR" in r || l.includes("--no-color")) && ("FORCE_COLOR" in r || l.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && r.TERM !== "dumb" || "CI" in r) || typeof window != "undefined" && !!window.chrome;
|
||||
}
|
||||
function f() {
|
||||
let e = h(), n = (r, t, u, o) => {
|
||||
let l = "", s = 0;
|
||||
function C({ force: e } = {}) {
|
||||
let r = e || B(), a = (t, o, u, n) => {
|
||||
let g = "", s = 0;
|
||||
do
|
||||
l += r.substring(s, o) + u, s = o + t.length, o = r.indexOf(t, s);
|
||||
while (~o);
|
||||
return l + r.substring(s);
|
||||
}, a = (r, t, u = r) => {
|
||||
let o = (l) => {
|
||||
let s = String(l), b = s.indexOf(t, r.length);
|
||||
return ~b ? r + n(s, t, u, b) + t : r + s + t;
|
||||
g += t.substring(s, n) + u, s = n + o.length, n = t.indexOf(o, s);
|
||||
while (~n);
|
||||
return g + t.substring(s);
|
||||
}, l = (t, o, u = t) => {
|
||||
let n = (g) => {
|
||||
let s = String(g), h = s.indexOf(o, t.length);
|
||||
return ~h ? t + a(s, o, u, h) + o : t + s + o;
|
||||
};
|
||||
return o.open = r, o.close = t, o;
|
||||
}, i = {
|
||||
isColorSupported: e
|
||||
}, c = (r) => `\x1B[${r}m`;
|
||||
for (let r in d) {
|
||||
let t = d[r];
|
||||
i[r] = e ? a(
|
||||
c(t[0]),
|
||||
c(t[1]),
|
||||
t[2]
|
||||
) : g;
|
||||
return n.open = t, n.close = o, n;
|
||||
}, c = {
|
||||
isColorSupported: r
|
||||
}, f = (t) => `\x1B[${t}m`;
|
||||
for (let t in b) {
|
||||
let o = b[t];
|
||||
c[t] = r ? l(
|
||||
f(o[0]),
|
||||
f(o[1]),
|
||||
o[2]
|
||||
) : i;
|
||||
}
|
||||
return i;
|
||||
return c;
|
||||
}
|
||||
var C = f();
|
||||
var d = C();
|
||||
function m() {
|
||||
Object.assign(d, p());
|
||||
}
|
||||
function w() {
|
||||
Object.assign(d, C({ force: !0 }));
|
||||
}
|
||||
var y = d;
|
||||
export {
|
||||
f as createColors,
|
||||
C as default,
|
||||
B as getDefaultColors,
|
||||
h as isSupported
|
||||
C as createColors,
|
||||
y as default,
|
||||
m as disableDefaultColors,
|
||||
w as enabledDefaultColors,
|
||||
p as getDefaultColors,
|
||||
B as isSupported
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tinyrainbow",
|
||||
"version": "3.0.3",
|
||||
"version": "3.1.0",
|
||||
"packageManager": "pnpm@9.15.1",
|
||||
"description": "A small library to print colourful messages.",
|
||||
"type": "module",
|
||||
|
||||
Reference in New Issue
Block a user