package helpers
import "github.com/evanw/esbuild/internal/helpers"
Index ¶
- func ContainsNonBMPCodePoint(text string) bool
- func ContainsNonBMPCodePointUTF16(text []uint16) bool
- func DecodeWTF8Rune(s string) (rune, int)
- func EncodeStringAsPercentEscapedDataURL(mimeType string, text string) (string, bool)
- func EscapeClosingTag(text string, slashTag string) string
- func HashCombine(seed uint32, hash uint32) uint32
- func HashCombineString(seed uint32, text string) uint32
- func IsInsideNodeModules(path string) bool
- func MimeTypeByExtension(ext string) string
- func PrettyPrintedStack() string
- func QuoteForJSON(text string, asciiOnly bool) []byte
- func QuoteSingle(text string, asciiOnly bool) []byte
- func StringArrayToQuotedCommaSeparatedString(a []string) string
- func StringArraysEqual(a []string, b []string) bool
- func StringSlicesAreEqual(a []string, b []string) bool
- func StringToUTF16(text string) []uint16
- func UTF16EqualsString(text []uint16, str string) bool
- func UTF16EqualsUTF16(a []uint16, b []uint16) bool
- func UTF16ToString(text []uint16) string
- func UTF16ToStringWithValidation(text []uint16) (string, uint16, bool)
- type BitSet
- func NewBitSet(bitCount uint) BitSet
- func (bs BitSet) Equals(other BitSet) bool
- func (bs BitSet) HasBit(bit uint) bool
- func (bs BitSet) SetBit(bit uint)
- func (bs BitSet) String() string
- type Joiner
- func (j *Joiner) AddBytes(data []byte)
- func (j *Joiner) AddString(data string)
- func (j *Joiner) Contains(s string, b []byte) bool
- func (j *Joiner) Done() []byte
- func (j *Joiner) EnsureNewlineAtEnd()
- func (j *Joiner) LastByte() byte
- func (j *Joiner) Length() uint32
- type Serializer
- func MakeSerializer(count int) Serializer
- func (s *Serializer) Enter(i int)
- func (s *Serializer) Leave(i int)
- type ThreadSafeWaitGroup
- func MakeThreadSafeWaitGroup() *ThreadSafeWaitGroup
- func (wg *ThreadSafeWaitGroup) Add(delta int32)
- func (wg *ThreadSafeWaitGroup) Done()
- func (wg *ThreadSafeWaitGroup) Wait()
- type Timer
- func (t *Timer) Begin(name string)
- func (t *Timer) End(name string)
- func (t *Timer) Fork() *Timer
- func (t *Timer) Join(other *Timer)
- func (t *Timer) Log(log logger.Log)
- type TypoDetector
Functions ¶
func ContainsNonBMPCodePoint ¶
func ContainsNonBMPCodePointUTF16 ¶
This does "ContainsNonBMPCodePoint(UTF16ToString(text))" without any allocations
func DecodeWTF8Rune ¶
This is a clone of "utf8.DecodeRuneInString" that has been modified to decode using WTF-8 instead. See https://simonsapin.github.io/wtf-8/ for more info.
func EncodeStringAsPercentEscapedDataURL ¶
See "scripts/dataurl-escapes.html" for how this was derived
func EscapeClosingTag ¶
func HashCombine ¶
From: http://boost.sourceforge.net/doc/html/boost/hash_combine.html
func HashCombineString ¶
func IsInsideNodeModules ¶
func MimeTypeByExtension ¶
This is used instead of Go's built-in "mime.TypeByExtension" function because that function is broken on Windows: https://github.com/golang/go/issues/32350.
func PrettyPrintedStack ¶
func PrettyPrintedStack() string
func QuoteForJSON ¶
func QuoteSingle ¶
func StringArrayToQuotedCommaSeparatedString ¶
func StringArraysEqual ¶
func StringSlicesAreEqual ¶
func StringToUTF16 ¶
func UTF16EqualsString ¶
Does "UTF16ToString(text) == str" without a temporary allocation
func UTF16EqualsUTF16 ¶
func UTF16ToString ¶
func UTF16ToStringWithValidation ¶
Types ¶
type BitSet ¶
type BitSet struct {
// contains filtered or unexported fields
}
func NewBitSet ¶
func (BitSet) Equals ¶
func (BitSet) HasBit ¶
func (BitSet) SetBit ¶
func (BitSet) String ¶
type Joiner ¶
type Joiner struct {
// contains filtered or unexported fields
}
This provides an efficient way to join lots of big string and byte slices together. It avoids the cost of repeatedly reallocating as the buffer grows by measuring exactly how big the buffer should be and then allocating once. This is a measurable speedup.
func (*Joiner) AddBytes ¶
func (*Joiner) AddString ¶
func (*Joiner) Contains ¶
func (*Joiner) Done ¶
func (*Joiner) EnsureNewlineAtEnd ¶
func (j *Joiner) EnsureNewlineAtEnd()
func (*Joiner) LastByte ¶
func (*Joiner) Length ¶
type Serializer ¶
type Serializer struct {
// contains filtered or unexported fields
}
Each call to "Enter(i)" doesn't start until "Leave(i-1)" is called
func MakeSerializer ¶
func MakeSerializer(count int) Serializer
func (*Serializer) Enter ¶
func (s *Serializer) Enter(i int)
func (*Serializer) Leave ¶
func (s *Serializer) Leave(i int)
type ThreadSafeWaitGroup ¶
type ThreadSafeWaitGroup struct {
// contains filtered or unexported fields
}
Go's "sync.WaitGroup" is not thread-safe. Specifically it's not safe to call "Add" concurrently with "Wait", which is problematic because we have a case where we would like to do that.
This is a simple alternative implementation of "sync.WaitGroup" that is thread-safe and that works for our purposes. We don't need to worry about multiple waiters so the implementation can be very simple.
func MakeThreadSafeWaitGroup ¶
func MakeThreadSafeWaitGroup() *ThreadSafeWaitGroup
func (*ThreadSafeWaitGroup) Add ¶
func (wg *ThreadSafeWaitGroup) Add(delta int32)
func (*ThreadSafeWaitGroup) Done ¶
func (wg *ThreadSafeWaitGroup) Done()
func (*ThreadSafeWaitGroup) Wait ¶
func (wg *ThreadSafeWaitGroup) Wait()
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
func (*Timer) Begin ¶
func (*Timer) End ¶
func (*Timer) Fork ¶
func (*Timer) Join ¶
func (*Timer) Log ¶
type TypoDetector ¶
type TypoDetector struct {
// contains filtered or unexported fields
}
func MakeTypoDetector ¶
func MakeTypoDetector(valid []string) TypoDetector
func (TypoDetector) MaybeCorrectTypo ¶
func (detector TypoDetector) MaybeCorrectTypo(typo string) (string, bool)
Source Files ¶
bitset.go comment.go dataurl.go hash.go joiner.go mime.go path.go quote.go serializer.go slice.go stack.go strings.go timer.go typos.go utf.go waitgroup.go
- Version
- v0.17.9
- Published
- Feb 19, 2023
- Platform
- windows/amd64
- Imports
- 9 packages
- Last checked
- 2 minutes ago –
Tools for package owners.