Help us shape the future of Go! Take the 2026 Go Developer Survey

tsc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmitAndReportStatistics

func EmitAndReportStatistics(input EmitInput) (CompileAndEmitResult, *Statistics)

func GetTraceWithWriterFromSys

func GetTraceWithWriterFromSys(w io.Writer, locale locale.Locale, testing CommandLineTesting) func(msg *diagnostics.Message, args ...any)

func PrintBuildHelp

func PrintBuildHelp(sys System, locale locale.Locale, buildOptions []*tsoptions.CommandLineOption)

func PrintHelp

func PrintHelp(sys System, locale locale.Locale, commandLine *tsoptions.ParsedCommandLine)

func PrintVersion

func PrintVersion(sys System, locale locale.Locale)

func QuietDiagnosticReporter

func QuietDiagnosticReporter(diagnostic *ast.Diagnostic)

func QuietDiagnosticsReporter

func QuietDiagnosticsReporter(diagnostics []*ast.Diagnostic)

func WriteConfigFile

func WriteConfigFile(sys System, locale locale.Locale, reportDiagnostic DiagnosticReporter, options *collections.OrderedMap[string, any])

Types

type CommandLineResult

type CommandLineResult struct {
	Status  ExitStatus
	Watcher Watcher
}

type CommandLineTesting

type CommandLineTesting interface {
	// Ensure that all emitted files are timestamped in order to ensure they are deterministic for test baseline
	OnEmittedFiles(result *compiler.EmitResult, mTimesCache *collections.SyncMap[tspath.Path, time.Time])
	OnListFilesStart(w io.Writer)
	OnListFilesEnd(w io.Writer)
	OnStatisticsStart(w io.Writer)
	OnStatisticsEnd(w io.Writer)
	OnBuildStatusReportStart(w io.Writer)
	OnBuildStatusReportEnd(w io.Writer)
	OnWatchStatusReportStart()
	OnWatchStatusReportEnd()
	GetTrace(w io.Writer, locale locale.Locale) func(msg *diagnostics.Message, args ...any)
	OnProgram(program *incremental.Program)
}

type CompileAndEmitResult

type CompileAndEmitResult struct {
	Diagnostics []*ast.Diagnostic
	EmitResult  *compiler.EmitResult
	Status      ExitStatus
	// contains filtered or unexported fields
}

func EmitFilesAndReportErrors

func EmitFilesAndReportErrors(input EmitInput) (result CompileAndEmitResult)

type CompileTimes

type CompileTimes struct {
	ConfigTime time.Duration
	ParseTime  time.Duration

	BuildInfoReadTime  time.Duration
	ChangesComputeTime time.Duration
	// contains filtered or unexported fields
}

type DiagnosticReporter

type DiagnosticReporter = func(*ast.Diagnostic)

func CreateBuilderStatusReporter

func CreateBuilderStatusReporter(sys System, w io.Writer, locale locale.Locale, options *core.CompilerOptions, testing CommandLineTesting) DiagnosticReporter

func CreateDiagnosticReporter

func CreateDiagnosticReporter(sys System, w io.Writer, locale locale.Locale, options *core.CompilerOptions) DiagnosticReporter

func CreateWatchStatusReporter

func CreateWatchStatusReporter(sys System, locale locale.Locale, options *core.CompilerOptions, testing CommandLineTesting) DiagnosticReporter

type DiagnosticsReporter

type DiagnosticsReporter = func(diagnostics []*ast.Diagnostic)

func CreateReportErrorSummary

func CreateReportErrorSummary(sys System, locale locale.Locale, options *core.CompilerOptions) DiagnosticsReporter

type EmitInput

type EmitInput struct {
	Sys                System
	ProgramLike        compiler.ProgramLike
	Program            *compiler.Program
	Config             *tsoptions.ParsedCommandLine
	ReportDiagnostic   DiagnosticReporter
	ReportErrorSummary DiagnosticsReporter
	Writer             io.Writer
	WriteFile          compiler.WriteFile
	CompileTimes       *CompileTimes
	Testing            CommandLineTesting
	TestingMTimesCache *collections.SyncMap[tspath.Path, time.Time]
	Tracing            *tracing.Tracing
}

type ExitStatus

type ExitStatus int
const (
	ExitStatusSuccess                              ExitStatus = 0
	ExitStatusDiagnosticsPresent_OutputsSkipped    ExitStatus = 1
	ExitStatusDiagnosticsPresent_OutputsGenerated  ExitStatus = 2
	ExitStatusInvalidProject_OutputsSkipped        ExitStatus = 3
	ExitStatusProjectReferenceCycle_OutputsSkipped ExitStatus = 4
	ExitStatusNotImplemented                       ExitStatus = 5
)

type ExtendedConfigCache

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

extendedConfigCache is a minimal implementation of tsoptions.ExtendedConfigCache. It is concurrency-safe, but stores cached entries permanently. This implementation should not be used for long-running processes where configuration changes over the course of multiple compilations.

func (*ExtendedConfigCache) GetExtendedConfig

func (e *ExtendedConfigCache) GetExtendedConfig(fileName string, path tspath.Path, resolutionStack []tspath.Path, host tsoptions.ParseConfigHost) *tsoptions.ExtendedConfigCacheEntry

GetExtendedConfig implements tsoptions.ExtendedConfigCache.

type Statistics

type Statistics struct {
	Projects         int
	ProjectsBuilt    int
	TimestampUpdates int
	// contains filtered or unexported fields
}

func (*Statistics) Aggregate

func (s *Statistics) Aggregate(stat *Statistics)

func (*Statistics) Report

func (s *Statistics) Report(w io.Writer, testing CommandLineTesting)

func (*Statistics) SetTotalTime

func (s *Statistics) SetTotalTime(totalTime time.Duration)

type System

type System interface {
	Writer() io.Writer
	FS() vfs.FS
	DefaultLibraryPath() string
	GetCurrentDirectory() string
	WriteOutputIsTTY() bool
	GetWidthOfTerminal() int
	GetEnvironmentVariable(name string) string

	Now() time.Time
	SinceStart() time.Duration
}

type Watcher

type Watcher interface {
	DoCycle()
}

Jump to

Keyboard shortcuts

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