core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResolutionModeNone     = ModuleKindNone
	ResolutionModeCommonJS = ModuleKindCommonJS
	ResolutionModeESM      = ModuleKindESNext
)
View Source
const (
	VersionMajorMinor = "7.0"
	Version           = "7.0.0-dev"
)

Variables

This section is empty.

Functions

func AppendIfUnique

func AppendIfUnique[T comparable](slice []T, element T) []T

func BinarySearchUniqueFunc

func BinarySearchUniqueFunc[S ~[]E, E any](x S, cmp func(int, E) int) (int, bool)

BinarySearchUniqueFunc works like slices.BinarySearchFunc, but avoids extra invocations of the comparison function by assuming that only one element in the slice could match the target. Also, unlike slices.BinarySearchFunc, the comparison function is passed the current index of the element being compared, instead of the target element.

func Coalesce

func Coalesce[T *U, U any](a T, b T) T

Returns `a` if `a` is not `nil`; Otherwise, returns `b`. Coalesce is roughly analogous to `??` in JS, except that it non-shortcutting, so it is advised to only use a constant or precomputed value for `b`

func ComputeLineStartsSeq

func ComputeLineStartsSeq(text string) iter.Seq[TextPos]

func Concatenate

func Concatenate[T any](s1 []T, s2 []T) []T

func CountWhere

func CountWhere[T any](slice []T, f func(T) bool) int

func ElementOrNil

func ElementOrNil[T any](slice []T, index int) T

func Every

func Every[T any](slice []T, f func(T) bool) bool

func Filter

func Filter[T any](slice []T, f func(T) bool) []T

func FilterIndex

func FilterIndex[T any](slice []T, f func(T, int, []T) bool) []T

func Find

func Find[T any](slice []T, f func(T) bool) T

func FindIndex

func FindIndex[T any](slice []T, f func(T) bool) int

func FindLast

func FindLast[T any](slice []T, f func(T) bool) T

func FindLastIndex

func FindLastIndex[T any](slice []T, f func(T) bool) int

func FirstNonNil

func FirstNonNil[T any, U comparable](slice []T, f func(T) U) U

func FirstOrNil

func FirstOrNil[T any](slice []T) T

func FirstOrNilSeq

func FirstOrNilSeq[T any](seq iter.Seq[T]) T

func FirstResult

func FirstResult[T1 any](t1 T1, _ ...any) T1

Extracts the first value of a multi-value return.

func Flatten

func Flatten[T any](array [][]T) []T

func GetOutputExtension

func GetOutputExtension(fileName string, jsx JsxEmit) string

func GetSpellingSuggestion

func GetSpellingSuggestion[T any](name string, candidates []T, getName func(T) string) T

Given a name and a list of names that are *not* equal to the name, return a spelling suggestion if there is one that is close enough. Names less than length 3 only check for case-insensitive equality.

find the candidate with the smallest Levenshtein distance,

except for candidates:
  * With no name
  * Whose length differs from the target name by more than 0.34 of the length of the name.
  * Whose levenshtein distance is more than 0.4 of the length of the name
    (0.4 allows 1 substitution/transposition for every 5 characters,
     and 1 insertion/deletion at 3 characters)

@internal

func Identity

func Identity[T any](t T) T

func IfElse

func IfElse[T any](b bool, whenTrue T, whenFalse T) T

Returns whenTrue if b is true; otherwise, returns whenFalse. IfElse should only be used when branches are either constant or precomputed as both branches will be evaluated regardless as to the value of b.

func InsertSorted

func InsertSorted[T any](slice []T, element T, cmp func(T, T) int) []T

func LastOrNil

func LastOrNil[T any](slice []T) T

func Map

func Map[T, U any](slice []T, f func(T) U) []U

func MapIndex

func MapIndex[T, U any](slice []T, f func(T, int) U) []U

func MapNonNil

