plugin

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ProtocolVersion uint32 = 1

Variables

This section is empty.

Functions

func Run

func Run(opts PluginOptions)

Types

type ExpectErrorDirectiveMapping

type ExpectErrorDirectiveMapping struct {
	SourceOffset  uint32
	ServiceOffset uint32
	SourceLength  uint32
	ServiceLength uint32
}

type Extension added in v0.0.13

type Extension struct {
	// Example: ".vue" (include the leading dot)
	Extension                    string `json:"extension"`
	StripFromDeclarationFileName bool   `json:"stripFromDeclarationFileName"`
	AllowExtensionlessImports    bool   `json:"allowExtensionlessImports"`
}

type IgnoreDirectiveMapping

type IgnoreDirectiveMapping struct {
	ServiceOffset uint32
	ServiceLength uint32
}

type InitializationMessage

type InitializationMessage struct {
	ProtocolVersion uint32      `json:"protocolVersion"`
	Extensions      []Extension `json:"extensions"`
}

type Mapping

type Mapping struct {
	SourceOffset  uint32
	ServiceOffset uint32
	SourceLength  uint32
	ServiceLength uint32
}

func SourceMapToMappings

func SourceMapToMappings(sourceText string, serviceText string, sourceMap string) []Mapping

type MsgKind

type MsgKind uint8
const (
	MsgKindCreateServiceCode MsgKind = iota
	MsgKindCreateServiceCodeResponse
)

type PluginInstance

type PluginInstance struct {
	CreateServiceCode func(cwd, configFileName, fileName string, sourceText string) *ServiceCode
}

type PluginOptions

type PluginOptions struct {
	Input      io.Reader
	Output     io.Writer
	Extensions []Extension
	Setup      func() PluginInstance
}

type ScriptKind

type ScriptKind uint8
const (
	ScriptKindJS ScriptKind = iota
	ScriptKindJSX
	ScriptKindTS
	ScriptKindTSX
)

type ServiceCode

type ServiceCode struct {
	Errors                     []ServiceCodeError
	ServiceText                []byte
	ScriptKind                 ScriptKind
	Mappings                   []Mapping
	IgnoreMappings             []IgnoreDirectiveMapping
	ExpectErrorMappings        []ExpectErrorDirectiveMapping
	DeclarationFile            bool
	IgnoreNotMappedDiagnostics bool
}

type ServiceCodeError

type ServiceCodeError struct {
	Message string
	Start   int
	End     int
}

type ServiceCodeProperties

type ServiceCodeProperties uint8
const (
	ServiceCodePropertiesError ServiceCodeProperties = 1 << iota
	ServiceCodePropertiesDeclarationFile
	ServiceCodePropertiesIgnoreNotMappedDiagnostics
)

Jump to

Keyboard shortcuts

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