authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-12-23 14:18:14-08:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-01-14 01:08:15-08:00
logf62bd1c190dd052352816d001adf6cf8c5e274a3
tree1ea2734d0785570ff25c86f13de2f85ce3a300ab
parenta465df835ca978dd2cd1d1ac7c75daf5a49f350a
signature Commit is signed but in an unrecognized format.

chore: random lib tidying


3 files changed, 17 insertions(+), 5 deletions(-)

lib/log.ts+15-2
...@@ -57,7 +57,15 @@ export interface Scope {...@@ -57,7 +57,15 @@ export interface Scope {
57 /**57 /**
58 * emit a debugging message. this method is in place for compatibility with58 * emit a debugging message. this method is in place for compatibility with
59 * the `console` API. prefer calling `.log` directly.59 * the `console` API. prefer calling `.log` directly.
60 * @internal60 * @internalconst hello = Math.random() > 0.5 ? 1 : "meow";
61
62interface Meow {
63 meow: bigint;
64}
65
66const world = hello as Meow;
67
68console.log(world);
61 */69 */
62 debug(...args: unknown[]): void;70 debug(...args: unknown[]): void;
6371
...@@ -441,7 +449,12 @@ const logColors = node.process?.stderr.isTTY ?? false;...@@ -441,7 +449,12 @@ const logColors = node.process?.stderr.isTTY ?? false;
441449
442let formatLine = /* @__PURE__ */ (() => {450let formatLine = /* @__PURE__ */ (() => {
443 const fwo = node.builtin("util")?.formatWithOptions;451 const fwo = node.builtin("util")?.formatWithOptions;
444 if (fwo) return (...args: unknown[]) => fwo({ colors: logColors }, ...args);452 if (fwo) {
453 return (...args: unknown[]) => {
454 if (args[0] instanceof Error) return stack.format(args[0], logColors);
455 return fwo({ colors: logColors }, ...args);
456 };
457 }
445 return (...args: unknown[]) =>458 return (...args: unknown[]) =>
446 args.map((arg) => {459 args.map((arg) => {
447 if (typeof arg === "string") return arg;460 if (typeof arg === "string") return arg;
lib/log/stack.ts-1
...@@ -101,7 +101,6 @@ export function format(error: Error, colors = false): string {...@@ -101,7 +101,6 @@ export function format(error: Error, colors = false): string {
101 )101 )
102 .join("");102 .join("");
103103
104 let frameLines = "[failed to parse stack trace string]";
105 let frames = parse(error) ?? [];104 let frames = parse(error) ?? [];
106 if ("Bun" in globalThis) {105 if ("Bun" in globalThis) {
107 frames = frames.filter((frame) =>106 frames = frames.filter((frame) =>
lib/readme.changes.md+2-2
...@@ -16,8 +16,8 @@...@@ -16,8 +16,8 @@
16- `log` in Node.js will inject into `console.*` to prevent interweaving logs16- `log` in Node.js will inject into `console.*` to prevent interweaving logs
17 with widget output text. this injection is enabled regardless of if widgets17 with widget output text. this injection is enabled regardless of if widgets
18 are actually running, but do not otherwise change their behavior.18 are actually running, but do not otherwise change their behavior.
19- `log` scopes render differently in the terminal now19- `log` scopes render differently in the terminal now.
20- `log` in the browser will call the correct 20- `log` in the browser will call the correct log level function in the browser.
2121
22## v222## v2
2323