sourcemap

package
v0.1.123 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sourcemap reads version 3 source maps, as bundlers write them beside a script, to find where a place in the bundle came from.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

Map is a decoded source map.

func Parse

func Parse(data []byte) (*Map, error)

Parse decodes a source map. It skips a segment that names no source, and rejects a map whose mappings are not well formed.

func (*Map) Locate

func (m *Map) Locate(line, column int) (Position, bool)

Locate returns where the generated line and column, from 1, came from: the last segment at or before the column. A column of 0 takes the line's first segment. It returns false for a line with no segment there.

type Position

type Position struct {
	// Source is the file as the map names it, relative to the map's
	// directory unless the map named it absolute.
	Source       string
	Line, Column int
}

Position is a place in a source file, line and column from 1.

Jump to

Keyboard shortcuts

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