func MapNonNil[T any, U comparable](slice []T, f func(T) U) []U

func Memoize

func Memoize[T any](create func() T) func() T

func Must

func Must[T any](v T, err error) T

func OrElse

func OrElse[T comparable](value T, defaultValue T) T

Returns value if value is not the zero value of T; Otherwise, returns defaultValue. OrElse should only be used when defaultValue is constant or precomputed as its argument will be evaluated regardless as to the content of value.

func PositionToLineAndCharacter

func PositionToLineAndCharacter(position int, lineStarts []TextPos) (line int, character int)

func ReplaceElement

func ReplaceElement[T any](slice []T, i int, t T) []T

func Same

func Same[T any](s1 []T, s2 []T) bool

func SameMap

func SameMap[T comparable](slice []T, f func(T) T) []T

func SameMapIndex

func SameMapIndex[T comparable](slice []T, f func(T, int) T) []T

func Some

func Some[T any](slice []T, f func(T) bool) bool

func Splice

func Splice[T any](s1 []T, start int, deleteCount int, items ...T) []T

func StringifyJson

func StringifyJson(input any, prefix string, indent string) (string, error)

Types

type CompilerOptions

type CompilerOptions struct {
	AllowJs                                   Tristate                                  `json:"allowJs"`
	AllowArbitraryExtensions                  Tristate                                  `json:"allowArbitraryExtensions"`
	AllowSyntheticDefaultImports              Tristate                                  `json:"allowSyntheticDefaultImports"`
	AllowImportingTsExtensions                Tristate                                  `json:"allowImportingTsExtensions"`
	AllowNonTsExtensions                      Tristate                                  `json:"allowNonTsExtensions"`
	AllowUmdGlobalAccess                      Tristate                                  `json:"allowUmdGlobalAccess"`
	AllowUnreachableCode                      Tristate                                  `json:"allowUnreachableCode"`
	AllowUnusedLabels                         Tristate                                  `json:"allowUnusedLabels"`
	AssumeChangesOnlyAffectDirectDependencies Tristate                                  `json:"assumeChangesOnlyAffectDirectDependencies"`
	AlwaysStrict                              Tristate                                  `json:"alwaysStrict"`
	BaseUrl                                   string                                    `json:"baseUrl"`
	Build                                     Tristate                                  `json:"build"`
	CheckJs                                   Tristate                                  `json:"checkJs"`
	CustomConditions                          []string                                  `json:"customConditions"`
	Composite                                 Tristate                                  `json:"composite"`
	EmitDeclarationOnly                       Tristate                                  `json:"emitDeclarationOnly"`
	EmitBOM                                   Tristate                                  `json:"emitBOM"`
	EmitDecoratorMetadata                     Tristate                                  `json:"emitDecoratorMetadata"`
	DownlevelIteration                        Tristate                                  `json:"downlevelIteration"`
	Declaration                               Tristate                                  `json:"declaration"`
	DeclarationDir                            string                                    `json:"declarationDir"`
	DeclarationMap                            Tristate                                  `json:"declarationMap"`
	DisableSizeLimit                          Tristate                                  `json:"disableSizeLimit"`
	DisableSourceOfProjectReferenceRedirect   Tristate                                  `json:"disableSourceOfProjectReferenceRedirect"`
	DisableSolutionSearching                  Tristate                                  `json:"disableSolutionSearching"`
	DisableReferencedProjectLoad              Tristate                                  `json:"disableReferencedProjectLoad"`
	ESModuleInterop                           Tristate                                  `json:"esModuleInterop"`
	ExactOptionalPropertyTypes                Tristate                                  `json:"exactOptionalPropertyTypes"`
	ExperimentalDecorators                    Tristate                                  `json:"experimentalDecorators"`
	ForceConsistentCasingInFileNames          Tristate                                  `json:"forceConsistentCasingInFileNames"`
	IsolatedModules                           Tristate                                  `json:"isolatedModules"`
	IsolatedDeclarations                      Tristate                                  `json:"isolatedDeclarations"`
	IgnoreDeprecations                        string                                    `json:"ignoreDeprecations"`
	ImportHelpers                             Tristate                                  `json:"importHelpers"`
	InlineSourceMap                           Tristate                                  `json:"inlineSourceMap"`
	InlineSources                             Tristate                                  `json:"inlineSources"`
	Init                                      Tristate                                  `json:"init"`
	Incremental                               Tristate                                  `json:"incremental"`
	Jsx                                       JsxEmit                                   `json:"jsx"`
	JsxFactory                                string                                    `json:"jsxFactory"`
	JsxFragmentFactory                        string                                    `json:"jsxFragmentFactory"`
	JsxImportSource                           string                                    `json:"jsxImportSource"`
	KeyofStringsOnly                          Tristate                                  `json:"keyofStringsOnly"`
	Lib                                       []string                                  `json:"lib"`
	Locale                                    string                                    `json:"locale"`
	MapRoot                                   string                                    `json:"mapRoot"`
	ModuleKind                                ModuleKind                                `json:"module"`
	ModuleResolution                          ModuleResolutionKind                      `json:"moduleResolution"`
	ModuleSuffixes                            []string                                  `json:"moduleSuffixes"`
	ModuleDetection                           ModuleDetectionKind                       `json:"moduleDetectionKind"`
	NewLine                                   NewLineKind                               `json:"newLine"`
	NoEmit                                    Tristate                                  `json:"noEmit"`
	NoCheck                                   Tristate                                  `json:"noCheck"`
	NoErrorTruncation                         Tristate                                  `json:"noErrorTruncation"`
	NoFallthroughCasesInSwitch                Tristate                                  `json:"noFallthroughCasesInSwitch"`
	NoImplicitAny                             Tristate                                  `json:"noImplicitAny"`
	NoImplicitThis                            Tristate                                  `json:"noImplicitThis"`
	NoImplicitReturns                         Tristate                                  `json:"noImplicitReturns"`
	NoEmitHelpers                             Tristate                                  `json:"noEmitHelpers"`
	NoLib                                     Tristate                                  `json:"noLib"`
	NoPropertyAccessFromIndexSignature        Tristate                                  `json:"noPropertyAccessFromIndexSignature"`
	NoUncheckedIndexedAccess                  Tristate                                  `json:"noUncheckedIndexedAccess"`
	NoEmitOnError                             Tristate                                  `json:"noEmitOnError"`
	NoUnusedLocals                            Tristate                                  `json:"noUnusedLocals"`
	NoUnusedParameters                        Tristate                                  `json:"noUnusedParameters"`
	NoResolve                                 Tristate                                  `json:"noResolve"`
	NoImplicitOverride                        Tristate                                  `json:"noImplicitOverride"`
	NoUncheckedSideEffectImports              Tristate                                  `json:"noUncheckedSideEffectImports"`
	Out                                       string                                    `json:"out"`
	OutDir                                    string                                    `json:"outDir"`
	OutFile                                   string                                    `json:"outFile"`
	Paths                                     *collections.OrderedMap[string, []string] `json:"paths"`
	PreserveConstEnums                        Tristate                                  `json:"preserveConstEnums"`
	PreserveSymlinks                          Tristate                                  `json:"preserveSymlinks"`
	Project                                   string                                    `json:"project"`
	ResolveJsonModule                         Tristate                                  `json:"resolveJsonModule"`
	ResolvePackageJsonExports                 Tristate                                  `json:"resolvePackageJsonExports"`
	ResolvePackageJsonImports                 Tristate                                  `json:"resolvePackageJsonImports"`
	RemoveComments                            Tristate                                  `json:"removeComments"`
	RewriteRelativeImportExtensions           Tristate                                  `json:"rewriteRelativeImportExtensions"`
	ReactNamespace                            string                                    `json:"reactNamespace"`
	RootDir                                   string                                    `json:"rootDir"`
	RootDirs                                  []string                                  `json:"rootDirs"`
	SkipLibCheck                              Tristate                                  `json:"skipLibCheck"`
	Strict                                    Tristate                                  `json:"strict"`
	StrictBindCallApply                       Tristate                                  `json:"strictBindCallApply"`
	StrictBuiltinIteratorReturn               Tristate                                  `json:"strictBuiltinIteratorReturn"`
	StrictFunctionTypes                       Tristate                                  `json:"strictFunctionTypes"`
	StrictNullChecks                          Tristate                                  `json:"strictNullChecks"`
	StrictPropertyInitialization              Tristate                                  `json:"strictPropertyInitialization"`
	StripInternal                             Tristate                                  `json:"stripInternal"`
	SkipDefaultLibCheck                       Tristate                                  `json:"skipDefaultLibCheck"`
	SourceMap                                 Tristate                                  `json:"sourceMap"`
	SourceRoot                                string                                    `json:"sourceRoot"`
	SuppressOutputPathCheck                   Tristate                                  `json:"suppressOutputPathCheck"`
	Target                                    ScriptTarget                              `json:"target"`
	TraceResolution                           Tristate                                  `json:"traceResolution"`
	TsBuildInfoFile                           string                                    `json:"tsBuildInfoFile"`
	TypeRoots                                 []string                                  `json:"typeRoots"`
	Types                                     []string                                  `json:"types"`
	UseDefineForClassFields                   Tristate                                  `json:"useDefineForClassFields"`
	UseUnknownInCatchVariables                Tristate                                  `json:"useUnknownInCatchVariables"`
	VerbatimModuleSyntax                      Tristate                                  `json:"verbatimModuleSyntax"`
	MaxNodeModuleJsDepth                      *int                                      `json:"maxNodeModuleJsDepth"`

	// Internal fields
	ConfigFilePath      string   `json:"configFilePath"`
	NoDtsResolution     Tristate `json:"noDtsResolution"`
	PathsBasePath       string   `json:"pathsBasePath"`
	Diagnostics         Tristate `json:"diagnostics"`
	ExtendedDiagnostics Tristate `json:"extendedDiagnostics"`
	GenerateCpuProfile  string   `json:"generateCpuProfile"`
	GenerateTrace       string   `json:"generateTrace"`
	ListEmittedFiles    Tristate `json:"listEmittedFiles"`
	ListFiles           Tristate `json:"listFiles"`
	ExplainFiles        Tristate `json:"explainFiles"`
	ListFilesOnly       Tristate `json:"listFilesOnly"`
	NoEmitForJsFiles    Tristate `json:"noEmitForJsFiles"`
	PreserveWatchOutput Tristate `json:"preserveWatchOutput"`
	Pretty              Tristate `json:"pretty"`
	Version             Tristate `json:"version"`
	Watch               Tristate `json:"watch"`
	ShowConfig          Tristate `json:"showConfig"`
	TscBuild            Tristate `json:"tscBuild"`
}

