Documentation
¶
Index ¶
- Constants
- Variables
- func AppendIfUnique[T comparable](slice []T, element T) []T
- func ApplyBulkEdits(text string, edits []TextChange) string
- func BinarySearchUniqueFunc[S ~[]E, E any](x S, cmp func(int, E) int) (int, bool)
- func CheckEachDefined[S any](s []*S, msg string) []*S
- func Coalesce[T *U, U any](a T, b T) T
- func ComputeECMALineStartsSeq(text string) iter.Seq[TextPos]
- func Concatenate[T any](s1 []T, s2 []T) []T
- func ConcatenateSeq[T any](seqs ...iter.Seq[T]) iter.Seq[T]
- func CopyMapInto[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) map[K]V
- func CountWhere[T any](slice []T, f func(T) bool) int
- func Deduplicate[T comparable](slice []T) []T
- func DeduplicateSorted[T any](slice []T, isEqual func(a, b T) bool) []T
- func DiffMaps[K comparable, V comparable](m1 map[K]V, m2 map[K]V, onAdded func(K, V), onRemoved func(K, V), ...)
- func DiffMapsFunc[K comparable, V any](m1 map[K]V, m2 map[K]V, equalValues func(V, V) bool, onAdded func(K, V), ...)
- func ElementOrNil[T any](slice []T, index int) T
- func Every[T any](slice []T, f func(T) bool) bool
- func Filter[T any](slice []T, f func(T) bool) []T
- func FilterIndex[T any](slice []T, f func(T, int, []T) bool) []T
- func Find[T any](slice []T, f func(T) bool) T
- func FindBestPatternMatch[T any](values []T, getPattern func(v T) Pattern, candidate string) T
- func FindIndex[T any](slice []T, f func(T) bool) int
- func FindLast[T any](slice []T, f func(T) bool) T
- func FindLastIndex[T any](slice []T, f func(T) bool) int
- func FirstNonNil[T any, U comparable](slice []T, f func(T) U) U
- func FirstOrNil[T any](slice []T) T
- func FirstOrNilSeq[T any](seq iter.Seq[T]) T
- func FirstResult[T1 any](t1 T1, _ ...any) T1
- func FlatMap[T any, U comparable](slice []T, f func(T) []U) []U
- func Flatten[T any](array [][]T) []T
- func GetLocale(ctx context.Context) language.Tag
- func GetRequestID(ctx context.Context) string
- func GetSpellingSuggestion[T any](name string, candidates []T, getName func(T) string) T
- func Identity[T any](t T) T
- func IfElse[T any](b bool, whenTrue T, whenFalse T) T
- func IndexAfter(s string, pattern string, startIndex int) int
- func InsertSorted[T any](slice []T, element T, cmp func(T, T) int) []T
- func LastOrNil[T any](slice []T) T
- func Map[T, U any](slice []T, f func(T) U) []U
- func MapFiltered[T any, U any](slice []T, f func(T) (U, bool)) []U
- func MapIndex[T, U any](slice []T, f func(T, int) U) []U
- func MapNonNil[T any, U comparable](slice []T, f func(T) U) []U
- func Memoize[T any](create func() T) func() T
- func Must[T any](v T, err error) T
- func NonRelativeModuleNameForTypingCache(moduleName string) string
- func Or[T any](funcs ...func(T) bool) func(T) bool
- func OrElse[T comparable](value T, defaultValue T) T
- func PositionToLineAndCharacter(position int, lineStarts []TextPos) (line int, character int)
- func ReplaceElement[T any](slice []T, i int, t T) []T
- func ResolveConfigFileNameOfProjectReference(path string) string
- func ResolveProjectReferencePath(ref *ProjectReference) string
- func Same[T any](s1 []T, s2 []T) bool
- func SameMap[T comparable](slice []T, f func(T) T) []T
- func SameMapIndex[T comparable](slice []T, f func(T, int) T) []T
- func ShouldRewriteModuleSpecifier(specifier string, compilerOptions *CompilerOptions) bool
- func SingleElementSlice[T any](element *T) []*T
- func Some[T any](slice []T, f func(T) bool) bool
- func Splice[T any](s1 []T, start int, deleteCount int, items ...T) []T
- func StringifyJson(input any, prefix string, indent string) (string, error)
- func TryMap[T, U any](slice []T, f func(T) (U, error)) ([]U, error)
- func Version() string
- func VersionMajorMinor() string
- func WithLocale(ctx context.Context, locale language.Tag) context.Context
- func WithRequestID(ctx context.Context, id string) context.Context
- type BreadthFirstSearchLevel
- type BreadthFirstSearchOptions
- type BreadthFirstSearchResult
- func BreadthFirstSearchParallel[N comparable](start N, neighbors func(N) []N, visit func(node N) (isResult bool, stop bool)) BreadthFirstSearchResult[N]
- func BreadthFirstSearchParallelEx[K comparable, N any](start N, neighbors func(N) []N, visit func(node N) (isResult bool, stop bool), ...) BreadthFirstSearchResult[N]
- type BuildOptions
- type CompilerOptions
- func (options *CompilerOptions) AllowImportingTsExtensionsFrom(fileName string) bool
- func (options *CompilerOptions) Clone() *CompilerOptions
- func (options *CompilerOptions) GetAllowImportingTsExtensions() bool
- func (options *CompilerOptions) GetAllowJS() bool
- func (options *CompilerOptions) GetAllowSyntheticDefaultImports() bool
- func (options *CompilerOptions) GetAreDeclarationMapsEnabled() bool
- func (options *CompilerOptions) GetESModuleInterop() bool
- func (options *CompilerOptions) GetEffectiveTypeRoots(currentDirectory string) (result []string, fromConfig bool)
- func (options *CompilerOptions) GetEmitDeclarations() bool
- func (options *CompilerOptions) GetEmitModuleDetectionKind() ModuleDetectionKind
- func (options *CompilerOptions) GetEmitModuleKind() ModuleKind
- func (options *CompilerOptions) GetEmitScriptTarget() ScriptTarget
- func (options *CompilerOptions) GetEmitStandardClassFields() bool
- func (options *CompilerOptions) GetIsolatedModules() bool
- func (options *CompilerOptions) GetJSXTransformEnabled() bool
- func (options *CompilerOptions) GetModuleResolutionKind() ModuleResolutionKind
- func (options *CompilerOptions) GetPathsBasePath(currentDirectory string) string
- func (options *CompilerOptions) GetResolveJsonModule() bool
- func (options *CompilerOptions) GetResolvePackageJsonExports() bool
- func (options *CompilerOptions) GetResolvePackageJsonImports() bool
- func (options *CompilerOptions) GetStrictOptionValue(value Tristate) bool
- func (options *CompilerOptions) HasJsonModuleEmitEnabled() bool
- func (options *CompilerOptions) IsIncremental() bool
- func (options *CompilerOptions) ShouldPreserveConstEnums() bool
- func (options *CompilerOptions) SourceFileAffecting() SourceFileAffectingCompilerOptions
- type ECMALineStarts
- type JsxEmit
- type LanguageVariant
- type LinkStore
- type ModuleDetectionKind
- type ModuleKind
- type ModuleResolutionKind
- type NewLineKind
- type ParsedOptions
- type Pattern
- type PollingKind
- type Pool
- type ProjectReference
- type ResolutionMode
- type ScriptKind
- type ScriptTarget
- type SourceFileAffectingCompilerOptions
- type Stack
- type TextChange
- type TextPos
- type TextRange
- func (t TextRange) ContainedBy(t2 TextRange) bool
- func (t TextRange) Contains(pos int) bool
- func (t TextRange) ContainsExclusive(pos int) bool
- func (t TextRange) ContainsInclusive(pos int) bool
- func (t TextRange) End() int
- func (t TextRange) IsValid() bool
- func (t TextRange) Len() int
- func (t TextRange) Overlaps(t2 TextRange) bool
- func (t TextRange) Pos() int
- func (t TextRange) WithEnd(end int) TextRange
- func (t TextRange) WithPos(pos int) TextRange
- type ThrottleGroup
- type Tristate
- func (t Tristate) DefaultIfUnknown(value Tristate) Tristate
- func (t Tristate) IsFalse() bool
- func (t Tristate) IsFalseOrUnknown() bool
- func (t Tristate) IsTrue() bool
- func (t Tristate) IsTrueOrUnknown() bool
- func (t Tristate) IsUnknown() bool
- func (t Tristate) MarshalJSON() ([]byte, error)
- func (i Tristate) String() string
- func (t *Tristate) UnmarshalJSON(data []byte) error
- type TypeAcquisition
- type WatchDirectoryKind
- type WatchFileKind
- type WatchOptions
- type WorkGroup
Constants ¶
const ( ResolutionModeNone = ModuleKindNone ResolutionModeCommonJS = ModuleKindCommonJS ResolutionModeESM = ModuleKindESNext )
Variables ¶
var ExclusivelyPrefixedNodeCoreModules = map[string]bool{ "node:sea": true, "node:sqlite": true, "node:test": true, "node:test/reporters": true, }
var ModuleKindToModuleResolutionKind = map[ModuleKind]ModuleResolutionKind{ ModuleKindNode16: ModuleResolutionKindNode16, ModuleKindNodeNext: ModuleResolutionKindNodeNext, }
var NodeCoreModules = sync.OnceValue(func() map[string]bool { nodeCoreModules := make(map[string]bool, len(UnprefixedNodeCoreModules)*2+len(ExclusivelyPrefixedNodeCoreModules)) for unprefixed := range UnprefixedNodeCoreModules { nodeCoreModules[unprefixed] = true nodeCoreModules["node:"+unprefixed] = true } maps.Copy(nodeCoreModules, ExclusivelyPrefixedNodeCoreModules) return nodeCoreModules })
var UnprefixedNodeCoreModules = map[string]bool{ "assert": true, "assert/strict": true, "async_hooks": true, "buffer": true, "child_process": true, "cluster": true, "console": true, "constants": true, "crypto": true, "dgram": true, "diagnostics_channel": true, "dns": true, "dns/promises": true, "domain": true, "events": true, "fs": true, "fs/promises": true, "http": true, "http2": true, "https": true, "inspector": true, "inspector/promises": true, "module": true, "net": true, "os": true, "path": true, "path/posix": true, "path/win32": true, "perf_hooks": true, "process": true, "punycode": true, "querystring": true, "readline": true, "readline/promises": true, "repl": true, "stream": true, "stream/consumers": true, "stream/promises": true, "stream/web": true, "string_decoder": true, "sys": true, "test/mock_loader": true, "timers": true, "timers/promises": true, "tls": true, "trace_events": true, "tty": true, "url": true, "util": true, "util/types": true, "v8": true, "vm": true, "wasi": true, "worker_threads": true, "zlib": true, }
Functions ¶
func AppendIfUnique ¶
func AppendIfUnique[T comparable](slice []T, element T) []T
func ApplyBulkEdits ¶
func ApplyBulkEdits(text string, edits []TextChange) string
func BinarySearchUniqueFunc ¶
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 CheckEachDefined ¶
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 Concatenate ¶
func Concatenate[T any](s1 []T, s2 []T) []T
func CopyMapInto ¶
func CopyMapInto[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2) map[K]V
CopyMapInto is maps.Copy, unless dst is nil, in which case it clones and returns src. Use CopyMapInto anywhere you would use maps.Copy preceded by a nil check and map initialization.
func CountWhere ¶
func Deduplicate ¶
func Deduplicate[T comparable](slice []T) []T
func DeduplicateSorted ¶
func DiffMaps ¶
func DiffMaps[K comparable, V comparable](m1 map[K]V, m2 map[K]V, onAdded func(K, V), onRemoved func(K, V), onChanged func(K, V, V))
func DiffMapsFunc ¶
func DiffMapsFunc[K comparable, V any](m1 map[K]V, m2 map[K]V, equalValues func(V, V) bool, onAdded func(K, V), onRemoved func(K, V), onChanged func(K, V, V))
func ElementOrNil ¶
func FilterIndex ¶
func FindBestPatternMatch ¶
func FindLastIndex ¶
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 FirstResult ¶
Extracts the first value of a multi-value return.
func FlatMap ¶
func FlatMap[T any, U comparable](slice []T, f func(T) []U) []U
func GetRequestID ¶
func GetSpellingSuggestion ¶
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 IfElse ¶
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 MapFiltered ¶
func MapNonNil ¶
func MapNonNil[T any, U comparable](slice []T, f func(T) U) []U
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 ReplaceElement ¶
func ResolveProjectReferencePath ¶
func ResolveProjectReferencePath(ref *ProjectReference) string
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 ShouldRewriteModuleSpecifier ¶
func ShouldRewriteModuleSpecifier(specifier string, compilerOptions *CompilerOptions) bool
func SingleElementSlice ¶
func SingleElementSlice[T any](element *T) []*T
func VersionMajorMinor ¶
func VersionMajorMinor() string
Types ¶
type BreadthFirstSearchLevel ¶
type BreadthFirstSearchLevel[K comparable, N any] struct { // contains filtered or unexported fields }
func (*BreadthFirstSearchLevel[K, N]) Delete ¶
func (l *BreadthFirstSearchLevel[K, N]) Delete(key K)
func (*BreadthFirstSearchLevel[K, N]) Has ¶
func (l *BreadthFirstSearchLevel[K, N]) Has(key K) bool
func (*BreadthFirstSearchLevel[K, N]) Range ¶
func (l *BreadthFirstSearchLevel[K, N]) Range(f func(node N) bool)
type BreadthFirstSearchOptions ¶
type BreadthFirstSearchOptions[K comparable, N any] struct { // Visited is a set of nodes that have already been visited. // If nil, a new set will be created. Visited *collections.SyncSet[K] // PreprocessLevel is a function that, if provided, will be called // before each level, giving the caller an opportunity to remove nodes. PreprocessLevel func(*BreadthFirstSearchLevel[K, N]) }
type BreadthFirstSearchResult ¶
func BreadthFirstSearchParallel ¶
func BreadthFirstSearchParallel[N comparable]( start N, neighbors func(N) []N, visit func(node N) (isResult bool, stop bool), ) BreadthFirstSearchResult[N]
BreadthFirstSearchParallel performs a breadth-first search on a graph starting from the given node. It processes nodes in parallel and returns the path from the first node that satisfies the `visit` function back to the start node.
func BreadthFirstSearchParallelEx ¶
func BreadthFirstSearchParallelEx[K comparable, N any]( start N, neighbors func(N) []N, visit func(node N) (isResult bool, stop bool), options BreadthFirstSearchOptions[K, N], getKey func(N) K, ) BreadthFirstSearchResult[N]
BreadthFirstSearchParallelEx is an extension of BreadthFirstSearchParallel that allows the caller to pass a pre-seeded set of already-visited nodes and a preprocessing function that can be used to remove nodes from each level before parallel processing.
type BuildOptions ¶
type BuildOptions struct { Dry Tristate `json:"dry,omitzero"` Force Tristate `json:"force,omitzero"` Verbose Tristate `json:"verbose,omitzero"` StopBuildOnErrors Tristate `json:"stopBuildOnErrors,omitzero"` // Internal fields Clean Tristate `json:"clean,omitzero"` // contains filtered or unexported fields }
type CompilerOptions ¶
type CompilerOptions struct { AllowJs Tristate `json:"allowJs,omitzero"` AllowArbitraryExtensions Tristate `json:"allowArbitraryExtensions,omitzero"` AllowSyntheticDefaultImports Tristate `json:"allowSyntheticDefaultImports,omitzero"` AllowImportingTsExtensions Tristate `json:"allowImportingTsExtensions,omitzero"` AllowNonTsExtensions Tristate `json:"allowNonTsExtensions,omitzero"` AllowUmdGlobalAccess Tristate `json:"allowUmdGlobalAccess,omitzero"` AllowUnreachableCode Tristate `json:"allowUnreachableCode,omitzero"` AllowUnusedLabels Tristate `json:"allowUnusedLabels,omitzero"` AssumeChangesOnlyAffectDirectDependencies Tristate `json:"assumeChangesOnlyAffectDirectDependencies,omitzero"` AlwaysStrict Tristate `json:"alwaysStrict,omitzero"` CheckJs Tristate `json:"checkJs,omitzero"` CustomConditions []string `json:"customConditions,omitzero"` Composite Tristate `json:"composite,omitzero"` EmitDeclarationOnly Tristate `json:"emitDeclarationOnly,omitzero"` EmitBOM Tristate `json:"emitBOM,omitzero"` EmitDecoratorMetadata Tristate `json:"emitDecoratorMetadata,omitzero"` DownlevelIteration Tristate `json:"downlevelIteration,omitzero"` Declaration Tristate `json:"declaration,omitzero"` DeclarationDir string `json:"declarationDir,omitzero"` DeclarationMap Tristate `json:"declarationMap,omitzero"` DisableSizeLimit Tristate `json:"disableSizeLimit,omitzero"` DisableSourceOfProjectReferenceRedirect Tristate `json:"disableSourceOfProjectReferenceRedirect,omitzero"` DisableSolutionSearching Tristate `json:"disableSolutionSearching,omitzero"` DisableReferencedProjectLoad Tristate `json:"disableReferencedProjectLoad,omitzero"` ErasableSyntaxOnly Tristate `json:"erasableSyntaxOnly,omitzero"` ESModuleInterop Tristate `json:"esModuleInterop,omitzero"` ExactOptionalPropertyTypes Tristate `json:"exactOptionalPropertyTypes,omitzero"` ExperimentalDecorators Tristate `json:"experimentalDecorators,omitzero"` ForceConsistentCasingInFileNames Tristate `json:"forceConsistentCasingInFileNames,omitzero"` IsolatedModules Tristate `json:"isolatedModules,omitzero"` IsolatedDeclarations Tristate `json:"isolatedDeclarations,omitzero"` IgnoreDeprecations string `json:"ignoreDeprecations,omitzero"` ImportHelpers Tristate `json:"importHelpers,omitzero"` InlineSourceMap Tristate `json:"inlineSourceMap,omitzero"` InlineSources Tristate `json:"inlineSources,omitzero"` Init Tristate `json:"init,omitzero"` Incremental Tristate `json:"incremental,omitzero"` Jsx JsxEmit `json:"jsx,omitzero"` JsxFactory string `json:"jsxFactory,omitzero"` JsxFragmentFactory string `json:"jsxFragmentFactory,omitzero"` JsxImportSource string `json:"jsxImportSource,omitzero"` Lib []string `json:"lib,omitzero"` LibReplacement Tristate `json:"libReplacement,omitzero"` Locale string `json:"locale,omitzero"` MapRoot string `json:"mapRoot,omitzero"` Module ModuleKind `json:"module,omitzero"` ModuleResolution ModuleResolutionKind `json:"moduleResolution,omitzero"` ModuleSuffixes []string `json:"moduleSuffixes,omitzero"` ModuleDetection ModuleDetectionKind `json:"moduleDetection,omitzero"` NewLine NewLineKind `json:"newLine,omitzero"` NoEmit Tristate `json:"noEmit,omitzero"` NoCheck Tristate `json:"noCheck,omitzero"` NoErrorTruncation Tristate `json:"noErrorTruncation,omitzero"` NoFallthroughCasesInSwitch Tristate `json:"noFallthroughCasesInSwitch,omitzero"` NoImplicitAny Tristate `json:"noImplicitAny,omitzero"` NoImplicitThis Tristate `json:"noImplicitThis,omitzero"` NoImplicitReturns Tristate `json:"noImplicitReturns,omitzero"` NoEmitHelpers Tristate `json:"noEmitHelpers,omitzero"` NoLib Tristate `json:"noLib,omitzero"` NoPropertyAccessFromIndexSignature Tristate `json:"noPropertyAccessFromIndexSignature,omitzero"` NoUncheckedIndexedAccess Tristate `json:"noUncheckedIndexedAccess,omitzero"` NoEmitOnError Tristate `json:"noEmitOnError,omitzero"` NoUnusedLocals Tristate `json:"noUnusedLocals,omitzero"` NoUnusedParameters Tristate `json:"noUnusedParameters,omitzero"` NoResolve Tristate `json:"noResolve,omitzero"` NoImplicitOverride Tristate `json:"noImplicitOverride,omitzero"` NoUncheckedSideEffectImports Tristate `json:"noUncheckedSideEffectImports,omitzero"` OutDir string `json:"outDir,omitzero"` Paths *collections.OrderedMap[string, []string] `json:"paths,omitzero"` PreserveConstEnums Tristate `json:"preserveConstEnums,omitzero"` PreserveSymlinks Tristate `json:"preserveSymlinks,omitzero"` Project string `json:"project,omitzero"` ResolveJsonModule Tristate `json:"resolveJsonModule,omitzero"` ResolvePackageJsonExports Tristate `json:"resolvePackageJsonExports,omitzero"` ResolvePackageJsonImports Tristate `json:"resolvePackageJsonImports,omitzero"` RemoveComments Tristate `json:"removeComments,omitzero"` RewriteRelativeImportExtensions Tristate `json:"rewriteRelativeImportExtensions,omitzero"` ReactNamespace string `json:"reactNamespace,omitzero"` RootDir string `json:"rootDir,omitzero"` RootDirs []string `json:"rootDirs,omitzero"` SkipLibCheck Tristate `json:"skipLibCheck,omitzero"` Strict Tristate `json:"strict,omitzero"` StrictBindCallApply Tristate `json:"strictBindCallApply,omitzero"` StrictBuiltinIteratorReturn Tristate `json:"strictBuiltinIteratorReturn,omitzero"` StrictFunctionTypes Tristate `json:"strictFunctionTypes,omitzero"` StrictNullChecks Tristate `json:"strictNullChecks,omitzero"` StrictPropertyInitialization Tristate `json:"strictPropertyInitialization,omitzero"` StripInternal Tristate `json:"stripInternal,omitzero"` SkipDefaultLibCheck Tristate `json:"skipDefaultLibCheck,omitzero"` SourceMap Tristate `json:"sourceMap,omitzero"` SourceRoot string `json:"sourceRoot,omitzero"` SuppressOutputPathCheck Tristate `json:"suppressOutputPathCheck,omitzero"` Target ScriptTarget `json:"target,omitzero"` TraceResolution Tristate `json:"traceResolution,omitzero"` TsBuildInfoFile string `json:"tsBuildInfoFile,omitzero"` TypeRoots []string `json:"typeRoots,omitzero"` Types []string `json:"types,omitzero"` UseDefineForClassFields Tristate `json:"useDefineForClassFields,omitzero"` UseUnknownInCatchVariables Tristate `json:"useUnknownInCatchVariables,omitzero"` VerbatimModuleSyntax Tristate `json:"verbatimModuleSyntax,omitzero"` MaxNodeModuleJsDepth *int `json:"maxNodeModuleJsDepth,omitzero"` // Deprecated: Do not use outside of options parsing and validation. BaseUrl string `json:"baseUrl,omitzero"` // Deprecated: Do not use outside of options parsing and validation. OutFile string `json:"outFile,omitzero"` // Internal fields ConfigFilePath string `json:"configFilePath,omitzero"` NoDtsResolution Tristate `json:"noDtsResolution,omitzero"` PathsBasePath string `json:"pathsBasePath,omitzero"` Diagnostics Tristate `json:"diagnostics,omitzero"` ExtendedDiagnostics Tristate `json:"extendedDiagnostics,omitzero"` GenerateCpuProfile string `json:"generateCpuProfile,omitzero"` GenerateTrace string `json:"generateTrace,omitzero"` ListEmittedFiles Tristate `json:"listEmittedFiles,omitzero"` ListFiles Tristate `json:"listFiles,omitzero"` ExplainFiles Tristate `json:"explainFiles,omitzero"` ListFilesOnly Tristate `json:"listFilesOnly,omitzero"` NoEmitForJsFiles Tristate `json:"noEmitForJsFiles,omitzero"` PreserveWatchOutput Tristate `json:"preserveWatchOutput,omitzero"` Pretty Tristate `json:"pretty,omitzero"` Version Tristate `json:"version,omitzero"` Watch Tristate `json:"watch,omitzero"` ShowConfig Tristate `json:"showConfig,omitzero"` Build Tristate `json:"build,omitzero"` Help Tristate `json:"help,omitzero"` All Tristate `json:"all,omitzero"` PprofDir string `json:"pprofDir,omitzero"` SingleThreaded Tristate `json:"singleThreaded,omitzero"` Quiet Tristate `json:"quiet,omitzero"` // contains filtered or unexported fields }
func (*CompilerOptions) AllowImportingTsExtensionsFrom ¶
func (options *CompilerOptions) AllowImportingTsExtensionsFrom(fileName string) bool
func (*CompilerOptions) Clone ¶
func (options *CompilerOptions) Clone() *CompilerOptions
Clone creates a shallow copy of the CompilerOptions.
func (*CompilerOptions) GetAllowImportingTsExtensions ¶
func (options *CompilerOptions) GetAllowImportingTsExtensions() bool
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) GetEmitModuleDetectionKind ¶
func (options *CompilerOptions) GetEmitModuleDetectionKind() ModuleDetectionKind
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) GetPathsBasePath ¶
func (options *CompilerOptions) GetPathsBasePath(currentDirectory string) string
func (*CompilerOptions) GetResolveJsonModule ¶
func (options *CompilerOptions) GetResolveJsonModule() bool
func (*CompilerOptions) GetResolvePackageJsonExports ¶
func (options *CompilerOptions) GetResolvePackageJsonExports() bool
func (*CompilerOptions) GetResolvePackageJsonImports ¶
func (options *CompilerOptions) GetResolvePackageJsonImports() bool
func (*CompilerOptions) GetStrictOptionValue ¶
func (options *CompilerOptions) GetStrictOptionValue(value Tristate) bool
func (*CompilerOptions) HasJsonModuleEmitEnabled ¶
func (options *CompilerOptions) HasJsonModuleEmitEnabled() bool
func (*CompilerOptions) IsIncremental ¶
func (options *CompilerOptions) IsIncremental() bool
func (*CompilerOptions) ShouldPreserveConstEnums ¶
func (options *CompilerOptions) ShouldPreserveConstEnums() bool
func (*CompilerOptions) SourceFileAffecting ¶
func (options *CompilerOptions) SourceFileAffecting() SourceFileAffectingCompilerOptions
type ECMALineStarts ¶
type ECMALineStarts []TextPos
func ComputeECMALineStarts ¶
func ComputeECMALineStarts(text string) ECMALineStarts
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 }
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 // Deprecated: Do not use outside of options parsing and validation. ModuleKindAMD ModuleKind = 2 // Deprecated: Do not use outside of options parsing and validation. ModuleKindUMD ModuleKind = 3 // Deprecated: Do not use outside of options parsing and validation. 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 ModuleKindNode18 ModuleKind = 101 ModuleKindNode20 ModuleKind = 102 ModuleKindNodeNext ModuleKind = 199 // Emit as written ModuleKindPreserve ModuleKind = 200 )
func (ModuleKind) IsNonNodeESM ¶
func (moduleKind ModuleKind) IsNonNodeESM() bool
func (ModuleKind) String ¶
func (i ModuleKind) String() string
func (ModuleKind) SupportsImportAttributes ¶
func (moduleKind ModuleKind) SupportsImportAttributes() bool
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 NewLineKind ¶
type NewLineKind int32
const ( NewLineKindNone NewLineKind = 0 NewLineKindCRLF NewLineKind = 1 NewLineKindLF NewLineKind = 2 )
func GetNewLineKind ¶
func GetNewLineKind(s string) NewLineKind
func (NewLineKind) GetNewLineCharacter ¶
func (newLine NewLineKind) GetNewLineCharacter() string
type ParsedOptions ¶
type ParsedOptions struct { CompilerOptions *CompilerOptions `json:"compilerOptions"` WatchOptions *WatchOptions `json:"watchOptions"` TypeAcquisition *TypeAcquisition `json:"typeAcquisition"` FileNames []string `json:"fileNames"` ProjectReferences []*ProjectReference `json:"projectReferences"` }
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 ¶
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 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 ScriptTargetES2024 ScriptTarget = 11 ScriptTargetESNext ScriptTarget = 99 ScriptTargetJSON ScriptTarget = 100 ScriptTargetLatest ScriptTarget = ScriptTargetESNext )
func (ScriptTarget) String ¶
func (i ScriptTarget) String() string
type SourceFileAffectingCompilerOptions ¶
type SourceFileAffectingCompilerOptions struct { AllowUnreachableCode Tristate AllowUnusedLabels Tristate BindInStrictMode bool ShouldPreserveConstEnums bool }
SourceFileAffectingCompilerOptions are the precomputed CompilerOptions values which affect the parse and bind of a source file.
type TextChange ¶
func (TextChange) ApplyTo ¶
func (t TextChange) ApplyTo(text string) string
type TextRange ¶
type TextRange struct {
// contains filtered or unexported fields
}
func NewTextRange ¶
func UndefinedTextRange ¶
func UndefinedTextRange() TextRange
func (TextRange) ContainedBy ¶
func (TextRange) ContainsExclusive ¶
func (TextRange) ContainsInclusive ¶
type ThrottleGroup ¶
type ThrottleGroup struct {
// contains filtered or unexported fields
}
ThrottleGroup is like errgroup.Group but with global concurrency limiting via a semaphore.
func NewThrottleGroup ¶
func NewThrottleGroup(ctx context.Context, semaphore chan struct{}) *ThrottleGroup
NewThrottleGroup creates a new ThrottleGroup with the given context and semaphore for concurrency limiting.
func (*ThrottleGroup) Go ¶
func (tg *ThrottleGroup) Go(fn func() error)
Go runs the given function in a new goroutine, but first acquires a slot from the semaphore. The semaphore slot is released when the function completes.
func (*ThrottleGroup) Wait ¶
func (tg *ThrottleGroup) Wait() error
Wait waits for all goroutines to complete and returns the first error encountered, if any.
type Tristate ¶
type Tristate byte
func BoolToTristate ¶
func (Tristate) DefaultIfUnknown ¶
func (Tristate) IsFalseOrUnknown ¶
func (Tristate) IsTrueOrUnknown ¶
func (Tristate) MarshalJSON ¶
func (*Tristate) UnmarshalJSON ¶
type TypeAcquisition ¶
type TypeAcquisition struct { Enable Tristate `json:"enable,omitzero"` Include []string `json:"include,omitzero"` Exclude []string `json:"exclude,omitzero"` DisableFilenameBasedTypeAcquisition Tristate `json:"disableFilenameBasedTypeAcquisition,omitzero"` }
func (*TypeAcquisition) Equals ¶
func (ta *TypeAcquisition) Equals(other *TypeAcquisition) bool
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"` }
func (*WatchOptions) WatchInterval ¶
func (w *WatchOptions) WatchInterval() time.Duration
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 ¶
Source Files
¶
- bfs.go
- binarysearch.go
- buildoptions.go
- compileroptions.go
- context.go
- core.go
- languagevariant.go
- languagevariant_stringer_generated.go
- linkstore.go
- modulekind_stringer_generated.go
- nodemodules.go
- parsedoptions.go
- pattern.go
- pool.go
- projectreference.go
- scriptkind.go
- scriptkind_stringer_generated.go
- scripttarget_stringer_generated.go
- stack.go
- text.go
- textchange.go
- tristate.go
- tristate_stringer_generated.go
- typeacquisition.go
- version.go
- watchoptions.go
- workgroup.go