Documentation ¶
Index ¶
- func AppendSourceMapChunk(j *helpers.Joiner, prevEndState SourceMapState, startState SourceMapState, ...)
- func DecodeVLQ(encoded []byte, start int) (int, int)
- func DecodeVLQUTF16(encoded []uint16) (int32, int, bool)
- type Chunk
- type ChunkBuilder
- type LineColumnOffset
- type LineOffsetTable
- type Mapping
- type MappingsBuffer
- type SourceContent
- type SourceMap
- type SourceMapPieces
- type SourceMapShift
- type SourceMapState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendSourceMapChunk ¶ added in v0.12.20
func AppendSourceMapChunk(j *helpers.Joiner, prevEndState SourceMapState, startState SourceMapState, buffer MappingsBuffer)
Source map chunks are computed in parallel for speed. Each chunk is relative to the zero state instead of being relative to the end state of the previous chunk, since it's impossible to know the end state of the previous chunk in a parallel computation.
After all chunks are computed, they are joined together in a second pass. This rewrites the first mapping in each chunk to be relative to the end state of the previous chunk.
Types ¶
type Chunk ¶ added in v0.12.20
type Chunk struct { Buffer MappingsBuffer QuotedNames [][]byte // This end state will be used to rewrite the start of the following source // map chunk so that the delta-encoded VLQ numbers are preserved. EndState SourceMapState // There probably isn't a source mapping at the end of the file (nor should // there be) but if we're appending another source map chunk after this one, // we'll need to know how many characters were in the last line we generated. FinalGeneratedColumn int ShouldIgnore bool }
type ChunkBuilder ¶ added in v0.12.20
type ChunkBuilder struct {
// contains filtered or unexported fields
}
func MakeChunkBuilder ¶ added in v0.12.20
func MakeChunkBuilder(inputSourceMap *SourceMap, lineOffsetTables []LineOffsetTable, asciiOnly bool) ChunkBuilder
func (*ChunkBuilder) AddSourceMapping ¶ added in v0.12.20
func (b *ChunkBuilder) AddSourceMapping(originalLoc logger.Loc, originalName string, output []byte)
func (*ChunkBuilder) GenerateChunk ¶ added in v0.12.20
func (b *ChunkBuilder) GenerateChunk(output []byte) Chunk
type LineColumnOffset ¶ added in v0.9.3
func (*LineColumnOffset) Add ¶ added in v0.9.4
func (a *LineColumnOffset) Add(b LineColumnOffset)
func (*LineColumnOffset) AdvanceBytes ¶ added in v0.9.3
func (offset *LineColumnOffset) AdvanceBytes(bytes []byte)
func (*LineColumnOffset) AdvanceString ¶ added in v0.9.3
func (offset *LineColumnOffset) AdvanceString(text string)
func (LineColumnOffset) ComesBefore ¶ added in v0.9.4
func (a LineColumnOffset) ComesBefore(b LineColumnOffset) bool
type LineOffsetTable ¶ added in v0.12.20
type LineOffsetTable struct {
// contains filtered or unexported fields
}
func GenerateLineOffsetTables ¶ added in v0.12.20
func GenerateLineOffsetTables(contents string, approximateLineCount int32) []LineOffsetTable
type MappingsBuffer ¶ added in v0.14.50
type SourceContent ¶ added in v0.8.25
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 Names []string }
type SourceMapPieces ¶ added in v0.9.4
func (SourceMapPieces) Finalize ¶ added in v0.9.4
func (pieces SourceMapPieces) Finalize(shifts []SourceMapShift) []byte
func (SourceMapPieces) HasContent ¶ added in v0.11.23
func (pieces SourceMapPieces) HasContent() bool
type SourceMapShift ¶ added in v0.9.4
type SourceMapShift struct { Before LineColumnOffset After LineColumnOffset }
type SourceMapState ¶ added in v0.12.20
type SourceMapState struct { // This isn't stored in the source map. It's only used by the bundler to join // source map chunks together correctly. GeneratedLine int // These are stored in the source map in VLQ format. GeneratedColumn int SourceIndex int OriginalLine int OriginalColumn int OriginalName int HasOriginalName bool }
Coordinates in source maps are stored using relative offsets for size reasons. When joining together chunks of a source map that were emitted in parallel for different parts of a file, we need to fix up the first segment of each chunk to be relative to the end of the previous chunk.