/** * Interface for a class that can determine whether a stack frame is interesting to the user or not. * * The input is a formatted stack frame, as produced by `captureCallStack` and * `renderCallStackJustMyCode`. The output is a boolean indicating whether the * frame is user code or not. */ export interface IStackFrameFinder { isInterestingFrame(frame: string): boolean; } /** * Recognize "actual" call frames by them containing ` (` and ending in `)`. * * The `node_modules` frames have already been masked away by * `renderCallStackJustMyCode` during capture. */ export declare const DEFAULT_USER_CODE_FINDER: IStackFrameFinder; export declare class StackTrace { private readonly frames; static fromNewlineSeparatedString(stackTrace: string): StackTrace; constructor(frames: string[]); /** * Return the first user frame from a "Just My Code" call stack * * With all the NON-"my code" call frames redacted, the top level frame should * be the last user frame that is associated with the given call stack. */ findAndParse(finder: IStackFrameFinder): StackFrame | undefined; } export declare class StackFrame { /** * Name of the function this call frame is in */ readonly functionName: string; /** * The file name this call frame is in */ readonly fileName: string; /** * The line and optionally column number this call frame is in * * Formatted as ` [':' ]`. */ readonly sourceLocation: string; /** * Parse a single line of a stack frame into a structured object * * This is mostly a NodeJS-flavored string we parse here, except that in * a NodeJS stack trace the line would start with ` at `. * * Parses all of these: * * ``` * (::) * . (::) * Object. (::) * [as somethingElse] (::) * new (::) * :: * ``` * * See https://v8.dev/docs/stack-trace-api#appendix%3A-stack-trace-format */ static parse(frame: string): StackFrame; constructor( /** * Name of the function this call frame is in */ functionName: string, /** * The file name this call frame is in */ fileName: string, /** * The line and optionally column number this call frame is in * * Formatted as ` [':' ]`. */ sourceLocation: string); }