sourcemap

package module
v0.0.0-...-74cf380 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2013 License: MIT Imports: 5 Imported by: 3

README

Golang Source Map Revision 3 Reader

An implementation of the Source Map Revision 3.

Installation

$ go get github.com/MathieuTurcotte/sourcemap

Documentation

Read it online or run

$ go doc github.com/MathieuTurcotte/sourcemap

License

This code is free to use under the terms of the MIT license.

Documentation

Overview

This packages implement functions to read the source map format described in the "Source Map Revision 3 Proposal" available at http://goo.gl/bcVlcK

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	GeneratedColumn int // 0-based column of this entry in the generated source.
	SourceFileId    int // Index of the source file in the "sources" list.
	SourceLine      int // 0-based line number of this entry in the source file.
	SourceColumn    int // 0-based column number of this entry in the source file.
	NameId          int // Index of the symbol name in the "names" list.
}

Represents a section of the generated source that can be mapped back to the original source.

type Line

type Line []Entry

Represents a line in the generated source. A line is composed of entries containing information about the original source file.

type OriginalMapping

type OriginalMapping struct {
	File   string // The filename of the original file.
	Line   int    // 1-based line number.
	Column int    // 1-based column number.
	Name   string // The symbol name, if any.
}

Represents the mapping to a line/column/name in the original file.

type SourceMap

type SourceMap struct {
	Version        int
	File           string
	SourceRoot     string
	Sources        []string
	SourcesContent []string
	Names          []string
	Mappings       []Line
}

A struct representing the decoded source map.

func Read

func Read(reader io.Reader) (s SourceMap, err error)

Reads a source map.

func (*SourceMap) GetSourceMapping

func (s *SourceMap) GetSourceMapping(linum, column int) (mapping OriginalMapping, err error)

Given a line and a column number in the generated code, find a mapping in the original source. The line and column parameters are 1-based. If no mapping can be found for a given line, a mapping on the previous line is returned.

Directories

Path Synopsis
Program that reads a source map from stdin and finds the original mapping for the given line and column numbers in the generated source.
Program that reads a source map from stdin and finds the original mapping for the given line and column numbers in the generated source.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL