JSPM

stack-frame-utils

0.4.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 33
  • Score
    100M100P100Q62366F
  • License MIT

Utilities for working with stack frames.

Package Exports

  • stack-frame-utils
  • stack-frame-utils/lib/getSourceMap

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stack-frame-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

stack-frame-utils

Utilities for working with stack frames.

API

getLinesAround

Parameters

  • line number The line number to provide context around.
  • count number The number of lines you'd like for context.
  • lines (Array<string> | string) The source code.

Returns Array<ScriptLine>

SourceMap

A wrapped instance of a SourceMapConsumer.

This exposes methods which will be indifferent to changes made in source-map.

getOriginalPosition

Returns the original code position for a generated code position.

Parameters

  • line number The line of the generated code position.
  • column number The column of the generated code position.

Returns {source: string, line: number, column: number}

getGeneratedPosition

Returns the generated code position for an original position.

Parameters

  • source string The source file of the original code position.
  • line number The line of the original code position.
  • column number The column of the original code position.

Returns {line: number, column: number}

getSource

Returns the code for a given source file name.

Parameters

  • sourceName string The name of the source file.

Returns string

getSourceMap

Returns an instance of SourceMap for a given fileUri and fileContents.

Parameters

  • fileUri string The URI of the source file.
  • fileContents string The contents of the source file.

Returns Promise<SourceMap>