tsc

package
v0.0.0-...-c0ef09c Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 19 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, testing CommandLineTesting) func(msg string)

func PrintBuildHelp

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

func PrintHelp

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

func PrintVersion

func PrintVersion(sys System)

func QuietDiagnosticReporter

func QuietDiagnosticReporter(diagnostic *ast.Diagnostic)

func QuietDiagnosticsReporter

func QuietDiagnosticsReporter(diagnostics []*ast.Diagnostic)

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) func(msg string)
	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, options *core.CompilerOptions, testing CommandLineTesting) DiagnosticReporter

func CreateDiagnosticReporter

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

func CreateWatchStatusReporter

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

type DiagnosticsReporter

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

func CreateReportErrorSummary

func CreateReportErrorSummary(sys System, 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]
}

type ExitStatus

type ExitStatus int
const (
	ExitStatusSuccess                              ExitStatus = 0
	ExitStatusDiagnosticsPresent_OutputsGenerated  ExitStatus = 1
	ExitStatusDiagnosticsPresent_OutputsSkipped    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, parse func() *tsoptions.ExtendedConfigCacheEntry) *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(stats []*Statistics, totalTime time.Duration)

func (*Statistics) Report

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

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