func (*CompilerOptions) GetAllowJs

func (options *CompilerOptions) GetAllowJs() bool

func (*CompilerOptions) GetAllowSyntheticDefaultImports

func (options *CompilerOptions) GetAllowSyntheticDefaultImports() bool

func (*CompilerOptions) GetAreDeclarationMapsEnabled

func (options *CompilerOptions) GetAreDeclarationMapsEnabled() bool

func (*CompilerOptions) GetESModuleInterop

func (options *CompilerOptions) GetESModuleInterop() bool

func (*CompilerOptions) GetEffectiveTypeRoots

func (options *CompilerOptions) GetEffectiveTypeRoots(currentDirectory string) (result []string, fromConfig bool)

func (*CompilerOptions) GetEmitDeclarations

func (options *CompilerOptions) GetEmitDeclarations() bool

func (*CompilerOptions) GetEmitModuleKind

func (options *CompilerOptions) GetEmitModuleKind() ModuleKind

func (*CompilerOptions) GetEmitScriptTarget

func (options *CompilerOptions) GetEmitScriptTarget() ScriptTarget

func (*CompilerOptions) GetEmitStandardClassFields

func (options *CompilerOptions) GetEmitStandardClassFields() bool

func (*CompilerOptions) GetIsolatedModules

func (options *CompilerOptions) GetIsolatedModules() bool

