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

x/source_map/source-map.d.ts>SourceMapGenerator

Port of mozilla / source-map to deno.
Latest
class SourceMapGenerator
import { SourceMapGenerator } from "https://deno.land/x/source_map@0.8.0-beta.1/source-map.d.ts";

Constructors

new
SourceMapGenerator(startOfSourceMap?: StartOfSourceMap)

Methods

addMapping(mapping: Mapping): void

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

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(sourceFile: string, sourceContent: string): void

Set the source content for a source file.

toString(): string

Static Methods

Creates a new SourceMapGenerator based on a SourceMapConsumer