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
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const determineBaseTheme = require('./shared/colorino.DZFkhcaF.cjs');
3
+ const determineBaseTheme = require('./shared/colorino.DLomX7A5.cjs');
4
4
 
5
5
  class BrowserColorSupportDetector {
6
6
  constructor(_window, _navigator, _overrideTheme) {
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.Irp6M1AW.mjs';
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
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const determineBaseTheme = require('./shared/colorino.DZFkhcaF.cjs');
3
+ const determineBaseTheme = require('./shared/colorino.DLomX7A5.cjs');
4
4
 
5
5
  class OscThemeQuerier {
6
6
  constructor(_stdin, _stdout, _timeout = 300, _cacheTtl = 36e5) {
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.Irp6M1AW.mjs';
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 = 3) {
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 = args.map((arg) => {
139
- if (arg !== null && typeof arg === "object" && typeof arg !== "string" && !(arg instanceof Error)) {
140
- return this._formatValue(arg);
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
- return arg;
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 = 3) {
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 = args.map((arg) => {
137
- if (arg !== null && typeof arg === "object" && typeof arg !== "string" && !(arg instanceof Error)) {
138
- return this._formatValue(arg);
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
- return arg;
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "colorino",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "A super simple colorized logger that gets the most out of your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",