sourcemap

package
v1.169.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 8 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 a version 3 source map and turns a stack trace from the minified code it maps into the original files, lines and columns (#2784, manage_site symbolicate).

Index

Constants

View Source
const MaxFrames = 200

MaxFrames bounds the locations read from one trace.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	// Text is the location as written in the trace.
	Text   string    `json:"text"`
	File   string    `json:"file"`
	Line   int       `json:"line"`
	Column int       `json:"column"`
	Mapped *Position `json:"mapped,omitempty"`
	// Note says why a frame was not mapped.
	Note string `json:"note,omitempty"`
}

Frame is one location in a stack trace and where it maps to.

func Locations

func Locations(trace string) []Frame

Locations are the file locations a trace names, the file as a path of the site.

type Map

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

Map is a parsed source map.

func Parse

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

Parse reads a source map.

func (*Map) Lookup

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

Lookup is the original place of a 1-based line and column in the generated code, false when the map says nothing about it.

type Position

type Position struct {
	Source string `json:"source"`
	Line   int    `json:"line"`
	Column int    `json:"column"`
	Name   string `json:"name,omitempty"`
}

Position is a place in an original source.

Jump to

Keyboard shortcuts

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