Files
bare-operating-system/packages/bare-os-seeder/kernel/lib/bare/bundles/bareLogger.js
T
2026-04-04 01:20:57 -04:00

1336 lines
46 KiB
JavaScript

var __bare_os_bundle_exports__ = (() => {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// ../../node_modules/bare-ansi-escapes/index.js
var require_bare_ansi_escapes = __commonJS({
"../../node_modules/bare-ansi-escapes/index.js"(exports) {
var ESC = "\x1B";
var CSI = ESC + "[";
var SGR = (n) => CSI + n + "m";
exports.constants = {
ESC,
CSI,
SGR
};
exports.cursorHide = CSI + "?25l";
exports.cursorShow = CSI + "?25h";
exports.cursorUp = function cursorUp(n = 1) {
return CSI + n + "A";
};
exports.cursorDown = function cursorDown(n = 1) {
return CSI + n + "B";
};
exports.cursorForward = function cursorForward(n = 1) {
return CSI + n + "C";
};
exports.cursorBack = function cursorBack(n = 1) {
return CSI + n + "D";
};
exports.cursorNextLine = function cursorNextLine(n = 1) {
return CSI + n + "E";
};
exports.cursorPreviousLine = function cursorPreviousLine(n = 1) {
return CSI + n + "F";
};
exports.cursorPosition = function cursorPosition(column, row = 0) {
if (row === 0) return CSI + (column + 1) + "G";
return CSI + (row + 1) + ";" + (column + 1) + "H";
};
exports.eraseDisplayEnd = CSI + "J";
exports.eraseDisplayStart = CSI + "1J";
exports.eraseDisplay = CSI + "2J";
exports.eraseLineEnd = CSI + "K";
exports.eraseLineStart = CSI + "1K";
exports.eraseLine = CSI + "2K";
exports.scrollUp = function scrollUp(n = 1) {
return CSI + n + "S";
};
exports.scrollDown = function scrollDown(n = 1) {
return CSI + n + "T";
};
exports.modifierReset = SGR(0);
exports.modifierBold = SGR(1);
exports.modifierDim = SGR(2);
exports.modifierItalic = SGR(3);
exports.modifierUnderline = SGR(4);
exports.modifierNormal = SGR(22);
exports.modifierNotItalic = SGR(23);
exports.modifierNotUnderline = SGR(24);
exports.colorBlack = SGR(30);
exports.colorRed = SGR(31);
exports.colorGreen = SGR(32);
exports.colorYellow = SGR(33);
exports.colorBlue = SGR(34);
exports.colorMagenta = SGR(35);
exports.colorCyan = SGR(36);
exports.colorWhite = SGR(37);
exports.colorDefault = SGR(39);
exports.colorBrightBlack = SGR(90);
exports.colorBrightRed = SGR(91);
exports.colorBrightGreen = SGR(92);
exports.colorBrightYellow = SGR(93);
exports.colorBrightBlue = SGR(94);
exports.colorBrightMagenta = SGR(95);
exports.colorBrightCyan = SGR(96);
exports.colorBrightWhite = SGR(97);
}
});
// ../../node_modules/bare-type/binding.js
var require_binding = __commonJS({
"../../node_modules/bare-type/binding.js"(exports, module) {
module.exports = __require.addon();
}
});
// ../../node_modules/bare-type/index.js
var require_bare_type = __commonJS({
"../../node_modules/bare-type/index.js"(exports, module) {
var binding = require_binding();
var t = binding.constants;
var Type = class {
constructor(type) {
this._type = type;
}
isUndefined() {
return this._type === t.UNDEFINED;
}
isNull() {
return this._type === t.NULL;
}
isBoolean() {
return this._type === t.BOOLEAN;
}
isNumber() {
return (this._type & 255) === t.NUMBER;
}
isInt32() {
return (this._type & (255 | t.INT32)) === (t.NUMBER | t.INT32);
}
isUint32() {
return (this._type & (255 | t.UINT32)) === (t.NUMBER | t.UINT32);
}
isString() {
return this._type === t.STRING;
}
isSymbol() {
return this._type === t.SYMBOL;
}
isObject() {
return (this._type & 255) === t.OBJECT;
}
isArray() {
return this._type === (t.OBJECT | t.ARRAY);
}
isArguments() {
return this._type === (t.OBJECT | t.ARGUMENTS);
}
isDate() {
return this._type === (t.OBJECT | t.DATE);
}
isRegExp() {
return this._type === (t.OBJECT | t.REGEXP);
}
isError() {
return this._type === (t.OBJECT | t.ERROR);
}
isPromise() {
return this._type === (t.OBJECT | t.PROMISE);
}
isProxy() {
return this._type === (t.OBJECT | t.PROXY);
}
isGenerator() {
return this._type === (t.OBJECT | t.GENERATOR);
}
isMap() {
return this._type === (t.OBJECT | t.MAP);
}
isSet() {
return this._type === (t.OBJECT | t.SET);
}
isWeakMap() {
return this._type === (t.OBJECT | t.WEAK_MAP);
}
isWeakSet() {
return this._type === (t.OBJECT | t.WEAK_SET);
}
isWeakRef() {
return this._type === (t.OBJECT | t.WEAK_REF);
}
isArrayBuffer() {
return this._type === (t.OBJECT | t.ARRAYBUFFER);
}
isSharedArrayBuffer() {
return this._type === (t.OBJECT | t.SHAREDARRAYBUFFER);
}
isTypedArray() {
return (this._type & 65535) === (t.OBJECT | t.TYPEDARRAY);
}
isInt8Array() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.INT8ARRAY);
}
isUint8Array() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.UINT8ARRAY);
}
isUint8ClampedArray() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.UINT8CLAMPEDARRAY);
}
isInt16Array() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.INT16ARRAY);
}
isUint16Array() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.UINT16ARRAY);
}
isInt32Array() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.INT32ARRAY);
}
isUint32Array() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.UINT32ARRAY);
}
isFloat16Array() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.FLOAT16ARRAY);
}
isFloat32Array() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.FLOAT32ARRAY);
}
isFloat64Array() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.FLOAT64ARRAY);
}
isBigInt64Array() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.BIGINT64ARRAY);
}
isBigUint64Array() {
return this._type === (t.OBJECT | t.TYPEDARRAY | t.BIGUINT64ARRAY);
}
isDataView() {
return this._type === (t.OBJECT | t.DATAVIEW);
}
isModuleNamespace() {
return this._type === (t.OBJECT | t.MODULE_NAMESPACE);
}
isFunction() {
return (this._type & 255) === t.FUNCTION;
}
isAsyncFunction() {
return (this._type & (255 | t.ASYNC_FUNCTION)) === (t.FUNCTION | t.ASYNC_FUNCTION);
}
isGeneratorFunction() {
return (this._type & (255 | t.GENERATOR_FUNCTION)) === (t.FUNCTION | t.GENERATOR_FUNCTION);
}
isExternal() {
return this._type === t.EXTERNAL;
}
isBigInt() {
return this._type === t.BIGINT;
}
};
module.exports = exports = function type(value) {
switch (typeof value) {
case "undefined":
return new Type(t.UNDEFINED);
case "boolean":
return new Type(t.BOOLEAN);
case "number":
return new Type(
Number.isSafeInteger(value) ? binding.type(value) : t.NUMBER
);
case "string":
return new Type(t.STRING);
case "symbol":
return new Type(t.SYMBOL);
case "object":
return new Type(value === null ? t.NULL : binding.type(value));
case "function":
return new Type(binding.type(value));
case "bigint":
return new Type(t.BIGINT);
}
};
exports.createTag = function createTag(...components) {
const tag = new Uint32Array(4);
for (let i = 0; i < 4; i++) tag[i] = components[i] || 0;
return tag;
};
exports.addTag = function addTag(object, tag) {
binding.addTag(object, tag);
};
exports.checkTag = function checkTag(object, tag) {
return binding.checkTag(object, tag);
};
}
});
// ../../node_modules/bare-inspect/binding.js
var require_binding2 = __commonJS({
"../../node_modules/bare-inspect/binding.js"(exports, module) {
module.exports = __require.addon();
}
});
// ../../node_modules/bare-inspect/index.js
var require_bare_inspect = __commonJS({
"../../node_modules/bare-inspect/index.js"(exports, module) {
var ansiEscapes = require_bare_ansi_escapes();
var getType = require_bare_type();
var binding = require_binding2();
var PLAIN_KEY = /^[a-zA-Z_][a-zA-Z_0-9]*$/;
var defaultDepth = 2;
var defaultBreakLength = 80;
var defaultMaxArrayLength = 40;
module.exports = exports = function inspect(value, opts = {}) {
const {
colors = false,
depth = defaultDepth,
breakLength = defaultBreakLength,
stylize = defaultStylize(colors)
} = opts;
const references = new InspectRefMap();
const tree = inspectValue(value, 0, {
colors,
depth,
breakLength,
stylize,
references
});
return tree.toString();
};
exports.styles = {
bigint: ansiEscapes.colorYellow,
boolean: ansiEscapes.colorYellow,
date: ansiEscapes.colorMagenta,
module: ansiEscapes.modifierUnderline,
name: ansiEscapes.modifierReset,
null: ansiEscapes.modifierBold,
number: ansiEscapes.colorYellow,
regexp: ansiEscapes.colorRed,
special: ansiEscapes.colorCyan,
string: ansiEscapes.colorGreen,
symbol: ansiEscapes.colorGreen,
undefined: ansiEscapes.colorBrightBlack
};
var styles = exports.styles;
function defaultStylize(colors) {
return function stylize(value, style) {
const color = colors && styles[style];
if (color) return color + value + ansiEscapes.modifierReset;
return value;
};
}
var InspectRefMap = class {
constructor() {
this.refs = /* @__PURE__ */ new WeakMap();
this.ids = /* @__PURE__ */ new WeakMap();
this.nextId = 1;
}
has(object) {
return this.refs.has(object);
}
get(object) {
return this.refs.get(object) || null;
}
set(object, ref) {
this.refs.set(object, ref);
}
id(object) {
let id = this.ids.get(object);
if (id) return id;
id = this.nextId++;
this.ids.set(object, id);
return id;
}
};
var InspectNode = class {
constructor(depth, length, opts) {
const { breakLength = defaultBreakLength, breakAlways = false } = opts;
this.depth = depth;
this.length = length;
this.breakLength = breakLength;
this.breakAlways = breakAlways;
}
pad(n, string) {
return string.padStart(n, " ");
}
indent(n, string) {
return " ".repeat(n) + string;
}
};
var InspectRef = class extends InspectNode {
constructor(depth, opts) {
super(depth, "[circular *]".length, opts);
this.refs = opts.references;
this.count = 0;
this.circular = false;
this.color = opts.colors && styles.special;
}
get id() {
return this.refs.id(this);
}
increment() {
return ++this.count;
}
decrement() {
return --this.count;
}
toString(opts = {}) {
const { offset = 0, pad = 0, indent = 0 } = opts;
let value = this.pad(pad, "[circular *" + this.id + "]");
if (this.color) value = this.color + value + ansiEscapes.modifierReset;
return offset ? value : this.indent(indent, value);
}
};
var InspectLeaf = class extends InspectNode {
constructor(value, color, depth, opts) {
const length = value.length;
if (value.includes("\n")) {
value = value.replaceAll("\n", "\n" + " ".repeat(depth));
opts = { ...opts, breakAlways: true };
}
super(depth, length, opts);
this.value = value;
this.color = opts.colors && color;
}
toString(opts = {}) {
const { offset = 0, pad = 0, indent = 0 } = opts;
let value = this.pad(pad, this.value);
if (this.color) value = this.color + value + ansiEscapes.modifierReset;
return offset ? value : this.indent(indent, value);
}
};
var InspectPair = class extends InspectNode {
constructor(delim, left, right, depth, opts) {
const length = left.length + delim.length + right.length;
if (left.breakAlways || right.breakAlways) {
opts = { ...opts, breakAlways: true };
}
super(depth, length, opts);
this.delim = delim;
this.left = left;
this.right = right;
}
toString(opts = {}) {
const { indent = 0 } = opts;
return this.indent(
indent,
this.left + this.delim + this.right.toString({
indent,
offset: this.left.length + this.delim.length
})
);
}
};
var InspectSuspension = class extends InspectNode {
constructor(overflow, depth, opts) {
const label = `... ${overflow} more`;
super(depth, label.length, opts);
this.label = label;
}
toString(opts = {}) {
const { indent = 0 } = opts;
return this.indent(indent, this.label);
}
};
var InspectSequence = class extends InspectNode {
constructor(header, footer, delim, values, ref, depth, opts) {
const { tabulate = false } = opts;
const length = (ref.circular ? "<ref *>".length + 1 : 0) + header.length + values.reduce(
(length2, value, i) => length2 + value.length + (i === 0 ? 0 : delim.length),
0
) + footer.length;
if (values.some((value) => value.breakAlways)) {
opts = { ...opts, breakAlways: true };
}
super(depth, length, opts);
this.header = header;
this.footer = footer;
this.delim = delim;
this.values = values;
this.ref = ref;
this.tabulate = tabulate;
}
toString(opts = {}) {
const { offset = 0, indent = 0 } = opts;
const split = this.breakAlways || this.values.length && (offset + this.length > this.breakLength || indent * 2 + this.length > this.breakLength);
let header = this.header;
if (this.ref.circular) {
header = "<ref *" + this.ref.id + "> " + header;
}
if (this.values.length === 0) {
header = header.trimEnd();
}
if (offset === 0) {
header = this.indent(indent, header);
}
if (split) {
header = header.trimEnd() + "\n";
}
let string = header;
let columns = 1;
let pad = 0;
if (this.tabulate) {
const widest = this.values.reduce(
(length, value) => value.breakAlways ? length : Math.max(length, value.length),
0
);
if (widest) {
columns = Math.max(
columns,
Math.floor(
(this.breakLength - indent * 2) / (widest + this.delim.length)
)
);
if (columns > 1) pad = widest;
}
}
for (let i = 0, n = this.values.length, offset2 = 0; i < n; i++) {
const value = this.values[i];
if (split) {
let part;
if (i % columns === 0 || value.breakAlways) {
part = value.toString({ indent: indent + 1, pad });
} else {
part = value.toString({ pad });
}
string += part;
if (i < n - 1) {
if (i % columns === columns - 1 || this.values[i + 1].breakAlways) {
string += this.delim.trimEnd() + "\n";
} else {
string += this.delim;
}
}
} else {
if (i > 0) string += this.delim;
string += value.toString({ offset: offset2 });
offset2 += value.length;
}
}
let footer = this.footer;
if (this.values.length === 0) {
footer = footer.trimStart();
}
if (split) {
string += "\n" + this.indent(indent, footer.trimStart());
} else {
string += footer;
}
return string;
}
};
function inspectValue(value, depth, opts) {
const type = getType(value);
if (type.isUndefined()) return inspectUndefined(depth, opts);
if (type.isNull()) return inspectNull(depth, opts);
if (type.isBoolean()) return inspectBoolean(value, depth, opts);
if (type.isNumber()) return inspectNumber(value, depth, opts);
if (type.isBigInt()) return inspectBigInt(value, depth, opts);
if (type.isString()) return inspectString(value, depth, opts);
if (type.isSymbol()) return inspectSymbol(value, depth, opts);
if (type.isObject()) return inspectObject(type, value, depth, opts);
if (type.isFunction()) return inspectFunction(type, value, depth, opts);
if (type.isExternal()) return inspectExternal(value, opts, opts);
}
function inspectUndefined(depth, opts) {
return new InspectLeaf("undefined", styles.undefined, depth, opts);
}
function inspectNull(depth, opts) {
return new InspectLeaf("null", styles.null, depth, opts);
}
function inspectBoolean(value, depth, opts) {
return new InspectLeaf(value.toString(), styles.boolean, depth, opts);
}
function inspectNumber(value, depth, opts) {
let string;
if (Object.is(value, -0)) {
string = "-0";
} else {
string = value.toString(10);
}
return new InspectLeaf(string, styles.number, depth, opts);
}
function inspectBigInt(value, depth, opts) {
return new InspectLeaf(value.toString(10) + "n", styles.bigint, depth, opts);
}
var STRING_ESCAPES = /[\ud800-\udbff][\udc00-\udfff]|[\u0000-\u001f'\\\ud800-\udfff]/g;
function inspectString(value, depth, opts) {
const string = value.replace(STRING_ESCAPES, (match) => {
if (match.length === 2) return match;
switch (match) {
case "'":
return "\\'";
case "\\":
return "\\\\";
case "\b":
return "\\b";
case " ":
return "\\t";
case "\n":
return "\\n";
case "\f":
return "\\f";
case "\r":
return "\\r";
default:
return "\\u" + match.charCodeAt(0).toString(16).padStart(4, "0");
}
});
return new InspectLeaf("'" + string + "'", styles.string, depth, opts);
}
function inspectSymbol(value, depth, opts) {
return new InspectLeaf(value.toString(), styles.symbol, depth, opts);
}
function inspectKey(value, depth, opts) {
if (PLAIN_KEY.test(value)) {
return new InspectLeaf(value, null, depth, opts);
} else {
return inspectValue(value, depth, opts);
}
}
function inspectObject(type, object, depth, opts) {
const refs = opts.references;
let ref = refs.get(object);
if (ref === null) {
ref = new InspectRef(depth, opts);
refs.set(object, ref);
} else if (ref.count) {
ref.circular = true;
return ref;
}
const maxDepth = typeof opts.depth === "number" ? opts.depth : Infinity;
if (maxDepth < depth) {
const constructor = object.constructor;
return new InspectLeaf(
"[" + (constructor && constructor.name ? constructor.name : "Object") + "]",
styles.special,
depth,
opts
);
}
const inspect = object[Symbol.for("bare.inspect")] || object[Symbol.for("nodejs.util.inspect.custom")];
if (typeof inspect === "function") {
const value = inspect.call(
object,
typeof opts.depth === "number" ? opts.depth - depth : null,
{
colors: opts.colors,
breakLength: opts.breakLength,
stylize: opts.stylize
},
exports
);
if (typeof value === "object" && value !== null) {
refs.set(value, ref);
}
if (typeof value !== "string") {
return inspectValue(value, depth, opts);
}
return new InspectLeaf(value, null, depth, opts);
}
if (type.isArray()) return inspectArray(object, ref, depth, opts);
if (type.isDate()) return inspectDate(object, ref, depth, opts);
if (type.isRegExp()) return inspectRegExp(object, ref, depth, opts);
if (type.isError()) return inspectError(object, ref, depth, opts);
if (type.isPromise()) return inspectPromise(object, ref, depth, opts);
if (type.isMap()) return inspectMap(object, ref, depth, opts);
if (type.isSet()) return inspectSet(object, ref, depth, opts);
if (type.isWeakMap()) return inspectWeakMap(object, ref, depth, opts);
if (type.isWeakSet()) return inspectWeakSet(object, ref, depth, opts);
if (type.isWeakRef()) return inspectWeakRef(object, ref, depth, opts);
if (type.isArrayBuffer()) return inspectArrayBuffer(object, ref, depth, opts);
if (type.isSharedArrayBuffer())
return inspectSharedArrayBuffer(object, ref, depth, opts);
if (type.isTypedArray()) return inspectTypedArray(object, ref, depth, opts);
if (type.isDataView()) return inspectDataView(object, ref, depth, opts);
ref.increment();
const values = [];
for (const key in object) {
if (key === "constructor") continue;
values.push(
new InspectPair(
": ",
inspectKey(key, depth + 1, opts),
inspectValue(object[key], depth + 1, opts),
depth + 1,
opts
)
);
}
ref.decrement();
let header = "{ ";
const tag = object[Symbol.toStringTag];
if (tag) header = "[" + tag + "] " + header;
if (object.constructor) {
const name = object.constructor.name;
if (name && name !== "Object") {
header = object.constructor.name + " " + header;
}
}
return new InspectSequence(header, " }", ", ", values, ref, depth, opts);
}
function inspectArray(array, ref, depth, opts) {
const { maxArrayLength = defaultMaxArrayLength } = opts;
ref.increment();
const values = [];
let remaining = Math.max(maxArrayLength, 0);
for (let i = 0, n = array.length; i < n; i++) {
if (remaining-- === 0) {
values.push(
new InspectSuspension(array.length - values.length, depth + 1, {
...opts,
breakAlways: true
})
);
break;
}
values.push(inspectValue(array[i], depth + 1, opts));
}
for (const key of binding.getOwnNonIndexPropertyNames(array)) {
values.push(
new InspectPair(
": ",
inspectKey(key, depth + 1, opts),
inspectValue(array[key], depth + 1, opts),
depth + 1,
{ ...opts, breakAlways: remaining < 0 }
)
);
}
ref.decrement();
let header = "[ ";
if (array.constructor.name !== "Array") {
header = array.constructor.name + "(" + array.length + ") " + header;
}
return new InspectSequence(header, " ]", ", ", values, ref, depth, {
...opts,
tabulate: true
});
}
function inspectDate(date, ref, depth, opts) {
return new InspectLeaf(date.toISOString(), styles.date, depth, opts);
}
function inspectRegExp(regExp, ref, depth, opts) {
return new InspectLeaf(regExp.toString(), styles.regexp, depth, opts);
}
function inspectError(error, ref, depth, opts) {
let header;
if ("stack" in error) {
header = error.stack;
if (depth > 0) {
header = header.replaceAll("\n", "\n" + " ".repeat(depth));
}
} else {
header = error.toString();
}
const builtins = ["cause"];
if (error.name === "AggregateError") {
builtins.push("errors");
} else if (error.name === "SuppressedError") {
builtins.push("error", "suppressed");
}
const values = [];
for (const key of builtins) {
if (key in error === false) continue;
values.push(
new InspectPair(
": ",
new InspectLeaf("[" + key + "]", null, depth + 1, opts),
inspectValue(error[key], depth + 1, opts),
depth + 1,
opts
)
);
}
for (const key in error) {
if (key === "constructor" || builtins.includes(key)) continue;
values.push(
new InspectPair(
": ",
inspectKey(key, depth + 1, opts),
inspectValue(error[key], depth + 1, opts),
depth + 1,
opts
)
);
}
if (values.length === 0) return new InspectLeaf(header, null, depth, opts);
return new InspectSequence(
header + " {",
" }",
", ",
values,
ref,
depth,
opts
);
}
function inspectPromise(promise, ref, depth, opts) {
ref.increment();
const state = binding.getPromiseState(promise);
const values = [];
switch (state) {
case 0:
values.push(new InspectLeaf("<pending>", styles.special, depth, opts));
break;
case 1:
values.push(inspectValue(binding.getPromiseResult(promise), depth, opts));
break;
case 2:
values.push(
new InspectLeaf("<rejected>", styles.special, depth, opts),
inspectValue(binding.getPromiseResult(promise), depth, opts)
);
}
ref.decrement();
const header = promise.constructor.name + " { ";
return new InspectSequence(header, " }", " ", values, ref, depth, opts);
}
function inspectMap(map, ref, depth, opts) {
const {
maxArrayLength = defaultMaxArrayLength,
maxMapLength = maxArrayLength
} = opts;
ref.increment();
const values = [];
let remaining = maxMapLength;
for (const entry of map) {
if (remaining-- === 0) {
values.push(
new InspectSuspension(map.size - values.length, depth + 1, {
...opts,
breakAlways: true
})
);
break;
}
values.push(
new InspectPair(
" => ",
inspectValue(entry[0], depth + 1, opts),
inspectValue(entry[1], depth + 1, opts),
depth + 1,
opts
)
);
}
for (const key in map) {
if (key === "constructor") continue;
const value = inspectValue(map[key], depth + 1, opts);
values.push(
new InspectPair(
": ",
inspectKey(key, depth + 1, opts),
value,
depth + 1,
{ ...opts, breakAlways: remaining < 0 }
)
);
}
ref.decrement();
const header = map.constructor.name + "(" + map.size + ") { ";
return new InspectSequence(header, " }", ", ", values, ref, depth, {
...opts,
tabulate: true
});
}
function inspectSet(set, ref, depth, opts) {
const {
maxArrayLength = defaultMaxArrayLength,
maxSetLength = maxArrayLength
} = opts;
ref.increment();
const values = [];
let remaining = maxSetLength;
for (const entry of set) {
if (remaining-- === 0) {
values.push(
new InspectSuspension(set.size - values.length, depth + 1, {
...opts,
breakAlways: true
})
);
break;
}
values.push(inspectValue(entry, depth + 1, opts));
}
for (const key in set) {
if (key === "constructor") continue;
const value = inspectValue(set[key], depth + 1, opts);
values.push(
new InspectPair(
": ",
inspectKey(key, depth + 1, opts),
value,
depth + 1,
{ ...opts, breakAlways: remaining < 0 }
)
);
}
ref.decrement();
const header = set.constructor.name + "(" + set.size + ") { ";
return new InspectSequence(header, " }", ", ", values, ref, depth, {
...opts,
tabulate: true
});
}
function inspectWeakMap(weakMap, ref, depth, opts) {
const header = weakMap.constructor.name + " { ";
return new InspectSequence(
header,
" }",
" ",
[new InspectLeaf("<items unknown>", styles.special, depth + 1, opts)],
ref,
depth,
opts
);
}
function inspectWeakSet(weakSet, ref, depth, opts) {
const header = weakSet.constructor.name + " { ";
return new InspectSequence(
header,
" }",
" ",
[new InspectLeaf("<items unknown>", styles.special, depth + 1, opts)],
ref,
depth,
opts
);
}
function inspectWeakRef(weakRef, ref, depth, opts) {
const target = weakRef.deref();
let value;
if (target === void 0) {
value = new InspectLeaf("<cleared>", styles.special, depth + 1, opts);
} else {
value = inspectValue(target, depth + 1, opts);
}
const header = weakRef.constructor.name + " { ";
return new InspectSequence(header, " }", " ", [value], ref, depth, opts);
}
function inspectArrayBuffer(arrayBuffer, ref, depth, opts) {
ref.increment();
const values = [];
for (const key of ["byteLength"]) {
values.push(
new InspectPair(
": ",
inspectKey(key, depth + 1, opts),
inspectValue(arrayBuffer[key], depth + 1, opts),
depth + 1,
opts
)
);
}
ref.decrement();
const header = arrayBuffer.constructor.name + " { ";
return new InspectSequence(header, " }", ", ", values, ref, depth, opts);
}
function inspectSharedArrayBuffer(sharedArrayBuffer, ref, depth, opts) {
ref.increment();
const values = [];
for (const key of ["byteLength"]) {
values.push(
new InspectPair(
": ",
inspectKey(key, depth + 1, opts),
inspectValue(sharedArrayBuffer[key], depth + 1, opts),
depth + 1,
opts
)
);
}
ref.decrement();
const header = sharedArrayBuffer.constructor.name + " { ";
return new InspectSequence(header, " }", ", ", values, ref, depth, opts);
}
function inspectTypedArray(typedArray, ref, depth, opts) {
if (Buffer.isBuffer(typedArray)) {
return inspectBuffer(typedArray, ref, depth, opts);
}
const {
maxArrayLength = defaultMaxArrayLength,
maxTypedArrayLength = maxArrayLength
} = opts;
ref.increment();
const values = [];
let remaining = Math.max(maxTypedArrayLength, 0);
for (let i = 0, n = typedArray.length; i < n; i++) {
if (remaining-- === 0) {
values.push(
new InspectSuspension(typedArray.length - values.length, depth + 1, {
...opts,
breakAlways: true
})
);
break;
}
values.push(inspectValue(typedArray[i], depth + 1, opts));
}
for (const key of binding.getOwnNonIndexPropertyNames(typedArray)) {
values.push(
new InspectPair(
": ",
inspectKey(key, depth + 1, opts),
inspectValue(typedArray[key], depth + 1, opts),
depth + 1,
{ ...opts, breakAlways: remaining < 0 }
)
);
}
ref.decrement();
const header = typedArray.constructor.name + "(" + typedArray.length + ") [ ";
return new InspectSequence(header, " ]", ", ", values, ref, depth, {
...opts,
tabulate: true
});
}
function inspectBuffer(buffer, ref, depth, opts) {
const {
maxArrayLength = defaultMaxArrayLength,
maxBufferLength = maxArrayLength
} = opts;
ref.increment();
const values = [];
let remaining = Math.max(maxBufferLength, 0);
for (let i = 0, n = buffer.byteLength; i < n; i++) {
if (remaining-- === 0) {
values.push(
new InspectSuspension(buffer.length - values.length, depth + 1, {
...opts,
breakAlways: true
})
);
break;
}
values.push(
new InspectLeaf(
buffer[i].toString(16).padStart(2, "0"),
null,
depth + 1,
opts
)
);
}
for (const key of binding.getOwnNonIndexPropertyNames(buffer)) {
values.push(
new InspectPair(
": ",
inspectKey(key, depth + 1, opts),
inspectValue(buffer[key], depth + 1, opts),
depth + 1,
{ ...opts, breakAlways: remaining < 0 }
)
);
}
ref.decrement();
return new InspectSequence("<Buffer ", ">", " ", values, ref, depth, {
...opts,
tabulate: true
});
}
function inspectDataView(dataView, ref, depth, opts) {
ref.increment();
const values = [];
for (const key of ["byteLength", "byteOffset", "buffer"]) {
values.push(
new InspectPair(
": ",
inspectKey(key, depth + 1, opts),
inspectValue(dataView[key], depth + 1, opts),
depth + 1,
opts
)
);
}
for (const key of binding.getOwnNonIndexPropertyNames(dataView)) {
values.push(
new InspectPair(
": ",
inspectKey(key, depth + 1, opts),
inspectValue(dataView[key], depth + 1, opts),
depth + 1,
opts
)
);
}
ref.decrement();
const header = dataView.constructor.name + " { ";
return new InspectSequence(header, " }", ", ", values, ref, depth, opts);
}
function inspectFunction(type, fn, depth, opts) {
if (fn.toString().startsWith("class")) return inspectClass(fn, depth, opts);
let tag = "function";
if (type.isGeneratorFunction()) tag = "generator " + tag;
if (type.isAsyncFunction()) tag = "async " + tag;
return new InspectLeaf(
"[" + tag + " " + (fn.name ? fn.name : "(anonymous)") + "]",
styles.special,
depth,
opts
);
}
function inspectClass(ctor, depth, opts) {
return new InspectLeaf(
"[class " + (ctor.name ? ctor.name : "(anonymous)") + "]",
styles.special,
depth,
opts
);
}
function inspectExternal(external, depth, opts) {
return new InspectLeaf(
"[external 0x" + binding.getExternal(external).toString(16) + "]",
styles.special,
depth,
opts
);
}
}
});
// ../../node_modules/bare-format/index.js
var require_bare_format = __commonJS({
"../../node_modules/bare-format/index.js"(exports, module) {
var inspect = require_bare_inspect();
module.exports = exports = function format(...args) {
return exports.formatWithOptions({}, ...args);
};
exports.format = exports;
exports.formatWithOptions = function formatWithOptions(opts, ...args) {
const format = args[0];
let result = "";
let join = "";
let i = 0;
if (typeof format === "string") {
if (args.length === 1) return format;
let tmp;
let j = 0;
let c;
for (let k = 0, n = format.length; k < n; k++) {
c = format.charCodeAt(k);
if (c === 37) {
c = format.charCodeAt(++k);
if (i < args.length) {
switch (c) {
case 115: {
const value = args[++i];
switch (typeof value) {
case "string":
tmp = value;
break;
case "bigint":
tmp = inspect(value, { ...opts, colors: false });
break;
default:
tmp = String(value);
break;
}
break;
}
case 100: {
const value = args[++i];
switch (typeof value) {
case "symbol":
tmp = NaN;
break;
case "bigint":
tmp = inspect(value, { ...opts, colors: false });
break;
default:
tmp = inspect(Number(value), { ...opts, colors: false });
break;
}
break;
}
case 105: {
const value = args[++i];
switch (typeof value) {
case "symbol":
tmp = NaN;
break;
case "bigint":
tmp = inspect(value, { ...opts, colors: false });
break;
default:
tmp = inspect(parseInt(value, 10), { ...opts, colors: false });
break;
}
break;
}
case 102: {
const value = args[++i];
switch (typeof value) {
case "symbol":
tmp = NaN;
break;
default:
tmp = inspect(parseFloat(value), { ...opts, colors: false });
break;
}
break;
}
case 79:
case 111:
tmp = inspect(args[++i], opts);
break;
case 106:
tmp = JSON.stringify(args[++i]);
break;
case 99:
i++;
tmp = "";
break;
case 37:
result += format.substring(j, k);
j = k + 1;
continue;
default:
continue;
}
if (j !== k - 1) result += format.substring(j, k - 1);
result += tmp;
j = k + 1;
} else if (c === 37) {
result += format.substring(j, k);
j = k + 1;
}
}
}
if (j !== 0) {
i++;
join = " ";
if (j < format.length) {
result += format.substring(j);
}
}
}
while (i < args.length) {
const value = args[i++];
result += join;
result += typeof value === "string" ? value : inspect(value, opts);
join = " ";
}
return result;
};
}
});
// ../../node_modules/bare-logger/binding.js
var require_binding3 = __commonJS({
"../../node_modules/bare-logger/binding.js"(exports, module) {
module.exports = __require.addon();
}
});
// ../../node_modules/bare-logger/index.js
var require_bare_logger = __commonJS({
"../../node_modules/bare-logger/index.js"(exports, module) {
var { formatWithOptions } = require_bare_format();
var binding = require_binding3();
module.exports = exports = class Log {
constructor(opts = {}) {
const { colors = binding.isTTY } = opts;
this._colors = colors;
}
get colors() {
return this._colors;
}
format(...data) {
return format(data, this.colors);
}
debug(...data) {
binding.debug(this.format(...data));
}
info(...data) {
binding.info(this.format(...data));
}
warn(...data) {
binding.warn(this.format(...data));
}
error(...data) {
binding.error(this.format(...data));
}
fatal(...data) {
binding.fatal(this.format(...data));
}
clear() {
}
};
var Log = exports;
exports.Log = Log;
exports.CompositeLog = class CompositeLog extends Log {
constructor(logs) {
super();
this._logs = Array.from(logs);
}
debug(...data) {
for (const log of this._logs) log.debug(...data);
}
info(...data) {
for (const log of this._logs) log.info(...data);
}
warn(...data) {
for (const log of this._logs) log.warn(...data);
}
error(...data) {
for (const log of this._logs) log.error(...data);
}
fatal(...data) {
for (const log of this._logs) log.fatal(...data);
}
clear() {
for (const log of this._logs) log.clear();
}
};
function format(data, colors) {
return formatWithOptions({ colors }, ...data).replace(/\u0000/g, "");
}
}
});
// ../../bare-lib-entry-bareLogger.js
var bare_lib_entry_bareLogger_exports = {};
__export(bare_lib_entry_bareLogger_exports, {
default: () => bare_lib_entry_bareLogger_default
});
var import_bare_logger = __toESM(require_bare_logger());
var bare_lib_entry_bareLogger_default = import_bare_logger.default;
return __toCommonJS(bare_lib_entry_bareLogger_exports);
})();
;(function(){var g=globalThis;var s="__bare_os_stdlib__";g[s]=g[s]||{};var e=typeof __bare_os_bundle_exports__!=="undefined"?__bare_os_bundle_exports__:void 0;var v=e!=null&&typeof e==="object"&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;g[s]["bareLogger"]=v;})();