tsoptions

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: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Libs        = slices.Collect(libMap.Keys())
	LibFilesSet = core.NewSetFromItems(core.Map(slices.Collect(libMap.Values()), func(s any) string { return s.(string) })...)
)
View Source
var (
	CompilerNameMap = GetNameMapFromList(OptionsDeclarations)
	BuildNameMap    = GetNameMapFromList(BuildOpts)
	WatchNameMap    = GetNameMapFromList(optionsForWatch)
)
View Source
var BuildOpts = slices.Concat(commonOptionsWithBuild, optionsForBuild)
View Source
var CompilerOptionsDidYouMeanDiagnostics = getParseCommandLineWorkerDiagnostics(OptionsDeclarations)
View Source
var OptionsDeclarations = slices.Concat(commonOptionsWithBuild, optionsForCompiler)

Functions

func GetDefaultLibFileName

func GetDefaultLibFileName(options *core.CompilerOptions) string

func GetLibFileName

func GetLibFileName(libName string) (string, bool)

func GetSupportedExtensions

func GetSupportedExtensions(options *core.CompilerOptions, extraFileExtensions []fileExtensionInfo) [][]string

func GetSupportedExtensionsWithJsonIfResolveJsonModule

func GetSupportedExtensionsWithJsonIfResolveJsonModule(options *core.CompilerOptions, supportedExtensions [][]string) [][]string

func ParseCompilerOptions

func ParseCompilerOptions(key string, value any, allOptions *core.CompilerOptions) []*ast.Diagnostic

func ParseConfigFileTextToJson

func ParseConfigFileTextToJson(fileName string, path tspath.Path, jsonText string) (any, []*ast.Diagnostic)

ParseConfigFileTextToJson parses the text of the tsconfig.json file fileName is the path to the config file jsonText is the text of the config file

func ParseListTypeOption

func ParseListTypeOption(opt *CommandLineOption, value string) ([]string, []*ast.Diagnostic)

func ParseWatchOptions

func ParseWatchOptions(key string, value any, allOptions *core.WatchOptions) []*ast.Diagnostic

func TryReadFile

func TryReadFile(fileName string, readFile func(string) (string, bool), errors []*ast.Diagnostic) (string, []*ast.Diagnostic)

Types

type AlternateModeDiagnostics

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

type CommandLineOption

type CommandLineOption struct {
	Name string
	Kind CommandLineOptionKind

	IsTSConfigOnly    bool
	IsCommandLineOnly bool

	// used in output
	Description             *diagnostics.Message
	DefaultValueDescription any

	// used in output in serializing and generate tsconfig
	Category *diagnostics.Message

	// used for filter in compilerrunner
	AffectsDeclarationPath     bool
	AffectsProgramStructure    bool
	AffectsSemanticDiagnostics bool
	AffectsBuildInfo           bool
	AffectsBindDiagnostics     bool
	AffectsSourceFile          bool
	AffectsModuleResolution    bool
	AffectsEmit                bool

	// used for compilerOptionsDeclaration
	ElementOptions map[string]*CommandLineOption
	// contains filtered or unexported fields
}

func (*CommandLineOption) DeprecatedKeys

func (o *CommandLineOption) DeprecatedKeys() *core.Set[string]

func (*CommandLineOption) DisallowNullOrUndefined

func (o *CommandLineOption) DisallowNullOrUndefined() bool

func (*CommandLineOption) Elements

func (o *CommandLineOption) Elements() *CommandLineOption

func (*CommandLineOption) EnumMap

type CommandLineOptionKind

type CommandLineOptionKind string
const (
	CommandLineOptionTypeString        CommandLineOptionKind = "string"
	CommandLineOptionTypeNumber        CommandLineOptionKind = "number"
	CommandLineOptionTypeBoolean       CommandLineOptionKind = "boolean"
	CommandLineOptionTypeObject        CommandLineOptionKind = "object"
	CommandLineOptionTypeList          CommandLineOptionKind = "list"
	CommandLineOptionTypeListOrElement CommandLineOptionKind = "listOrElement"
	CommandLineOptionTypeEnum          CommandLineOptionKind = "enum" // map
)

type CompilerOptionsValue

type CompilerOptionsValue any

