sourcemap

package
v0.0.0-...-7d7180d Latest Latest
Warning

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

Go to latest
Published: May 24, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MissingSource       SourceIndex = -1
	MissingName         NameIndex   = -1
	MissingLineOrColumn int         = -1
)

Variables

This section is empty.

Functions

func TryGetSourceMappingURL

func TryGetSourceMappingURL(lineInfo *LineInfo) string

Tries to find the sourceMappingURL comment at the end of a file.

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(file string, sourceRoot string, sourcesDirectoryPath string, options tspath.ComparePathsOptions) *Generator

func (*Generator) AddGeneratedMapping

func (gen *Generator) AddGeneratedMapping(generatedLine int, generatedCharacter int) error

Adds a mapping without source information

func (*Generator) AddName

func (gen *Generator) AddName(name string) NameIndex

Declares a name in the source map, returning the index of the name

func (*Generator) AddNamedSourceMapping

func (gen *Generator) AddNamedSourceMapping(generatedLine int, generatedCharacter int, sourceIndex SourceIndex, sourceLine int, sourceCharacter int, nameIndex NameIndex) error

Adds a mapping with source and name information

func (*Generator) AddSource

func (gen *Generator) AddSource(fileName string) SourceIndex

Adds a source to the source map

func (*Generator) AddSourceMapping

func (gen *Generator) AddSourceMapping(generatedLine int, generatedCharacter int, sourceIndex SourceIndex, sourceLine int, sourceCharacter int) error

Adds a mapping with source information

func (*Generator) RawSourceMap

func (gen *Generator) RawSourceMap() *RawSourceMap

Gets the source map as a `RawSourceMap` object

func (*Generator) SetSourceContent

func (gen *Generator) SetSourceContent(sourceIndex SourceIndex, content string) error

Sets the content for a source

func (*Generator) Sources

func (gen *Generator) Sources() []string

func (*Generator) String

func (gen *Generator) String() string

Gets the string representation of the source map

type LineInfo

type LineInfo struct {
	// contains filtered or unexported fields
}

func GetLineInfo

func GetLineInfo(text string, lineStarts []core.TextPos) *LineInfo

func (*LineInfo) LineCount

func (li *LineInfo) LineCount() int

func (*LineInfo) LineText

func (li *LineInfo) LineText(line int) string

type Mapping

type Mapping struct {
	GeneratedLine      int
	GeneratedCharacter int
	SourceIndex        SourceIndex
	SourceLine         int
	SourceCharacter    int
	NameIndex          NameIndex
}

func (*Mapping) Equals

func (m *Mapping) Equals(other *Mapping) bool

func (*Mapping) IsSourceMapping

func (m *Mapping) IsSourceMapping() bool

type MappingsDecoder

type MappingsDecoder struct {
	// contains filtered or unexported fields
}

func DecodeMappings

func DecodeMappings(mappings string) *MappingsDecoder

func (*MappingsDecoder) Error

func (d *MappingsDecoder) Error() error

func (*MappingsDecoder) MappingsString

func (d *MappingsDecoder) MappingsString() string

func (*MappingsDecoder) Next

func (d *MappingsDecoder) Next() (value *Mapping, done bool)

func (*MappingsDecoder) Pos

func (d *MappingsDecoder) Pos() int

func (*MappingsDecoder) State

func (d *MappingsDecoder) State() *Mapping

func (*MappingsDecoder) Values

func (d *MappingsDecoder) Values() iter.Seq[*Mapping]

type NameIndex

type NameIndex int

type RawSourceMap

type RawSourceMap struct {
	Version        int       `json:"version"`
	File           string    `json:"file"`
	SourceRoot     string    `json:"sourceRoot"`
	Sources        []string  `json:"sources"`
	Names          []string  `json:"names"`
	Mappings       string    `json:"mappings"`
	SourcesContent []*string `json:"sourcesContent,omitempty"`
}

type Source

type Source interface {
	Text() string
	FileName() string
	LineMap() []core.TextPos
}

type SourceIndex

type SourceIndex int

Jump to

Keyboard shortcuts

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