sourcemap

package
v0.12.8 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeVLQ

func DecodeVLQ(encoded []byte, start int) (int, int)

func DecodeVLQUTF16

func DecodeVLQUTF16(encoded []uint16) (int, int, bool)

func EncodeVLQ

func EncodeVLQ(value int) []byte

A single base 64 digit can contain 6 bits of data. For the base 64 variable length quantities we use in the source map spec, the first bit is the sign, the next four bits are the actual value, and the 6th bit is the continuation bit. The continuation bit tells us whether there are more digits in this value following this digit.

Continuation
|    Sign
|    |
V    V
101011

Types

type LineColumnOffset

type LineColumnOffset struct {
	Lines   int
	Columns int
}

func (*LineColumnOffset) Add

func (*LineColumnOffset) AdvanceBytes

func (offset *LineColumnOffset) AdvanceBytes(bytes []byte)

func (*LineColumnOffset) AdvanceString

func (offset *LineColumnOffset) AdvanceString(text string)

func (LineColumnOffset) ComesBefore

func (a LineColumnOffset) ComesBefore(b LineColumnOffset) bool

type Mapping

type Mapping struct {
	GeneratedLine   int32 // 0-based
	GeneratedColumn int32 // 0-based count of UTF-16 code units

	SourceIndex    int32 // 0-based
	OriginalLine   int32 // 0-based
	OriginalColumn int32 // 0-based count of UTF-16 code units
}

type SourceContent

type SourceContent struct {
	// This stores both the unquoted and the quoted values. We try to use the
	// already-quoted value if possible so we don't need to re-quote it
	// unnecessarily for maximum performance.
	Quoted string

	// But sometimes we need to re-quote the value, such as when it contains
	// non-ASCII characters and we are in ASCII-only mode. In that case we quote
	// this parsed UTF-16 value.
	Value []uint16
}

type SourceMap

type SourceMap struct {
	Sources        []string
	SourcesContent []SourceContent
	Mappings       []Mapping
}

func (*SourceMap) Find

func (sm *SourceMap) Find(line int32, column int32) *Mapping

type SourceMapPieces

type SourceMapPieces struct {
	Prefix   []byte
	Mappings []byte
	Suffix   []byte
}

func (SourceMapPieces) Finalize

func (pieces SourceMapPieces) Finalize(shifts []SourceMapShift) []byte

func (SourceMapPieces) HasContent

func (pieces SourceMapPieces) HasContent() bool

type SourceMapShift

type SourceMapShift struct {
	Before LineColumnOffset
	After  LineColumnOffset
}

Jump to

Keyboard shortcuts

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