Angular Modernizer
    Preparing search index...

    Parses Node.js/Angular/Zone.js/browser stack traces into structured frames. Maps the frames to project source files.

    Frames are classified as project files when their resolved path starts with projectRoot and does not pass through node_modules. With a StackFrameFileIndex, browser and source-map frames are mapped onto project files as well: URL paths (http://host/src/app/x.ts, webpack:///./src/..., ng:///...) are checked against projectRoot, and a bare file name (x.component.ts) resolves through a unique basename. An ambiguous basename stays external and lists its candidates. Without an index, URL frames stay external.

    const parser = new StackTraceParser('/my/project/src');
    const frames = parser.parse(error.stack ?? '');
    // frames[0].file -> '/my/project/src/app/user.service.ts'
    // frames[0].isProjectFile -> true

    const projectOnly = parser.parseProjectFrames(error.stack ?? '');
    Index

    Constructors

    • Parameters

      • projectRoot: string

        Absolute path to the project root used to classify frames as project files vs. external dependencies.

      • Optionalfiles: StackFrameFileIndex

        Optional file lookups; enables URL and basename resolution.

      Returns StackTraceParser

    Methods

    • Parses a raw stack trace string into an array of structured frames.

      Parameters

      • stackTrace: string

        Raw Error.stack string or console-captured stack trace.

      Returns StackFrame[]

      All frames found, including non-project frames.

    • Parses a stack trace and returns only frames that belong to the project.

      Parameters

      • stackTrace: string

        Raw Error.stack string or console-captured stack trace.

      Returns StackFrame[]

      Frames where isProjectFile is true.