func (*CompilerOptions) GetJSXTransformEnabled

func (options *CompilerOptions) GetJSXTransformEnabled() bool

func (*CompilerOptions) GetModuleResolutionKind

func (options *CompilerOptions) GetModuleResolutionKind() ModuleResolutionKind

func (*CompilerOptions) GetResolveJsonModule

func (options *CompilerOptions) GetResolveJsonModule() bool

func (*CompilerOptions) HasJsonModuleEmitEnabled

func (options *CompilerOptions) HasJsonModuleEmitEnabled() bool

func (*CompilerOptions) ShouldPreserveConstEnums

func (options *CompilerOptions) ShouldPreserveConstEnums() bool

func (*CompilerOptions) SourceFileAffecting

func (options *CompilerOptions) SourceFileAffecting() SourceFileAffectingCompilerOptions

type JsxEmit

type JsxEmit int32
const (
	JsxEmitNone        JsxEmit = 0
	JsxEmitPreserve    JsxEmit = 1
	JsxEmitReactNative JsxEmit = 2
	JsxEmitReact       JsxEmit = 3
	JsxEmitReactJSX    JsxEmit = 4
	JsxEmitReactJSXDev JsxEmit = 5
)

type LanguageVariant

type LanguageVariant int32
const (
	LanguageVariantStandard LanguageVariant = iota
	LanguageVariantJSX
)

