Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

SourceMapGenerator

class SourceMapGenerator {
constructor(startOfSourceMap?: StartOfSourceMap);
addMapping(mapping: Mapping): void;
applySourceMap(
sourceMapConsumer: SourceMapConsumer,
sourceFile?: string,
sourceMapPath?: string,
): void;
setSourceContent(sourceFile: string, sourceContent: string): void;
toJSON(): RawSourceMap;
toString(): string;
 
static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
}

§Constructors

§
new SourceMapGenerator(startOfSourceMap?: StartOfSourceMap)
[src]

§Methods

§
addMapping(mapping: Mapping): void
[src]

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(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void
[src]

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.

@param sourceMapConsumer

The source map to be applied.

@param sourceFile

Optional. The filename of the source file. If omitted, SourceMapConsumer's file property will be used.

@param sourceMapPath

Optional. The dirname of the path to the source map to be applied. If relative, it is relative to the SourceMapConsumer. This parameter is needed when the two source maps aren't in the same directory, and the source map to be applied contains relative source paths. If so, those relative source paths need to be rewritten relative to the SourceMapGenerator.

§
setSourceContent(sourceFile: string, sourceContent: string): void
[src]

Set the source content for a source file.

§
toString(): string
[src]

§Static Methods

§
fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator
[src]

Creates a new SourceMapGenerator based on a SourceMapConsumer

@param sourceMapConsumer

The SourceMap.