Parsed stack frames to format.
Output style:
"cli"
– styled for terminal (default)"html"
– safe for rendering into web UIs"json"
– structured JSON"raw"
– concatenated original lines (frame.raw
)A formatted string representing the stack trace.
Terminal styling ("cli"
)
Uses the colorette library to render ANSI styling:
bold(...)
for function namesdim('at')
for the “at” constantyellow(...)
for file namesgray(...)
for line/column position
Colorette is chosen for its speed and zero dependencies—efficient and NO_COLOR friendly.:contentReference[oaicite:1]{index=1}HTML mode ("html"
)
Safely escapes HTML entities and assembles a <pre>
block with semantic <span>
tags (function
, at
, file
, pos
)—great for embedding in browser error overlays or dev UI.
JSON mode ("json"
)
Outputs the full frames array as pretty JSON (null, 2
spacing), ideal for logging or backend ingestion.
Raw mode ("raw"
)
Joins the raw
values of frames, preserving their original formatting without transformation.
Format an array of StackFrame entries into a string based on the desired output mode.