Class SourceMapWriter

java.lang.Object
de.inetsoftware.jwebassembly.sourcemap.SourceMapWriter

public class SourceMapWriter extends Object
Generates Source Map version 3. https://sourcemaps.info/spec.html
  • Field Details

  • Constructor Details

    • SourceMapWriter

      public SourceMapWriter(@Nullable String sourceRoot)
      Create a new instance of the writer for a single map file.
      Parameters:
      sourceRoot - optional absolute or relative path to the sources
  • Method Details

    • addMapping

      public void addMapping(SourceMapping mapping)
      Adds a mapping for the given node. Mappings must be added in order.
      Parameters:
      mapping - the mapping
    • generate

      public void generate(Appendable out) throws IOException
      https://sourcemaps.info/spec.html
      Parameters:
      out - the target
      Throws:
      IOException - if any I/O error occur
    • appendSourceFileNames

      private void appendSourceFileNames(Appendable out) throws IOException
      Write source file names.
      Parameters:
      out - the target
      Throws:
      IOException - if any I/O error occur
    • appendJsonField

      private static void appendJsonField(Appendable out, String name, CharSequence value) throws IOException
      Write the field name to JSON source map.
      Parameters:
      out - the target
      name - the field name
      value - optional value
      Throws:
      IOException - if any I/O error occur
    • appendQuoteString

      private static void appendQuoteString(Appendable out, String str) throws IOException
      Write a quoted string to the JSON.
      Parameters:
      out - the target
      str - the unquoted string
      Throws:
      IOException - if any I/O error occur