func (LanguageVariant) String

func (i LanguageVariant) String() string

type LinkStore

type LinkStore[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*LinkStore[K, V]) Get

func (s *LinkStore[K, V]) Get(key K) *V

func (*LinkStore[K, V]) Has

func (s *LinkStore[K, V]) Has(key K) bool

func (*LinkStore[K, V]) TryGet

func (s *LinkStore[K, V]) TryGet(key K) *V

type ModuleDetectionKind

type ModuleDetectionKind int32
const (
	ModuleDetectionKindNone   ModuleDetectionKind = 0
	ModuleDetectionKindAuto   ModuleDetectionKind = 1
	ModuleDetectionKindLegacy ModuleDetectionKind = 2
	ModuleDetectionKindForce  ModuleDetectionKind = 3
)

type ModuleKind

type ModuleKind int32
const (
	ModuleKindNone     ModuleKind = 0
	ModuleKindCommonJS ModuleKind = 1
	ModuleKindAMD      ModuleKind = 2
	ModuleKindUMD      ModuleKind = 3
	ModuleKindSystem   ModuleKind = 4
	// NOTE: ES module kinds should be contiguous to more easily check whether a module kind is *any* ES module kind.
	//       Non-ES module kinds should not come between ES2015 (the earliest ES module kind) and ESNext (the last ES
	//       module kind).
	ModuleKindES2015 ModuleKind = 5
	ModuleKindES2020 ModuleKind = 6
	ModuleKindES2022 ModuleKind = 7
	ModuleKindESNext ModuleKind = 99
	// Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext
	ModuleKindNode16   ModuleKind = 100
	ModuleKindNodeNext ModuleKind = 199
	// Emit as written
	ModuleKindPreserve ModuleKind = 200
)

func (ModuleKind) String

func (i ModuleKind) String() string

type ModuleResolutionKind

