processor

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Check      bool
	Write      bool
	Recursive  bool
	Extensions []string
	Path       string
	Workers    int
	Verbose    bool
}

Config holds the configuration for processing files

type ProcessResult

type ProcessResult struct {
	Changed         bool
	ObjectsFound    int
	ObjectsNeedSort int
}

ProcessResult contains the result of processing a file

func ProcessFileAST

func ProcessFileAST(filePath string, config Config) (ProcessResult, error)

ProcessFileAST processes a file using full AST analysis

type Processor added in v1.3.0

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

Processor handles the complete sorting workflow for TypeScript/TSX files

func NewProcessor added in v1.3.0

func NewProcessor() *Processor

NewProcessor creates a new processor with all dependencies

func (*Processor) ProcessContent added in v1.3.0

func (p *Processor) ProcessContent(content []byte) ([]byte, error)

ProcessContent processes TypeScript/TSX content and returns sorted result

func (*Processor) ProcessFile added in v1.3.0

func (p *Processor) ProcessFile(filename string, content []byte) ([]byte, error)

ProcessFile is a convenience method that reads, processes, and could write back a file

type PropertyLine

type PropertyLine struct {
	Content string
	Key     string
}

type SortConfig

type SortConfig struct {
	WithNewLine     bool
	DeprecatedAtEnd bool
	Key             string // For array sorting
	SortByComment   bool   // Sort by comment content
	HasError        bool   // Indicates a validation error (e.g., key + sort-by-comment)
}

SortConfig contains configuration options from the magic comment

Jump to

Keyboard shortcuts

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