Class SourceMapWriter
java.lang.Object
de.inetsoftware.jwebassembly.sourcemap.SourceMapWriter
Generates Source Map version 3.
https://sourcemaps.info/spec.html
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
The generator of the source map -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<SourceMapping> private int
private final LinkedHashMap
<String, Integer> private final String
-
Constructor Summary
ConstructorsConstructorDescriptionSourceMapWriter
(String sourceRoot) Create a new instance of the writer for a single map file. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMapping
(SourceMapping mapping) Adds a mapping for the given node.private static void
appendJsonField
(Appendable out, String name, CharSequence value) Write the field name to JSON source map.private static void
appendQuoteString
(Appendable out, String str) Write a quoted string to the JSON.private void
Write source file names.void
generate
(Appendable out) https://sourcemaps.info/spec.html
-
Field Details
-
sourceRoot
-
mappings
-
sourceFileNames
-
nextSourceFileNameIndex
private int nextSourceFileNameIndex
-
-
Constructor Details
-
SourceMapWriter
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
Adds a mapping for the given node. Mappings must be added in order.- Parameters:
mapping
- the mapping
-
generate
https://sourcemaps.info/spec.html- Parameters:
out
- the target- Throws:
IOException
- if any I/O error occur
-
appendSourceFileNames
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 targetname
- the field namevalue
- optional value- Throws:
IOException
- if any I/O error occur
-
appendQuoteString
Write a quoted string to the JSON.- Parameters:
out
- the targetstr
- the unquoted string- Throws:
IOException
- if any I/O error occur
-