Documentation
¶
Overview ¶
Package minifier provides deterministic, scope-aware identifier minification for ELPS source files and parsed programs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadExcludeFile ¶
ReadExcludeFile loads one symbol per line, ignoring blank lines and comment lines that start with ';'.
Types ¶
type Config ¶
type Config struct {
Analysis *analysis.Config
Exclusions map[string]bool
RenameExports bool
PreserveParams bool
PackageSurfaceForms []PackageSurfaceFormSpec
Formatter *formatter.Config
// Warn receives at most one global-name preservation warning per Minify call.
Warn func(string)
}
Config controls minification behavior.
type FileResult ¶
FileResult contains the minified output for one source unit.
type PackageSurfaceFormSpec ¶ added in v1.38.0
PackageSurfaceFormSpec declares a top-level form that creates a stable package-visible binding that should be preserved by default.
type Result ¶
type Result struct {
Files []FileResult
SymbolMap SymbolMap
}
Result contains the outputs of a minify run.
func Minify ¶
Minify rewrites one or more source units using a single deterministic symbol-assignment session. Quoted names (including list and quasiquote data) are preserved across all inputs and recorded as quoted-reference exclusions. Package definitions retain package scope even inside lexical forms. Runtime evaluation or symbol creation disables all renaming across inputs. Unproven package flow preserves package-level names; lexical locals can shorten only when dynamic evaluation is absent. Both fallbacks record their reason.
type SymbolExclusion ¶ added in v1.62.0
SymbolExclusion records a name that cannot be shortened safely.
type SymbolMap ¶
type SymbolMap struct {
Excluded []SymbolExclusion `json:"excluded,omitempty"`
Entries []SymbolMapEntry `json:"entries"`
MinifiedToOriginal map[string]string `json:"minified_to_original"`
OriginalToMinified map[string][]string `json:"original_to_minified,omitempty"`
}
SymbolMap is the machine-readable symbol mapping emitted by a minify run.
func MinifySource ¶
MinifySource is a convenience wrapper for a single source unit.
type SymbolMapEntry ¶
type SymbolMapEntry struct {
Minified string `json:"minified"`
Original string `json:"original"`
Kind string `json:"kind"`
File string `json:"file,omitempty"`
Line int `json:"line,omitempty"`
Col int `json:"col,omitempty"`
}
SymbolMapEntry records one deterministic symbol assignment.