mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Fix double quotes in console.log messages
This commit is contained in:
@@ -965,8 +965,7 @@ export class DebugAdapter implements IDebugAdapter, InspectorListener {
|
||||
const variables = parameters.map((parameter, i) => {
|
||||
const variable = this.#addVariable(parameter, { name: `${i}` });
|
||||
|
||||
const { value } = variable;
|
||||
output += value + " ";
|
||||
output += remoteObjectToString(parameter, true) + " ";
|
||||
|
||||
return variable;
|
||||
});
|
||||
@@ -1704,8 +1703,6 @@ function consoleLevelToAnsiColor(level: JSC.Console.ConsoleMessage["level"]): st
|
||||
return "\u001b[33m";
|
||||
case "error":
|
||||
return "\u001b[31m";
|
||||
case "debug":
|
||||
return "\u001b[36m";
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { JSC } from "../protocol";
|
||||
|
||||
export function remoteObjectToString(remoteObject: JSC.Runtime.RemoteObject): string {
|
||||
export function remoteObjectToString(remoteObject: JSC.Runtime.RemoteObject, topLevel?: boolean): string {
|
||||
const { type, subtype, value, description, className, preview } = remoteObject;
|
||||
switch (type) {
|
||||
case "undefined":
|
||||
@@ -9,6 +9,9 @@ export function remoteObjectToString(remoteObject: JSC.Runtime.RemoteObject): st
|
||||
case "number":
|
||||
return description ?? JSON.stringify(value);
|
||||
case "string":
|
||||
if (topLevel) {
|
||||
return String(value ?? description);
|
||||
}
|
||||
return JSON.stringify(value ?? description);
|
||||
case "symbol":
|
||||
case "bigint":
|
||||
|
||||
Reference in New Issue
Block a user