Documentation ¶
Index ¶
- func AssignNestedScopeSlots(moduleScope *js_ast.Scope, symbols []ast.Symbol) (slotCounts ast.SlotCounts)
- func ComputeReservedNames(moduleScopes []*js_ast.Scope, symbols ast.SymbolMap) map[string]uint32
- type ExportRenamer
- type MinifyRenamer
- func (r *MinifyRenamer) AccumulateSymbolCount(topLevelSymbols *StableSymbolCountArray, ref ast.Ref, count uint32, ...)
- func (r *MinifyRenamer) AccumulateSymbolUseCounts(topLevelSymbols *StableSymbolCountArray, ...)
- func (r *MinifyRenamer) AllocateTopLevelSymbolSlots(topLevelSymbols StableSymbolCountArray)
- func (r *MinifyRenamer) AssignNamesByFrequency(minifier *ast.NameMinifier)
- func (r *MinifyRenamer) NameForSymbol(ref ast.Ref) string
- type NumberRenamer
- type Renamer
- type StableSymbolCount
- type StableSymbolCountArray
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignNestedScopeSlots ¶
func AssignNestedScopeSlots(moduleScope *js_ast.Scope, symbols []ast.Symbol) (slotCounts ast.SlotCounts)
Returns the number of nested slots
Types ¶
type ExportRenamer ¶
type ExportRenamer struct {
// contains filtered or unexported fields
}
func (*ExportRenamer) NextMinifiedName ¶
func (r *ExportRenamer) NextMinifiedName() string
func (*ExportRenamer) NextRenamedName ¶
func (r *ExportRenamer) NextRenamedName(name string) string
type MinifyRenamer ¶
type MinifyRenamer struct {
// contains filtered or unexported fields
}
func NewMinifyRenamer ¶
func NewMinifyRenamer(symbols ast.SymbolMap, firstTopLevelSlots ast.SlotCounts, reservedNames map[string]uint32) *MinifyRenamer
func (*MinifyRenamer) AccumulateSymbolCount ¶
func (r *MinifyRenamer) AccumulateSymbolCount( topLevelSymbols *StableSymbolCountArray, ref ast.Ref, count uint32, stableSourceIndices []uint32, )
func (*MinifyRenamer) AccumulateSymbolUseCounts ¶
func (r *MinifyRenamer) AccumulateSymbolUseCounts( topLevelSymbols *StableSymbolCountArray, symbolUses map[ast.Ref]js_ast.SymbolUse, stableSourceIndices []uint32, )
func (*MinifyRenamer) AllocateTopLevelSymbolSlots ¶ added in v0.11.23
func (r *MinifyRenamer) AllocateTopLevelSymbolSlots(topLevelSymbols StableSymbolCountArray)
The parallel part of the symbol count accumulation algorithm above processes nested symbols and generates an array of top-level symbols to process later. After the parallel part has finished, that array of top-level symbols is passed to this function which processes them in serial.
func (*MinifyRenamer) AssignNamesByFrequency ¶
func (r *MinifyRenamer) AssignNamesByFrequency(minifier *ast.NameMinifier)
func (*MinifyRenamer) NameForSymbol ¶
func (r *MinifyRenamer) NameForSymbol(ref ast.Ref) string
type NumberRenamer ¶
type NumberRenamer struct {
// contains filtered or unexported fields
}
func NewNumberRenamer ¶
func NewNumberRenamer(symbols ast.SymbolMap, reservedNames map[string]uint32) *NumberRenamer
func (*NumberRenamer) AddTopLevelSymbol ¶
func (r *NumberRenamer) AddTopLevelSymbol(ref ast.Ref)
func (*NumberRenamer) AssignNamesByScope ¶
func (r *NumberRenamer) AssignNamesByScope(nestedScopes map[uint32][]*js_ast.Scope)
func (*NumberRenamer) NameForSymbol ¶
func (r *NumberRenamer) NameForSymbol(ref ast.Ref) string
type Renamer ¶
func NewNoOpRenamer ¶
type StableSymbolCount ¶ added in v0.14.15
The InnerIndex should be stable because the parser for a single file is single-threaded and deterministically assigns out InnerIndex values sequentially. But the SourceIndex should be unstable because the main thread assigns out source index values sequentially to newly-discovered dependencies in a multi-threaded producer/consumer relationship. So instead we use the index of the source in the DFS order over all entry points for stability.
type StableSymbolCountArray ¶ added in v0.14.15
type StableSymbolCountArray []StableSymbolCount
This type is just so we can use Go's native sort function
func (StableSymbolCountArray) Len ¶ added in v0.14.15
func (a StableSymbolCountArray) Len() int
func (StableSymbolCountArray) Less ¶ added in v0.14.15
func (a StableSymbolCountArray) Less(i int, j int) bool
func (StableSymbolCountArray) Swap ¶ added in v0.14.15
func (a StableSymbolCountArray) Swap(i int, j int)