class Opal::SourceMap::File
def map(source_root: '')
Line 7: A list of symbol names used by the “mappings” entry.
“null” may be used if some original sources should be retrieved by name.
hosted. The contents are listed in the same order as the sources in line 5.
Line 6: An optional list of source content, useful when the “source” can’t be
Line 5: A list of original sources used by the “mappings” entry.
the individual entries in the “source” field.
or removing repeated values in the “sources” entry. This value is prepended to
Line 4: An optional source root, useful for relocating source files on a server
associated with.
Line 3: An optional name of the generated code that this source map is
positive integer.
Line 2: File version (always the first entry in the object) and must be a
Line 1: The entire file is a single JSON object
9: }
8: "mappings": "A,AAAB;;ABCDE;"
7: "names": ["src", "maps", "are", "fun"],
6: "sourcesContent": [null, null],
5: "sources": ["foo.js", "bar.js"],
4: "sourceRoot": "",
3: "file": "out.js",
2: "version" : 3,
1: {
Proposed Format
def map(source_root: '') { version: 3, # file: "out.js", # This is optional sourceRoot: source_root, sources: [file], sourcesContent: [source.force_encoding('UTF-8')], names: names, mappings: Opal::SourceMap::VLQ.encode_mappings(relative_mappings), # x_com_opalrb_original_lines: source.count("\n"), # x_com_opalrb_generated_lines: generated_code.count("\n"), } end