Class SourceMapWriter
- java.lang.Object
-
- de.inetsoftware.jwebassembly.sourcemap.SourceMapWriter
-
public class SourceMapWriter extends java.lang.ObjectGenerates Source Map version 3. https://sourcemaps.info/spec.html
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classSourceMapWriter.GeneratorThe generator of the source map
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<SourceMapping>mappingsprivate intnextSourceFileNameIndexprivate java.util.LinkedHashMap<java.lang.String,java.lang.Integer>sourceFileNamesprivate java.lang.StringsourceRoot
-
Constructor Summary
Constructors Constructor Description SourceMapWriter(java.lang.String sourceRoot)Create a new instance of the writer for a single map file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMapping(SourceMapping mapping)Adds a mapping for the given node.private static voidappendJsonField(java.lang.Appendable out, java.lang.String name, java.lang.CharSequence value)Write the field name to JSON source map.private static voidappendQuoteString(java.lang.Appendable out, java.lang.String str)Write a quoted string to the JSON.private voidappendSourceFileNames(java.lang.Appendable out)Write source file names.voidgenerate(java.lang.Appendable out)https://sourcemaps.info/spec.html
-
-
-
Field Detail
-
sourceRoot
private final java.lang.String sourceRoot
-
mappings
private final java.util.List<SourceMapping> mappings
-
sourceFileNames
private final java.util.LinkedHashMap<java.lang.String,java.lang.Integer> sourceFileNames
-
nextSourceFileNameIndex
private int nextSourceFileNameIndex
-
-
Method Detail
-
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(java.lang.Appendable out) throws java.io.IOExceptionhttps://sourcemaps.info/spec.html- Parameters:
out- the target- Throws:
java.io.IOException- if any I/O error occur
-
appendSourceFileNames
private void appendSourceFileNames(java.lang.Appendable out) throws java.io.IOExceptionWrite source file names.- Parameters:
out- the target- Throws:
java.io.IOException- if any I/O error occur
-
appendJsonField
private static void appendJsonField(java.lang.Appendable out, java.lang.String name, java.lang.CharSequence value) throws java.io.IOExceptionWrite the field name to JSON source map.- Parameters:
out- the targetname- the field namevalue- optional value- Throws:
java.io.IOException- if any I/O error occur
-
appendQuoteString
private static void appendQuoteString(java.lang.Appendable out, java.lang.String str) throws java.io.IOExceptionWrite a quoted string to the JSON.- Parameters:
out- the targetstr- the unquoted string- Throws:
java.io.IOException- if any I/O error occur
-
-