java.lang.Object
org.htmlunit.corejs.javascript.sourcemap.SourceMapV3
All Implemented Interfaces:
SourceMapper

public final class SourceMapV3 extends Object implements SourceMapper
A SourceMapper backed by a parsed ECMA-426 plain source map. Indexed (sectioned) source maps are not supported; calling parse(java.lang.String) on those will throw SourceMapException.
  • Method Details

    • parse

      public static SourceMapV3 parse(String json)
    • parse

      public static SourceMapV3 parse(Reader reader) throws IOException
      Throws:
      IOException
    • parseFile

      public static SourceMapV3 parseFile(Path path) throws IOException
      Throws:
      IOException
    • mapPosition

      public Position mapPosition(int targetLine, int targetColumn)
      Description copied from interface: SourceMapper
      Maps a target (line, column) position to the corresponding original-source position.
      Specified by:
      mapPosition in interface SourceMapper
      Parameters:
      targetLine - 1-indexed line in the transpiled source
      targetColumn - 1-indexed column in the transpiled source
      Returns:
      the original-source position, or null if no mapping exists for this position
    • getMappedName

      public String getMappedName(int targetLine, int targetColumn)
      Returns the original name for the symbol at the given target position, or null if the segment has no name or the position is unmapped.
      Parameters:
      targetLine - 1-indexed line in the transpiled source
      targetColumn - 1-indexed column in the transpiled source
    • getSourceLineText

      public String getSourceLineText(String sourcePath, int lineNumber)
      Description copied from interface: SourceMapper
      Returns the text of the given line within the named original source file. Used to populate parser error messages with the offending line from the original source.
      Specified by:
      getSourceLineText in interface SourceMapper
      Parameters:
      sourcePath - the resolved source path (as returned in Position.getSourcePath())
      lineNumber - 1-indexed line number in the original source
      Returns:
      the line text, or null if the source is unknown, the line is out of range, or no original-source content is available
    • getPrimarySourceContent

      public String getPrimarySourceContent()
      Description copied from interface: SourceMapper
      Returns the full text of the primary original source so the debugger can display it during compilation handoff. When the underlying source map references multiple sources, an implementation must pick one (typically the first) — this method does not enumerate them.
      Specified by:
      getPrimarySourceContent in interface SourceMapper
      Returns:
      the primary original source content, or null if it is not available
    • sources

      public List<String> sources()
    • ignoreList

      public List<String> ignoreList()
    • file

      public String file()