Class SourceMapWriter
- java.lang.Object
-
- de.inetsoftware.jwebassembly.sourcemap.SourceMapWriter
-
public class SourceMapWriter extends java.lang.Object
Generates Source Map version 3. https://sourcemaps.info/spec.html
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
SourceMapWriter.Generator
The generator of the source map
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<SourceMapping>
mappings
private int
nextSourceFileNameIndex
private java.util.LinkedHashMap<java.lang.String,java.lang.Integer>
sourceFileNames
private java.lang.String
sourceRoot
-
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 void
addMapping(SourceMapping mapping)
Adds a mapping for the given node.private static void
appendJsonField(java.lang.Appendable out, java.lang.String name, java.lang.CharSequence value)
Write the field name to JSON source map.private static void
appendQuoteString(java.lang.Appendable out, java.lang.String str)
Write a quoted string to the JSON.private void
appendSourceFileNames(java.lang.Appendable out)
Write source file names.void
generate(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.IOException
https://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.IOException
Write 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.IOException
Write 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.IOException
Write a quoted string to the JSON.- Parameters:
out
- the targetstr
- the unquoted string- Throws:
java.io.IOException
- if any I/O error occur
-
-