config package - github.com/marvinpeter95/reexporter/config - Go Packages

config

package
v0.0.0-...-30ab92c Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 6 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 {
	Common  Export    `yaml:"common"`  // Common export configuration
	Exports []*Export `yaml:"exports"` // List of export configurations
}

Config represents the overall configuration for the re-exporter.

func FromFile

func FromFile(path string) (*Config, error)

FromFile loads the exporter configuration from the given YAML file.

type Exclusion

type Exclusion struct {
	Types     bool      `yaml:"types"`     // Do not export types
	Variables bool      `yaml:"variables"` // Do not export variables
	Constants bool      `yaml:"constants"` // Do not export constants
	Functions bool      `yaml:"functions"` // Do not export functions
	Names     []Matcher `yaml:"names"`     // Do not export names matching these filters
	Files     []Matcher `yaml:"files"`     // Do not export names from file matching these filters (file name only without extension)
}

Exclusion defines what kinds of symbols to exclude from re-exporting.

type Export

type Export struct {
	Import  string             `yaml:"import"`  // Module import path
	Output  string             `yaml:"output"`  // Output file name
	Exclude Exclusion          `yaml:"exclude"` // Exclusion rules for re-exports
	Rename  map[Matcher]string `yaml:"rename"`  // Rename symbol name during re-export
}

Export represents the export configuration for a specific module.

func (*Export) ExportAs

func (es *Export) ExportAs(name *ast.Ident, exportType ExportType) (string, bool)

ExportAs determines the export name for a given identifier based on the export configuration. It returns the new name and a boolean indicating whether the identifier should be exported.

func (*Export) IncludeFile

func (es *Export) IncludeFile(fileName string) bool

IncludeFile checks if the given file name is allowed based on the exclusion rules. It returns true if the file is included, false if excluded.

type ExportType

type ExportType string
const (
	ExportTypeType     ExportType = "type"
	ExportTypeVariable ExportType = "variable"
	ExportTypeConstant ExportType = "constant"
	ExportTypeFunction ExportType = "function"
)

type Matcher

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

Matcher can match exact text or a regular expression.

Regular expressions must be enclosed in slashes (e.g., /pattern/).

func (*Matcher) Match

func (f *Matcher) Match(s string) bool

Match checks if the given string matches the filter.

func (*Matcher) ReplaceAll

func (f *Matcher) ReplaceAll(s string, replacement string) string

func (*Matcher) UnmarshalText

func (f *Matcher) UnmarshalText(text []byte) error

UnmarshalText unmarshals the filter from text.

type Replacer

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

Filter represents a filter that can match exact text or a regular expression.

Regular expressions must be enclosed in slashes (e.g., /pattern/).

func (*Replacer) Match

func (f *Replacer) Match(s string) bool

Match checks if the given string matches the filter.

func (*Replacer) UnmarshalText

func (f *Replacer) UnmarshalText(text []byte) error

UnmarshalText unmarshals the filter from text.

Jump to

Keyboard shortcuts

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