@orkestrel/console 0.0.13 → 0.0.14
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/src/core/index.cjs +6 -6
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.js +6 -6
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +8 -7
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.js +8 -7
- package/dist/src/server/index.js.map +1 -1
- package/package.json +11 -11
package/dist/src/core/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { isArray, isError, isFunction, isInstance, isObject } from "@orkestrel/contract";
|
|
1
2
|
import { Emitter } from "@orkestrel/emitter";
|
|
2
|
-
import { isArray } from "@orkestrel/contract";
|
|
3
3
|
//#region src/core/constants.ts
|
|
4
4
|
/**
|
|
5
5
|
* Maps each {@link Color} to its SGR foreground parameter — the 8 base colors at 30–37 and their
|
|
@@ -520,7 +520,7 @@ var ConsoleError = class extends Error {
|
|
|
520
520
|
* ```
|
|
521
521
|
*/
|
|
522
522
|
function isConsoleError(value) {
|
|
523
|
-
return value
|
|
523
|
+
return isInstance(value, ConsoleError);
|
|
524
524
|
}
|
|
525
525
|
//#endregion
|
|
526
526
|
//#region src/core/helpers.ts
|
|
@@ -1049,12 +1049,12 @@ function renderTreeChildren(nodes, prefix, options) {
|
|
|
1049
1049
|
* ```
|
|
1050
1050
|
*/
|
|
1051
1051
|
function stringifyValue(value) {
|
|
1052
|
-
if (value
|
|
1053
|
-
if (value
|
|
1052
|
+
if (isError(value)) return `${value.name}: ${value.message}`;
|
|
1053
|
+
if (!isObject(value)) return String(value);
|
|
1054
1054
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
1055
1055
|
try {
|
|
1056
1056
|
return JSON.stringify(value, (_key, nested) => {
|
|
1057
|
-
if (nested
|
|
1057
|
+
if (isObject(nested)) {
|
|
1058
1058
|
if (seen.has(nested)) return "[Circular]";
|
|
1059
1059
|
seen.add(nested);
|
|
1060
1060
|
}
|
|
@@ -1462,7 +1462,7 @@ var Styler = class Styler {
|
|
|
1462
1462
|
return this.#attribute(attribute).surface;
|
|
1463
1463
|
}
|
|
1464
1464
|
#isSurface(value) {
|
|
1465
|
-
return
|
|
1465
|
+
return isFunction(value) && "style" in value && "enabled" in value && "render" in value && "red" in value && "bold" in value;
|
|
1466
1466
|
}
|
|
1467
1467
|
#foreground(color) {
|
|
1468
1468
|
return new Styler(this.#renderer, this.#enabled, Object.freeze({
|