Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/source_map/lib/source-map-generator.js>default

Port of mozilla / source-map to deno.
Latest
class default
import { default } from "https://deno.land/x/source_map@0.8.0-beta.1/lib/source-map-generator.js";

An instance of the SourceMapGenerator represents a source map which is being built incrementally. You may pass an object with the following properties:

  • file: The filename of the generated source.
  • sourceRoot: A root for all relative URLs in this source map.

Constructors

new
default(aArgs)

Methods

_generateSourcesContent(aSources, aSourceRoot)

Serialize the accumulated mappings in to the stream of base 64 VLQs specified by the source map format.

_validateMapping(
aGenerated,
aOriginal,
aSource,
aName,
)

A mapping can have one of the three levels of data:

  1. Just the generated position.
  2. The Generated position, original position, and original source.
  3. Generated and original position, original source, as well as a name token.

To maintain consistency, we validate that any new mapping being added falls in to one of these categories.

addMapping(aArgs)

Add a single mapping from original source line and column to the generated source's line and column for this source map being created. The mapping object should have the following properties:

  • generated: An object with the generated line and column positions.
  • original: An object with the original line and column positions.
  • source: The original source file (relative to the sourceRoot).
  • name: An optional original token name for this mapping.
applySourceMap(
aSourceMapConsumer,
aSourceFile,
aSourceMapPath,
)

Applies the mappings of a sub-source-map for a specific source file to the source map being generated. Each mapping to the supplied source file is rewritten using the supplied source map. Note: The resolution for the resulting mappings is the minimium of this map and the supplied map.

setSourceContent(aSourceFile, aSourceContent)

Set the source content for a source file.

Externalize the source map.

Render the source map being generated to a string.

Static Methods

fromSourceMap(aSourceMapConsumer)

Creates a new SourceMapGenerator based on a SourceMapConsumer