todo: revisit to see if this can be improved

type DidYouMeanOptionsDiagnostics

type DidYouMeanOptionsDiagnostics struct {
	OptionDeclarations          []*CommandLineOption
	UnknownOptionDiagnostic     *diagnostics.Message
	UnknownDidYouMeanDiagnostic *diagnostics.Message
	// contains filtered or unexported fields
}

type ExtendedConfigCacheEntry

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

type FileMatcherPatterns

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

type NameMap

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

func GetNameMapFromList

func GetNameMapFromList(optDecls []*CommandLineOption) *NameMap

func (*NameMap) Get

func (nm *NameMap) Get(name string) *CommandLineOption

func (*NameMap) GetFromShort

func (nm *NameMap) GetFromShort(shortName string) *CommandLineOption

func (*NameMap) GetOptionDeclarationFromName

func (nm *NameMap) GetOptionDeclarationFromName(optionName string, allowShort bool) *CommandLineOption

type ParseCommandLineWorkerDiagnostics

type ParseCommandLineWorkerDiagnostics struct {
	OptionTypeMismatchDiagnostic *diagnostics.Message
	// contains filtered or unexported fields
}

type ParseConfigHost

type ParseConfigHost interface {
	FS() vfs.FS
	GetCurrentDirectory() string
}

type ParsedCommandLine

type ParsedCommandLine struct {
	ParsedConfig *core.ParsedOptions `json:"parsedConfig"`

	ConfigFile *TsConfigSourceFile `json:"configFile"` // TsConfigSourceFile, used in Program and ExecuteCommandLine
	Errors     []*ast.Diagnostic   `json:"errors"`
	Raw        any                 `json:"raw"`
	// WildcardDirectories map[string]watchDirectoryFlags
	CompileOnSave *bool `json:"compileOnSave"`
}

func ParseCommandLine

func ParseCommandLine(
	commandLine []string,
	host ParseConfigHost,
) *ParsedCommandLine

func ParseJsonConfigFileContent

func ParseJsonConfigFileContent(json any, host ParseConfigHost, basePath string, existingOptions *core.CompilerOptions, configFileName string, resolutionStack []tspath.Path, extraFileExtensions []fileExtensionInfo, extendedConfigCache map[tspath.Path]*ExtendedConfigCacheEntry) *ParsedCommandLine

ParseJsonConfigFileContent parses the contents of a config file (tsconfig.json). jsonNode: The contents of the config file to parse host: Instance of ParseConfigHost used to enumerate files in folder. basePath: A root directory to resolve relative path entries in the config file to. e.g. outDir

func ParseJsonSourceFileConfigFileContent

func ParseJsonSourceFileConfigFileContent(sourceFile *TsConfigSourceFile, host ParseConfigHost, basePath string, existingOptions *core.CompilerOptions, configFileName string, resolutionStack []tspath.Path, extraFileExtensions []fileExtensionInfo, extendedConfigCache map[tspath.Path]*ExtendedConfigCacheEntry) *ParsedCommandLine

func (*ParsedCommandLine) CompilerOptions

func (p *ParsedCommandLine) CompilerOptions() *core.CompilerOptions

func (*ParsedCommandLine) FileNames

func (p *ParsedCommandLine) FileNames() []string

func (*ParsedCommandLine) GetConfigFileParsingDiagnostics

func (p *ParsedCommandLine) GetConfigFileParsingDiagnostics() []*ast.Diagnostic

func (*ParsedCommandLine) ProjectReferences

func (p *ParsedCommandLine) ProjectReferences() []core.ProjectReference

func (*ParsedCommandLine) SetCompilerOptions

func (p *ParsedCommandLine) SetCompilerOptions(o *core.CompilerOptions)

func (*ParsedCommandLine) SetParsedOptions

func (p *ParsedCommandLine) SetParsedOptions(o *core.ParsedOptions)

type TsConfigSourceFile

type TsConfigSourceFile struct {
	SourceFile *ast.SourceFile
	// contains filtered or unexported fields
}

func NewTsconfigSourceFileFromFilePath

func NewTsconfigSourceFileFromFilePath(configFileName string, configPath tspath.Path, configSourceText string) *TsConfigSourceFile

type WildcardMatcher

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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