type ModuleResolutionKind int32
const (
	ModuleResolutionKindUnknown ModuleResolutionKind = 0
	// Starting with node16, node's module resolver has significant departures from traditional cjs resolution
	// to better support ECMAScript modules and their use within node - however more features are still being added.
	// TypeScript's Node ESM support was introduced after Node 12 went end-of-life, and Node 14 is the earliest stable
	// version that supports both pattern trailers - *but*, Node 16 is the first version that also supports ECMAScript 2022.
	// In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target
	ModuleResolutionKindNode16   ModuleResolutionKind = 3
	ModuleResolutionKindNodeNext ModuleResolutionKind = 99 // Not simply `Node16` so that compiled code linked against TS can use the `Next` value reliably (same as with `ModuleKind`)
	ModuleResolutionKindBundler  ModuleResolutionKind = 100
)

func (ModuleResolutionKind) String

func (m ModuleResolutionKind) String() string

We don't use stringer on this for now, because these values are user-facing in --traceResolution, and stringer currently lacks the ability to remove the "ModuleResolutionKind" prefix when generating code for multiple types into the same output file. Additionally, since there's no TS equivalent of `ModuleResolutionKindUnknown`, we want to panic on that case, as it probably represents a mistake when porting TS to Go.

type MultiMap

type MultiMap[K comparable, V comparable] struct {
	M map[K][]V
}

func (*MultiMap[K, V]) Add

func (s *MultiMap[K, V]) Add(key K, value V)

func (*MultiMap[K, V]) Clear

func (s *MultiMap[K, V]) Clear()

func (*MultiMap[K, V]) Get

func (s *MultiMap[K, V]) Get(key K) []V

func (*MultiMap[K, V]) Has

func (s *MultiMap[K, V]) Has(key K) bool

func (*MultiMap[K, V]) Keys

func (s *MultiMap[K, V]) Keys() iter.Seq[K]

func (*MultiMap[K, V]) Len

func (s *MultiMap[K, V]) Len() int

func (*MultiMap[K, V]) Remove

func (s *MultiMap[K, V]) Remove(key K, value V)

func (*MultiMap[K, V]) RemoveAll

func (s *MultiMap[K, V]) RemoveAll(key K)

type NewLineKind

type NewLineKind int32
const (
	NewLineKindNone NewLineKind = 0
	NewLineKindCRLF NewLineKind = 1
	NewLineKindLF   NewLineKind = 2
)

func (NewLineKind) GetNewLineCharacter

func (newLine NewLineKind) GetNewLineCharacter() string

type ParsedOptions

type ParsedOptions struct {
	CompilerOptions *CompilerOptions `json:"compilerOptions"`
	WatchOptions    *WatchOptions    `json:"watchOptions"`

	FileNames         []string           `json:"fileNames"`
	ProjectReferences []ProjectReference `json:"projectReferences"`
}

type Pattern

type Pattern struct {
	Text      string
	StarIndex int // -1 for exact match
}

func FindBestPatternMatch

func FindBestPatternMatch(patterns []Pattern, candidate string) Pattern

func TryParsePattern

func TryParsePattern(pattern string) Pattern

func (*Pattern) IsValid

func (p *Pattern) IsValid() bool

func (*Pattern) MatchedText

func (p *Pattern) MatchedText(candidate string) string

func (*Pattern) Matches

func (p *Pattern) Matches(candidate string) bool

type PollingKind

type PollingKind int32
const (
	PollingKindNone             PollingKind = 0
	PollingKindFixedInterval    PollingKind = 1
	PollingKindPriorityInterval PollingKind = 2
	PollingKindDynamicPriority  PollingKind = 3
	PollingKindFixedChunkSize   PollingKind = 4
)

type Pool

type Pool[T any] struct {
	// contains filtered or unexported fields
}

func (*Pool[T]) New

func (p *Pool[T]) New() *T

Allocate a single element in the pool and return a pointer to the element. If the pool is at capacity, a new pool of the next size up is allocated.

