colorino 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.DIwRv0NB.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.DIwRv0NB.mjs';
|
|
2
2
|
|
|
3
3
|
class OscThemeQuerier {
|
|
4
4
|
constructor(_stdin, _stdout, _timeout = 300, _cacheTtl = 36e5) {
|
|
@@ -133,12 +133,27 @@ 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 isFormattableObject = arg !== null && typeof arg === "object" && typeof arg !== "string" && !(arg instanceof Error);
|
|
140
|
+
const isError = arg instanceof Error;
|
|
141
|
+
if (isFormattableObject) {
|
|
142
|
+
processedArgs.push("\n" + this._formatValue(arg));
|
|
143
|
+
previousWasObject = true;
|
|
144
|
+
} else if (isError) {
|
|
145
|
+
processedArgs.push("\n", arg);
|
|
146
|
+
previousWasObject = true;
|
|
147
|
+
} else {
|
|
148
|
+
if (typeof arg === "string" && previousWasObject) {
|
|
149
|
+
processedArgs.push(`
|
|
150
|
+
${arg}`);
|
|
151
|
+
} else {
|
|
152
|
+
processedArgs.push(arg);
|
|
153
|
+
}
|
|
154
|
+
previousWasObject = false;
|
|
139
155
|
}
|
|
140
|
-
|
|
141
|
-
});
|
|
156
|
+
}
|
|
142
157
|
if (this._colorLevel === ColorLevel.NO_COLOR || this._colorLevel === "UnknownEnv") {
|
|
143
158
|
if (level === "trace") console.trace(...processedArgs);
|
|
144
159
|
else console[consoleMethod](...processedArgs);
|
|
@@ -135,12 +135,27 @@ 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 isFormattableObject = arg !== null && typeof arg === "object" && typeof arg !== "string" && !(arg instanceof Error);
|
|
142
|
+
const isError = arg instanceof Error;
|
|
143
|
+
if (isFormattableObject) {
|
|
144
|
+
processedArgs.push("\n" + this._formatValue(arg));
|
|
145
|
+
previousWasObject = true;
|
|
146
|
+
} else if (isError) {
|
|
147
|
+
processedArgs.push("\n", arg);
|
|
148
|
+
previousWasObject = true;
|
|
149
|
+
} else {
|
|
150
|
+
if (typeof arg === "string" && previousWasObject) {
|
|
151
|
+
processedArgs.push(`
|
|
152
|
+
${arg}`);
|
|
153
|
+
} else {
|
|
154
|
+
processedArgs.push(arg);
|
|
155
|
+
}
|
|
156
|
+
previousWasObject = false;
|
|
141
157
|
}
|
|
142
|
-
|
|
143
|
-
});
|
|
158
|
+
}
|
|
144
159
|
if (this._colorLevel === ColorLevel.NO_COLOR || this._colorLevel === "UnknownEnv") {
|
|
145
160
|
if (level === "trace") console.trace(...processedArgs);
|
|
146
161
|
else console[consoleMethod](...processedArgs);
|