Function js_source_mapper::consume [] [src]

pub fn consume(source_map_json: &str) -> Result<CacheString>

consume parses a SourceMap into a cache that can be queried for mappings

The only parameter is the raw source map as a JSON string. According to the source map spec, source maps have the following attributes:

  • version: Which version of the source map spec this map is following.
  • sources: An array of URLs to the original source files.
  • names: An array of identifiers which can be referrenced by individual mappings.
  • sourceRoot: Optional. The URL root from which all sources are relative.
  • sourcesContent: Optional. An array of contents of the original source files.
  • mappings: A string of base64 VLQs which contain the actual mappings.
  • file: Optional. The generated file this source map is associated with.

Here is an example source map:

    {
      "version": 3,
      "file": "out.js",
      "sourceRoot" : "",
      "sources": ["foo.js", "bar.js"],
      "names": ["src", "maps", "are", "fun"],
      "mappings": "AA,AB;;ABCDE;"
    }