func (*Pool[T]) NewSlice

func (p *Pool[T]) NewSlice(size int) []T

Allocate a slice of the given size in the pool. If the requested size is beyond the capacity of the pool and a pool of the next size up still wouldn't fit the slice, make a separate memory allocation for the slice. Otherwise, grow the pool if necessary and allocate a slice out of it. The length and capacity of the resulting slice are equal to the given size.

type ProjectReference

type ProjectReference struct {
	Path         string
	OriginalPath string
	Circular     bool
}

type ResolutionMode

type ResolutionMode = ModuleKind // ModuleKindNone | ModuleKindCommonJS | ModuleKindESNext

type ScriptKind

type ScriptKind int32
const (
	ScriptKindUnknown ScriptKind = iota
	ScriptKindJS
	ScriptKindJSX
	ScriptKindTS
	ScriptKindTSX
	ScriptKindExternal
	ScriptKindJSON
	/**
	 * Used on extensions that doesn't define the ScriptKind but the content defines it.
	 * Deferred extensions are going to be included in all project contexts.
	 */
	ScriptKindDeferred
)

func GetScriptKindFromFileName

func GetScriptKindFromFileName(fileName string) ScriptKind

func (ScriptKind) String

func (i ScriptKind) String() string

type ScriptTarget

type ScriptTarget int32
const (
	ScriptTargetNone   ScriptTarget = 0
	ScriptTargetES3    ScriptTarget = 0 // Deprecated
	ScriptTargetES5    ScriptTarget = 1
	ScriptTargetES2015 ScriptTarget = 2
	ScriptTargetES2016 ScriptTarget = 3
	ScriptTargetES2017 ScriptTarget = 4
	ScriptTargetES2018 ScriptTarget = 5
	ScriptTargetES2019 ScriptTarget = 6
	ScriptTargetES2020 ScriptTarget = 7
	ScriptTargetES2021 ScriptTarget = 8
	ScriptTargetES2022 ScriptTarget = 9
	ScriptTargetES2023 ScriptTarget = 10
	ScriptTargetESNext ScriptTarget = 99
	ScriptTargetJSON   ScriptTarget = 100
	ScriptTargetLatest ScriptTarget = ScriptTargetESNext
)

func (ScriptTarget) String

func (i ScriptTarget) String() string

type Set

type Set[T comparable] struct {
	M map[T]struct{}
}

func NewSetFromItems

func NewSetFromItems[T comparable](items ...T) *Set[T]

func NewSetWithSizeHint

func NewSetWithSizeHint[T comparable](hint int) *Set[T]

NewSetWithSizeHint creates a new Set with a hint for the number of elements it will contain.

func (*Set[T]) Add

func (s *Set[T]) Add(key T)

func (*Set[T]) Clear

func (s *Set[T]) Clear()

func (*Set[T]) Delete

func (s *Set[T]) Delete(key T)

func (*Set[T]) Has

func (s *Set[T]) Has(key T) bool

func (*Set[T]) Keys

func (s *Set[T]) Keys() map[T]struct{}

func (*Set[T]) Len

func (s *Set[T]) Len() int

type SourceFileAffectingCompilerOptions

type SourceFileAffectingCompilerOptions struct {
	// !!! generate this
	Target               ScriptTarget
	Jsx                  JsxEmit
	JsxImportSource      string
	ImportHelpers        Tristate
	AlwaysStrict         Tristate
	ModuleDetection      ModuleDetectionKind
	AllowUnreachableCode Tristate
	AllowUnusedLabels    Tristate
	PreserveConstEnums   Tristate
	IsolatedModules      Tristate
}

SourceFileAffectingCompilerOptions are the CompilerOptions values that when changed require a new SourceFile be created.

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

func (*Stack[T]) Len

func (s *Stack[T]) Len() int

func (*Stack[T]) Peek

func (s *Stack[T]) Peek() T

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

