colorino 0.7.0 → 0.7.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/dist/browser.cjs
CHANGED
package/dist/browser.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ColorLevel, t as themePalettes, a as Colorino, I as InputValidator, d as determineBaseTheme } from './shared/colorino.
|
|
1
|
+
import { C as ColorLevel, t as themePalettes, a as Colorino, I as InputValidator, d as determineBaseTheme } from './shared/colorino.Dpj0vB0O.mjs';
|
|
2
2
|
|
|
3
3
|
class BrowserColorSupportDetector {
|
|
4
4
|
constructor(_window, _navigator, _overrideTheme) {
|
package/dist/node.cjs
CHANGED
package/dist/node.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as err, O as OscQueryError, o as ok, C as ColorLevel, d as determineBaseTheme, t as themePalettes, a as Colorino, I as InputValidator } from './shared/colorino.
|
|
1
|
+
import { e as err, O as OscQueryError, o as ok, C as ColorLevel, d as determineBaseTheme, t as themePalettes, a as Colorino, I as InputValidator } from './shared/colorino.Dpj0vB0O.mjs';
|
|
2
2
|
|
|
3
3
|
class OscThemeQuerier {
|
|
4
4
|
constructor(_stdin, _stdout, _timeout = 300, _cacheTtl = 36e5) {
|
|
@@ -115,7 +115,7 @@ class Colorino {
|
|
|
115
115
|
"[Colorino] No ANSI color support detected in this terminal. See [https://github.com/chalk/supports-color#support-matrix](https://github.com/chalk/supports-color#support-matrix) to learn how to enable terminal color."
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
_formatValue(value, maxDepth =
|
|
118
|
+
_formatValue(value, maxDepth = 5) {
|
|
119
119
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
120
120
|
const sanitize = (val, currentDepth) => {
|
|
121
121
|
if (val === null || typeof val !== "object") return val;
|
|
@@ -135,12 +135,23 @@ class Colorino {
|
|
|
135
135
|
}
|
|
136
136
|
_out(level, args) {
|
|
137
137
|
const consoleMethod = isConsoleMethod(level) ? level : "log";
|
|
138
|
-
const processedArgs =
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
const processedArgs = [];
|
|
139
|
+
let previousWasObject = false;
|
|
140
|
+
for (const arg of args) {
|
|
141
|
+
const isObject = arg !== null && typeof arg === "object" && typeof arg !== "string" && !(arg instanceof Error);
|
|
142
|
+
if (isObject) {
|
|
143
|
+
processedArgs.push("\n" + this._formatValue(arg));
|
|
144
|
+
previousWasObject = true;
|
|
145
|
+
} else {
|
|
146
|
+
if (typeof arg === "string" && previousWasObject) {
|
|
147
|
+
processedArgs.push(`
|
|
148
|
+
${arg}`);
|
|
149
|
+
} else {
|
|
150
|
+
processedArgs.push(arg);
|
|
151
|
+
}
|
|
152
|
+
previousWasObject = false;
|
|
141
153
|
}
|
|
142
|
-
|
|
143
|
-
});
|
|
154
|
+
}
|
|
144
155
|
if (this._colorLevel === ColorLevel.NO_COLOR || this._colorLevel === "UnknownEnv") {
|
|
145
156
|
if (level === "trace") console.trace(...processedArgs);
|
|
146
157
|
else console[consoleMethod](...processedArgs);
|
|
@@ -113,7 +113,7 @@ class Colorino {
|
|
|
113
113
|
"[Colorino] No ANSI color support detected in this terminal. See [https://github.com/chalk/supports-color#support-matrix](https://github.com/chalk/supports-color#support-matrix) to learn how to enable terminal color."
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
|
-
_formatValue(value, maxDepth =
|
|
116
|
+
_formatValue(value, maxDepth = 5) {
|
|
117
117
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
118
118
|
const sanitize = (val, currentDepth) => {
|
|
119
119
|
if (val === null || typeof val !== "object") return val;
|
|
@@ -133,12 +133,23 @@ class Colorino {
|
|
|
133
133
|
}
|
|
134
134
|
_out(level, args) {
|
|
135
135
|
const consoleMethod = isConsoleMethod(level) ? level : "log";
|
|
136
|
-
const processedArgs =
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
const processedArgs = [];
|
|
137
|
+
let previousWasObject = false;
|
|
138
|
+
for (const arg of args) {
|
|
139
|
+
const isObject = arg !== null && typeof arg === "object" && typeof arg !== "string" && !(arg instanceof Error);
|
|
140
|
+
if (isObject) {
|
|
141
|
+
processedArgs.push("\n" + this._formatValue(arg));
|
|
142
|
+
previousWasObject = true;
|
|
143
|
+
} else {
|
|
144
|
+
if (typeof arg === "string" && previousWasObject) {
|
|
145
|
+
processedArgs.push(`
|
|
146
|
+
${arg}`);
|
|
147
|
+
} else {
|
|
148
|
+
processedArgs.push(arg);
|
|
149
|
+
}
|
|
150
|
+
previousWasObject = false;
|
|
139
151
|
}
|
|
140
|
-
|
|
141
|
-
});
|
|
152
|
+
}
|
|
142
153
|
if (this._colorLevel === ColorLevel.NO_COLOR || this._colorLevel === "UnknownEnv") {
|
|
143
154
|
if (level === "trace") console.trace(...processedArgs);
|
|
144
155
|
else console[consoleMethod](...processedArgs);
|