Documentation ¶
Index ¶
- Constants
- func PlatformIndependentPathDirBaseExt(path string) (dir string, base string, ext string)
- func PrintErrorToStderr(osArgs []string, text string)
- func PrintMessageToStderr(osArgs []string, msg Msg)
- func PrintSummary(useColor UseColor, table SummaryTable, start *time.Time)
- func PrintText(file *os.File, level LogLevel, osArgs []string, callback func(Colors) string)
- func PrintTextWithColor(file *os.File, useColor UseColor, callback func(Colors) string)
- type Colors
- type Loc
- type Log
- func (log Log) AddError(source *Source, loc Loc, text string)
- func (log Log) AddErrorWithNotes(source *Source, loc Loc, text string, notes []MsgData)
- func (log Log) AddRangeError(source *Source, r Range, text string)
- func (log Log) AddRangeErrorWithNotes(source *Source, r Range, text string, notes []MsgData)
- func (log Log) AddRangeWarning(source *Source, r Range, text string)
- func (log Log) AddRangeWarningWithNotes(source *Source, r Range, text string, notes []MsgData)
- func (log Log) AddWarning(source *Source, loc Loc, text string)
- type LogLevel
- type Msg
- type MsgData
- type MsgDetail
- type MsgKind
- type MsgLocation
- type OutputOptions
- type Path
- type PathFlags
- type Range
- type SortableMsgs
- type Source
- func (s *Source) RangeOfLegacyOctalEscape(loc Loc) (r Range)
- func (s *Source) RangeOfNumber(loc Loc) (r Range)
- func (s *Source) RangeOfOperatorAfter(loc Loc, op string) Range
- func (s *Source) RangeOfOperatorBefore(loc Loc, op string) Range
- func (s *Source) RangeOfString(loc Loc) Range
- func (s *Source) TextForRange(r Range) string
- type SummaryTable
- type SummaryTableEntry
- type TerminalInfo
- type UseColor
Constants ¶
View Source
const SupportsColorEscapes = true
Variables ¶
This section is empty.
Functions ¶
func PlatformIndependentPathDirBaseExt ¶ added in v0.8.22
This has a custom implementation instead of using "filepath.Dir/Base/Ext" because it should work the same on Unix and Windows. These names end up in the generated output and the generated output should not depend on the OS.
func PrintErrorToStderr ¶
func PrintMessageToStderr ¶ added in v0.7.0
func PrintSummary ¶ added in v0.8.28
func PrintSummary(useColor UseColor, table SummaryTable, start *time.Time)
Types ¶
type Loc ¶
type Loc struct { // This is the 0-based index of this location from the start of the file, in bytes Start int32 }
type Log ¶
type Log struct { AddMsg func(Msg) HasErrors func() bool // This is called after the build has finished but before writing to stdout. // It exists to ensure that deferred warning messages end up in the terminal // before the data written to stdout. AlmostDone func() Done func() []Msg }
func NewDeferLog ¶
func NewDeferLog() Log
func NewStderrLog ¶
func NewStderrLog(options OutputOptions) Log
func (Log) AddErrorWithNotes ¶ added in v0.8.8
func (Log) AddRangeErrorWithNotes ¶ added in v0.8.8
func (Log) AddRangeWarningWithNotes ¶ added in v0.8.8
type Msg ¶
func (Msg) String ¶
func (msg Msg) String(options OutputOptions, terminalInfo TerminalInfo) string
type MsgData ¶ added in v0.8.8
type MsgData struct { Text string Location *MsgLocation // Optional user-specified data that is passed through unmodified UserDetail interface{} }
type MsgLocation ¶
type MsgLocation struct { File string Namespace string Line int // 1-based Column int // 0-based, in bytes Length int // in bytes LineText string Suggestion string }
func LocationOrNil ¶ added in v0.8.1
func LocationOrNil(source *Source, r Range) *MsgLocation
type OutputOptions ¶ added in v0.8.28
func OutputOptionsForArgs ¶ added in v0.8.28
func OutputOptionsForArgs(osArgs []string) OutputOptions
type Path ¶
type Path struct { Text string Namespace string // This feature was added to support ancient CSS libraries that append things // like "?#iefix" and "#icons" to some of their import paths as a hack for IE6. // The intent is for these suffix parts to be ignored but passed through to // the output. This is supported by other bundlers, so we also support this. IgnoredSuffix string Flags PathFlags }
This is used to represent both file system paths (Namespace == "file") and abstract module paths (Namespace != "file"). Abstract module paths represent "virtual modules" when used for an input file and "package paths" when used to represent an external module.
func (Path) ComesBeforeInSortedOrder ¶
func (Path) IsDisabled ¶ added in v0.8.44
type SortableMsgs ¶ added in v0.8.8
type SortableMsgs []Msg
This type is just so we can use Go's native sort function
func (SortableMsgs) Len ¶ added in v0.8.8
func (a SortableMsgs) Len() int
func (SortableMsgs) Swap ¶ added in v0.8.8
func (a SortableMsgs) Swap(i int, j int)
type Source ¶
type Source struct { Index uint32 // This is used as a unique key to identify this source file. It should never // be shown to the user (e.g. never print this to the terminal). // // If it's marked as an absolute path, it's a platform-dependent path that // includes environment-specific things such as Windows backslash path // separators and potentially the user's home directory. Only use this for // passing to syscalls for reading and writing to the file system. Do not // include this in any output data. // // If it's marked as not an absolute path, it's an opaque string that is used // to refer to an automatically-generated module. KeyPath Path // This is used for error messages and the metadata JSON file. // // This is a mostly platform-independent path. It's relative to the current // working directory and always uses standard path separators. Use this for // referencing a file in all output data. These paths still use the original // case of the path so they may still work differently on file systems that // are case-insensitive vs. case-sensitive. PrettyPath string // An identifier that is mixed in to automatically-generated symbol names to // improve readability. For example, if the identifier is "util" then the // symbol for an "export default" statement will be called "util_default". IdentifierName string Contents string }
func (*Source) RangeOfLegacyOctalEscape ¶ added in v0.8.48
func (*Source) RangeOfNumber ¶
func (*Source) RangeOfOperatorAfter ¶ added in v0.7.2
func (*Source) RangeOfOperatorBefore ¶ added in v0.7.2
func (*Source) RangeOfString ¶
func (*Source) TextForRange ¶
type SummaryTable ¶ added in v0.8.28
type SummaryTable []SummaryTableEntry
This type is just so we can use Go's native sort function
func (SummaryTable) Len ¶ added in v0.8.28
func (t SummaryTable) Len() int
func (SummaryTable) Swap ¶ added in v0.8.28
func (t SummaryTable) Swap(i int, j int)
type SummaryTableEntry ¶ added in v0.8.28
type TerminalInfo ¶
func GetTerminalInfo ¶
func GetTerminalInfo(file *os.File) (info TerminalInfo)
Click to show internal directories.
Click to hide internal directories.