func (*Stack[T]) Push

func (s *Stack[T]) Push(item T)

type TextPos

type TextPos int32

func ComputeLineStarts

func ComputeLineStarts(text string) []TextPos

type TextRange

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

func NewTextRange

func NewTextRange(pos int, end int) TextRange

func UndefinedTextRange

func UndefinedTextRange() TextRange

func (TextRange) Contains

func (t TextRange) Contains(pos int) bool

func (TextRange) ContainsInclusive

func (t TextRange) ContainsInclusive(pos int) bool

func (TextRange) End

func (t TextRange) End() int

func (TextRange) IsValid

func (t TextRange) IsValid() bool

func (TextRange) Len

func (t TextRange) Len() int

func (TextRange) Pos

func (t TextRange) Pos() int

func (TextRange) WithEnd

func (t TextRange) WithEnd(end int) TextRange

func (TextRange) WithPos

func (t TextRange) WithPos(pos int) TextRange

type Tristate

type Tristate byte
const (
	TSUnknown Tristate = iota
	TSFalse
	TSTrue
)

func (Tristate) DefaultIfUnknown

func (t Tristate) DefaultIfUnknown(value Tristate) Tristate

func (Tristate) IsFalse

func (t Tristate) IsFalse() bool

func (Tristate) IsFalseOrUnknown

func (t Tristate) IsFalseOrUnknown() bool

func (Tristate) IsTrue

func (t Tristate) IsTrue() bool

func (Tristate) IsTrueOrUnknown

func (t Tristate) IsTrueOrUnknown() bool

func (Tristate) MarshalJSON

func (t Tristate) MarshalJSON() ([]byte, error)

func (Tristate) String

func (i Tristate) String() string

func (*Tristate) UnmarshalJSON

func (t *Tristate) UnmarshalJSON(data []byte) error

type WatchDirectoryKind

type WatchDirectoryKind int32
const (
	WatchDirectoryKindNone                   WatchDirectoryKind = 0
	WatchDirectoryKindUseFsEvents            WatchDirectoryKind = 1
	WatchDirectoryKindFixedPollingInterval   WatchDirectoryKind = 2
	WatchDirectoryKindDynamicPriorityPolling WatchDirectoryKind = 3
	WatchDirectoryKindFixedChunkSizePolling  WatchDirectoryKind = 4
)

type WatchFileKind

type WatchFileKind int32
const (
	WatchFileKindNone                         WatchFileKind = 0
	WatchFileKindFixedPollingInterval         WatchFileKind = 1
	WatchFileKindPriorityPollingInterval      WatchFileKind = 2
	WatchFileKindDynamicPriorityPolling       WatchFileKind = 3
	WatchFileKindFixedChunkSizePolling        WatchFileKind = 4
	WatchFileKindUseFsEvents                  WatchFileKind = 5
	WatchFileKindUseFsEventsOnParentDirectory WatchFileKind = 6
)

type WatchOptions

type WatchOptions struct {
	Interval        *int               `json:"watchInterval"`
	FileKind        WatchFileKind      `json:"watchFile"`
	DirectoryKind   WatchDirectoryKind `json:"watchDirectory"`
	FallbackPolling PollingKind        `json:"fallbackPolling"`
	SyncWatchDir    Tristate           `json:"synchronousWatchDirectory"`
	ExcludeDir      []string           `json:"excludeDirectories"`
	ExcludeFiles    []string           `json:"excludeFiles"`
}

type WorkGroup

type WorkGroup interface {
	// Queue queues a function to run. It may be invoked immediately, or deferred until RunAndWait.
	// It is not safe to call Queue after RunAndWait has returned.
	Queue(fn func())

	// RunAndWait runs all queued functions, blocking until they have all completed.
	RunAndWait()
}

func NewWorkGroup

func NewWorkGroup(singleThreaded bool) WorkGroup

Jump to

Keyboard shortcuts

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