generatecmd

package
v0.3.819 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 35 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileWriter added in v0.2.731

func FileWriter(fileName string, contents []byte) error

func Run

func Run(ctx context.Context, log *slog.Logger, args Arguments) (err error)

Types

type Arguments added in v0.0.164

type Arguments struct {
	FileName                        string
	FileWriter                      FileWriterFunc
	Path                            string
	Watch                           bool
	WatchPattern                    string
	OpenBrowser                     bool
	Command                         string
	ProxyBind                       string
	ProxyPort                       int
	Proxy                           string
	NotifyProxy                     bool
	WorkerCount                     int
	GenerateSourceMapVisualisations bool
	IncludeVersion                  bool
	IncludeTimestamp                bool
	// PPROFPort is the port to run the pprof server on.
	PPROFPort         int
	KeepOrphanedFiles bool
	Lazy              bool
}

type FSEventHandler added in v0.2.590

type FSEventHandler struct {
	Log *slog.Logger

	Errors []error
	// contains filtered or unexported fields
}

func NewFSEventHandler added in v0.2.590

func NewFSEventHandler(
	log *slog.Logger,
	dir string,
	devMode bool,
	genOpts []generator.GenerateOpt,
	genSourceMapVis bool,
	keepOrphanedFiles bool,
	fileWriter FileWriterFunc,
	lazy bool,
) *FSEventHandler

func (*FSEventHandler) HandleEvent added in v0.2.590

func (h *FSEventHandler) HandleEvent(ctx context.Context, event fsnotify.Event) (result GenerateResult, err error)

func (*FSEventHandler) SetError added in v0.2.590

func (h *FSEventHandler) SetError(fileName string, hasError bool) (previouslyHadError bool, errorCount int)

func (*FSEventHandler) UpsertHash added in v0.2.590

func (h *FSEventHandler) UpsertHash(fileName string, hash [sha256.Size]byte) (updated bool)

func (*FSEventHandler) UpsertLastModTime added in v0.2.590

func (h *FSEventHandler) UpsertLastModTime(fileName string) (modTime time.Time, updated bool)

type FatalError added in v0.2.590

type FatalError struct {
	Err error
}

func (FatalError) As added in v0.2.590

func (e FatalError) As(target interface{}) bool

func (FatalError) Error added in v0.2.590

func (e FatalError) Error() string

func (FatalError) Is added in v0.2.590

func (e FatalError) Is(target error) bool

func (FatalError) Unwrap added in v0.2.590

func (e FatalError) Unwrap() error

type FileWriterFunc added in v0.2.731

type FileWriterFunc func(name string, contents []byte) error

func WriterFileWriter added in v0.2.731

func WriterFileWriter(w io.Writer) FileWriterFunc

type Generate added in v0.2.590

type Generate struct {
	Log          *slog.Logger
	Args         *Arguments
	WatchPattern *regexp.Regexp
}

func NewGenerate added in v0.2.590

func NewGenerate(log *slog.Logger, args Arguments) (g *Generate, err error)

func (Generate) Run added in v0.2.590

func (cmd Generate) Run(ctx context.Context) (err error)

func (*Generate) StartProxy added in v0.2.590

func (cmd *Generate) StartProxy(ctx context.Context) (p *proxy.Handler, err error)

type GenerateResult added in v0.3.819

type GenerateResult struct {
	// Updated indicates that the file was updated.
	Updated bool
	// GoUpdated indicates that Go expressions were updated.
	GoUpdated bool
	// TextUpdated indicates that text literals were updated.
	TextUpdated bool
}

type GenerationEvent added in v0.2.590

type GenerationEvent struct {
	Event       fsnotify.Event
	Updated     bool
	GoUpdated   bool
	TextUpdated bool
}

Directories

Path Synopsis
run

Jump to

Keyboard shortcuts

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