repo stringlengths 6 47 | file_url stringlengths 77 269 | file_path stringlengths 5 186 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-07 08:35:43 2026-01-07 08:55:24 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/helpers/serializer.go | internal/helpers/serializer.go | package helpers
import "sync"
// Each call to "Enter(i)" doesn't start until "Leave(i-1)" is called
type Serializer struct {
flags []sync.WaitGroup
}
func MakeSerializer(count int) Serializer {
flags := make([]sync.WaitGroup, count)
for i := 0; i < count; i++ {
flags[i].Add(1)
}
return Serializer{flags: flags... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/helpers/dataurl.go | internal/helpers/dataurl.go | package helpers
import (
"encoding/base64"
"fmt"
"strings"
"unicode/utf8"
)
// Returns the shorter of either a base64-encoded or percent-escaped data URL
func EncodeStringAsShortestDataURL(mimeType string, text string) string {
encoded := base64.StdEncoding.EncodeToString([]byte(text))
url := fmt.Sprintf("data:... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/helpers/float.go | internal/helpers/float.go | package helpers
import "math"
// This wraps float64 math operations. Why does this exist? The Go compiler
// contains some optimizations to take advantage of "fused multiply and add"
// (FMA) instructions on certain processors. These instructions lead to
// different output on those processors, which means esbuild's ... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/helpers/dataurl_test.go | internal/helpers/dataurl_test.go | package helpers_test
import (
"fmt"
"testing"
"github.com/evanw/esbuild/internal/helpers"
)
func TestEncodeDataURL(t *testing.T) {
check := func(raw string, expected string) {
url, ok := helpers.EncodeStringAsPercentEscapedDataURL("text/plain", raw)
if !ok {
t.Fatalf("Failed to encode %q", raw)
} else i... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/helpers/utf.go | internal/helpers/utf.go | package helpers
import (
"strings"
"unicode/utf8"
)
func ContainsNonBMPCodePoint(text string) bool {
for _, c := range text {
if c > 0xFFFF {
return true
}
}
return false
}
// This does "ContainsNonBMPCodePoint(UTF16ToString(text))" without any allocations
func ContainsNonBMPCodePointUTF16(text []uint16)... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/helpers/typos.go | internal/helpers/typos.go | package helpers
import "unicode/utf8"
type TypoDetector struct {
oneCharTypos map[string]string
}
func MakeTypoDetector(valid []string) TypoDetector {
detector := TypoDetector{oneCharTypos: make(map[string]string)}
// Add all combinations of each valid word with one character missing
for _, correct := range val... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/graph/meta.go | internal/graph/meta.go | package graph
// The code in this file represents data that is required by the compile phase
// of the bundler but that is not required by the scan phase.
import (
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbui... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/graph/input.go | internal/graph/input.go | package graph
// The code in this file mainly represents data that passes from the scan phase
// to the compile phase of the bundler. There is currently one exception: the
// "meta" member of the JavaScript file representation. That could have been
// stored separately but is stored together for convenience and to avo... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/graph/graph.go | internal/graph/graph.go | package graph
// This graph represents the set of files that the linker operates on. Each
// linker has a separate one of these graphs (there is one linker when code
// splitting is on, but one linker per entry point when code splitting is off).
//
// The input data to the linker constructor must be considered immutab... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_lexer/tables.go | internal/js_lexer/tables.go | package js_lexer
var tokenToString = map[T]string{
TEndOfFile: "end of file",
TSyntaxError: "syntax error",
THashbang: "hashbang comment",
// Literals
TNoSubstitutionTemplateLiteral: "template literal",
TNumericLiteral: "number",
TStringLiteral: "string",
TBigIntegerLiteral... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_lexer/js_lexer.go | internal/js_lexer/js_lexer.go | package js_lexer
// The lexer converts a source file to a stream of tokens. Unlike many
// compilers, esbuild does not run the lexer to completion before the parser is
// started. Instead, the lexer is called repeatedly by the parser as the parser
// parses the file. This is because many tokens are context-sensitive a... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_lexer/js_lexer_test.go | internal/js_lexer/js_lexer_test.go | package js_lexer
import (
"fmt"
"math"
"strings"
"testing"
"unicode/utf8"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/logger"
"github.com/evanw/esbuild/internal/test"
)
func assertEqualStrings(t *testing.T, a string, b string) {
... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_parser/ts_parser.go | internal/js_parser/ts_parser.go | // This file contains code for parsing TypeScript syntax. The parser just skips
// over type expressions as if they are whitespace and doesn't bother generating
// an AST because nothing uses type information.
package js_parser
import (
"fmt"
"strings"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/es... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_parser/js_parser_lower.go | internal/js_parser/js_parser_lower.go | // This file contains code for "lowering" syntax, which means converting it to
// older JavaScript. For example, "a ** b" becomes a call to "Math.pow(a, b)"
// when lowered. Which syntax is lowered is determined by the language target.
package js_parser
import (
"fmt"
"github.com/evanw/esbuild/internal/ast"
"gith... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_parser/sourcemap_parser.go | internal/js_parser/sourcemap_parser.go | package js_parser
import (
"fmt"
"net/url"
"sort"
"strings"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbuild/internal/logger"
"github.com/evanw/esbuild/internal/sourcemap"
)
// New specification: https://... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_parser/js_parser_lower_class.go | internal/js_parser/js_parser_lower_class.go | package js_parser
import (
"fmt"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbuild/internal/logger"
)
func (p *parser) pr... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_parser/js_parser_lower_test.go | internal/js_parser/js_parser_lower_test.go | package js_parser
import (
"fmt"
"testing"
"github.com/evanw/esbuild/internal/compat"
)
func TestLowerFunctionArgumentScope(t *testing.T) {
templates := []string{
"(x = %s) => {\n};\n",
"(function(x = %s) {\n});\n",
"function foo(x = %s) {\n}\n",
"({ [%s]: x }) => {\n};\n",
"(function({ [%s]: x }) {\n... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_parser/json_parser.go | internal/js_parser/json_parser.go | package js_parser
import (
"fmt"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbuild/internal/js_lexer"
"github.com/evanw/esbuild/internal/logger"
)
type jsonParser struct {
log l... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_parser/js_parser_test.go | internal/js_parser/js_parser_test.go | package js_parser
import (
"fmt"
"strings"
"testing"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbuild/internal/js_print... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_parser/global_name_parser.go | internal/js_parser/global_name_parser.go | package js_parser
import (
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_lexer"
"github.com/evanw/esbuild/internal/logger"
)
func ParseGlobalName(log logger.Log, source logger.Source) (result []string, ok bool) {
ok = true
defer func() {
r := recover()
if _, isLexerPanic :... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_parser/json_parser_test.go | internal/js_parser/json_parser_test.go | package js_parser
import (
"fmt"
"strings"
"testing"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbuild/internal/js_printer"
"github.com/evanw/esbuild/internal/logger"
"github.com/evanw/esbuild/internal/test"
)
func expectParseErrorJSON(t *testing.T, ... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_parser/ts_parser_test.go | internal/js_parser/ts_parser_test.go | package js_parser
import (
"testing"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/config"
)
func expectParseErrorTS(t *testing.T, contents string, expected string) {
t.Helper()
expectParseErrorCommon(t, contents, expected, config.Options{
TS: config.TSOptions{
Parse: true,
... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_parser/js_parser.go | internal/js_parser/js_parser.go | package js_parser
import (
"fmt"
"math"
"math/big"
"regexp"
"sort"
"strings"
"unicode/utf8"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/cli_helpers/cli_helpers.go | internal/cli_helpers/cli_helpers.go | // This package contains internal CLI-related code that must be shared with
// other internal code outside of the CLI package.
package cli_helpers
import (
"fmt"
"github.com/evanw/esbuild/pkg/api"
)
type ErrorWithNote struct {
Text string
Note string
}
func MakeErrorWithNote(text string, note string) *ErrorWit... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/test/util.go | internal/test/util.go | package test
import (
"fmt"
"testing"
"github.com/evanw/esbuild/internal/fs"
"github.com/evanw/esbuild/internal/logger"
)
func AssertEqual(t *testing.T, observed interface{}, expected interface{}) {
t.Helper()
if observed != expected {
t.Fatalf("%s != %s", observed, expected)
}
}
func AssertEqualWithDiff(t... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/test/diff.go | internal/test/diff.go | package test
import (
"fmt"
"strings"
"github.com/evanw/esbuild/internal/logger"
)
func diff(old string, new string, color bool) string {
return strings.Join(diffRec(nil, strings.Split(old, "\n"), strings.Split(new, "\n"), color), "\n")
}
// This is a simple recursive line-by-line diff implementation
func diffR... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/runtime/runtime_test.go | internal/runtime/runtime_test.go | package runtime_test
import (
"testing"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/js_parser"
"github.com/evanw/esbuild/internal/logger"
"github.com/evanw/esbuild/internal/runtime"
)
func TestUnsupportedFeatures(t *testing.T) {
for ... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/runtime/runtime.go | internal/runtime/runtime.go | package runtime
// This is esbuild's runtime code. It contains helper functions that are
// automatically injected into output files to implement certain features. For
// example, the "**" operator is replaced with a call to "__pow" when targeting
// ES2015. Tree shaking automatically removes unused code from the runt... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/linker/debug.go | internal/linker/debug.go | package linker
import (
"fmt"
"strings"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/graph"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
)
// Set this to true and then load the resulting metafile in "graph-debugger.html"
// to debug graph ... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/linker/linker.go | internal/linker/linker.go | package linker
// This package implements the second phase of the bundling operation that
// generates the output files when given a module graph. It has been split off
// into separate package to allow two linkers to cleanly exist in the same code
// base. This will be useful when rewriting the linker because the new... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/sourcemap/sourcemap.go | internal/sourcemap/sourcemap.go | package sourcemap
import (
"bytes"
"strings"
"unicode/utf8"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/logger"
)
type Mapping struct {
GeneratedLine int32 // 0-based
GeneratedColumn int32 // 0-based count of UTF-16 code units
Sou... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/resolver/yarnpnp_test.go | internal/resolver/yarnpnp_test.go | package resolver
import (
"encoding/json"
"fmt"
"io/ioutil"
"strings"
"testing"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/fs"
"github.com/evanw/esbuild/internal/js_parser"
"github.com/evanw/esbuild/internal/logger"
"github.com/evanw/esbuild/internal/test"
)
type pnpTestE... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/resolver/tsconfig_json.go | internal/resolver/tsconfig_json.go | package resolver
import (
"fmt"
"strings"
"github.com/evanw/esbuild/internal/cache"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/fs"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbuild/internal/js_lexer"
"github.com... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/resolver/resolver.go | internal/resolver/resolver.go | package resolver
import (
"errors"
"fmt"
"path"
"regexp"
"sort"
"strings"
"sync"
"syscall"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/cache"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/fs"
"githu... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/resolver/package_json.go | internal/resolver/package_json.go | package resolver
import (
"fmt"
"net/url"
"path"
"regexp"
"sort"
"strings"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbuild/internal/js_lexer"
"github.com/evanw/esbuild/internal/js_parser"
"github.co... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/resolver/dataurl.go | internal/resolver/dataurl.go | package resolver
import (
"encoding/base64"
"fmt"
"net/url"
"strings"
)
type DataURL struct {
mimeType string
data string
isBase64 bool
}
func ParseDataURL(url string) (parsed DataURL, ok bool) {
if strings.HasPrefix(url, "data:") {
if comma := strings.IndexByte(url, ','); comma != -1 {
parsed.mimeT... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/resolver/yarnpnp.go | internal/resolver/yarnpnp.go | package resolver
// This file implements the Yarn PnP specification: https://yarnpkg.com/advanced/pnp-spec/
import (
"fmt"
"path"
"regexp"
"strings"
"syscall"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbuild/internal/js_parser"
"github.com/evan... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_color_spaces.go | internal/css_parser/css_color_spaces.go | package css_parser
import (
"math"
"github.com/evanw/esbuild/internal/helpers"
)
// Wrap float64 math to avoid compiler optimizations that break determinism
type F64 = helpers.F64
// Reference: https://drafts.csswg.org/css-color/#color-conversion-code
type colorSpace uint8
const (
colorSpace_a98_rgb colorSpace... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_gradient.go | internal/css_parser/css_decls_gradient.go | package css_parser
import (
"fmt"
"math"
"strconv"
"strings"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/logger"
)
type gradientKind uint8
... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_font_family.go | internal/css_parser/css_decls_font_family.go | package css_parser
import (
"strings"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
)
// These keywords usually require special handling when parsing.
// Declaring a property to have these values explicitly specifies a particular
// defaulting behavior instead of setti... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_container.go | internal/css_parser/css_decls_container.go | package css_parser
import (
"strings"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
)
// Scan for container names in the "container" shorthand property
func (p *parser) processContainerShorthand(tokens []css_ast.Token) {
// Validate the syntax
for i, t := range tokens... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_animation.go | internal/css_parser/css_decls_animation.go | package css_parser
import (
"strings"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
)
// Scan for animation names in the "animation" shorthand property
func (p *parser) processAnimationShorthand(tokens []css_ast.Token) {
type foundFlags struct {
timingFunction bool
... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_parser.go | internal/css_parser/css_parser.go | package css_parser
import (
"fmt"
"strings"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/internal/logger"
)
// T... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_parser_media.go | internal/css_parser/css_parser_media.go | package css_parser
import (
"strings"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/internal/logger"
)
// Reference: https://drafts.csswg.org/mediaqueries-4/
func (p *parser) parseMediaQueryListUntil... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_transform.go | internal/css_parser/css_decls_transform.go | package css_parser
import (
"strings"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
)
func turnPercentIntoNumberIfShorter(t *css_ast.Token) {
if t.Kind == css_lexer.TPercentage {
if shifted, ok := shiftDot(t.PercentageValue(), -2); ok && len(shifted) < len(t.Text) {
... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_list_style.go | internal/css_parser/css_decls_list_style.go | package css_parser
import (
"strings"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
)
// list-style-image: <image> | none
// <image>: <url> | <gradient>
// <url>: <url()> | <src()>
// <gradient>: <linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> ... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_border_radius.go | internal/css_parser/css_decls_border_radius.go | package css_parser
import (
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/internal/logger"
)
const (
borderRadiusTopLeft = iota
borderRadiusTopRight
borderRadiusBottomRight
borderRadiusBottomLeft
)
type borderRadiusCorner struct {
firstTok... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_parser_selector.go | internal/css_parser/css_parser_selector.go | package css_parser
import (
"fmt"
"strings"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/internal/logger"
)
type parseSelectorOpts struct {
composesContext *composesContext
pseudoClassKind css_ast.PseudoClassKind
isDeclara... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_nesting.go | internal/css_parser/css_nesting.go | package css_parser
import (
"fmt"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/logger"
)
func (p *parser) lowerNestingInRule(rule css_ast.Rule, results []css_ast.Rule) []css_ast.Rule {
switch r := rule.Data.(type) {
case *css_ast.RSel... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_parser_test.go | internal/css_parser/css_parser_test.go | package css_parser
import (
"fmt"
"strings"
"testing"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/css_printer"
"github.com/evanw/esbuild/internal/logger"
"github.com/evanw/esbuild/internal/tes... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_color.go | internal/css_parser/css_decls_color.go | package css_parser
import (
"fmt"
"math"
"strconv"
"strings"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/internal/helpers"
)
// These names are shorter than their hex codes
var shortColorName = ... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_box_shadow.go | internal/css_parser/css_decls_box_shadow.go | package css_parser
import (
"strings"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
)
func (p *parser) lowerAndMangleBoxShadow(tokens []css_ast.Token, wouldClipColor *bool) []css_ast.Token {
insetCount := 0
colorCount := 0
numbersBegin := 0
numbersCount := 0
number... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_composes.go | internal/css_parser/css_decls_composes.go | package css_parser
import (
"fmt"
"strings"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/internal/logger"
)
type composesContext struct {
parentRefs []ast.Ref
parentRange logger.Range
problemRan... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_box.go | internal/css_parser/css_decls_box.go | package css_parser
import (
"strings"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/internal/logger"
)
const (
boxTop = iota
boxRight
boxBottom
boxLeft
)
type boxSide struct {
token css_ast.Token
unitSafety unitSafetyTracker
... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls.go | internal/css_parser/css_decls.go | package css_parser
import (
"strings"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/internal/logger"
)
func (p *parser) commaToken(loc logger.Loc) css_ast.Token {
t := css_ast.Token{
Loc: loc,
... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_reduce_calc.go | internal/css_parser/css_reduce_calc.go | package css_parser
import (
"fmt"
"math"
"strconv"
"strings"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/internal/logger"
)
func (p *parser) tryToReduceCalcExpression(token css_ast.Token) css_ast.Token {
if term := tryToParseCalcTerm(*to... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_font_weight.go | internal/css_parser/css_decls_font_weight.go | package css_parser
import (
"strings"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
)
func (p *parser) mangleFontWeight(token css_ast.Token) css_ast.Token {
if token.Kind != css_lexer.TIdent {
return token
}
switch strings.ToLower(token.Text) {
case "normal":
t... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_parser/css_decls_font.go | internal/css_parser/css_decls_font.go | package css_parser
import (
"strconv"
"strings"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
)
// Specification: https://drafts.csswg.org/css-fonts/#font-prop
// [ <font-style> || <font-variant-css2> || <font-weight> || <font-stretch-css3> ]? <font-size> [ / <line-hei... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_printer/css_printer_test.go | internal/css_printer/css_printer_test.go | package css_printer
import (
"strings"
"testing"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/css_parser"
"github.com/evanw/esbuild/internal/logger"
"github.com/evanw/esbuild/internal/test"
)
func expectPrintedCommon(t *testing.T, name s... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_printer/css_printer.go | internal/css_printer/css_printer.go | package css_printer
import (
"fmt"
"strings"
"unicode/utf8"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/config"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/interna... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/api_helpers/use_timer.go | internal/api_helpers/use_timer.go | package api_helpers
// This flag is set by the CLI to activate the timer. It's put here instead of
// by the timer to discourage code from checking this flag. Only the code that
// creates the root timer should check this flag. Other code should check that
// the timer is not null to detect if the timer is being used ... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_ast/js_ast_test.go | internal/js_ast/js_ast_test.go | package js_ast
import "testing"
func assertEqual(t *testing.T, a interface{}, b interface{}) {
if a != b {
t.Fatalf("%s != %s", a, b)
}
}
func TestGenerateNonUniqueNameFromPath(t *testing.T) {
assertEqual(t, GenerateNonUniqueNameFromPath("<stdin>"), "stdin")
assertEqual(t, GenerateNonUniqueNameFromPath("foo/ba... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_ast/js_ast_helpers.go | internal/js_ast/js_ast_helpers.go | package js_ast
import (
"math"
"strconv"
"strings"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/logger"
)
type HelperContext struct {
isUnbound func(ast.Ref) bool
}
func MakeHelperContext(isU... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_ast/js_ident.go | internal/js_ast/js_ident.go | package js_ast
import (
"strings"
"unicode"
"unicode/utf8"
)
func IsIdentifier(text string) bool {
if len(text) == 0 {
return false
}
for i, codePoint := range text {
if i == 0 {
if !IsIdentifierStart(codePoint) {
return false
}
} else {
if !IsIdentifierContinue(codePoint) {
return false
... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_ast/unicode.go | internal/js_ast/unicode.go | // This file was automatically generated by gen-unicode-table.js. Do not edit.
package js_ast
import "unicode"
var idStartES5AndESNext = &unicode.RangeTable{
LatinOffset: 117,
R16: []unicode.Range16{
{Lo: 0x41, Hi: 0x5a, Stride: 1},
{Lo: 0x61, Hi: 0x7a, Stride: 1},
{Lo: 0xaa, Hi: 0xaa, Stride: 1},
{Lo: 0xb5... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/js_ast/js_ast.go | internal/js_ast/js_ast.go | package js_ast
import (
"strconv"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/logger"
)
// Every module (i.e. file) is parsed into a separate AST data structure. For
// efficiency, the parser also resolves all scopes and binds all symbols in the
// tree.
//
// Identifiers in the tre... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_ast/css_ast.go | internal/css_ast/css_ast.go | package css_ast
import (
"strconv"
"strings"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/css_lexer"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/logger"
)
// CSS syntax comes in two layers: a minimal syntax that generally accepts
// anything that... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/css_ast/css_decl_table.go | internal/css_ast/css_decl_table.go | package css_ast
import (
"strings"
"sync"
"github.com/evanw/esbuild/internal/helpers"
)
type D uint16
const (
DUnknown D = iota
DAlignContent
DAlignItems
DAlignSelf
DAlignmentBaseline
DAll
DAnimation
DAnimationDelay
DAnimationDirection
DAnimationDuration
DAnimationFillMode
DAnimationIterationCount
D... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/config/globals.go | internal/config/globals.go | package config
import (
"math"
"sync"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/js_ast"
)
var processedGlobalsMutex sync.Mutex
var processedGlobals *ProcessedDefines
// If something is in this list, then a direct identifier expression... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/config/config.go | internal/config/config.go | package config
import (
"fmt"
"regexp"
"strings"
"sync"
"sync/atomic"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/compat"
"github.com/evanw/esbuild/internal/css_ast"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbuild/internal/logger"
)
type JSXOptions struct... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/ast/ast.go | internal/ast/ast.go | package ast
// This file contains data structures that are used with the AST packages for
// both JavaScript and CSS. This helps the bundler treat both AST formats in
// a somewhat format-agnostic manner.
import (
"sort"
"strings"
"github.com/evanw/esbuild/internal/helpers"
"github.com/evanw/esbuild/internal/log... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/bundler/bundler.go | internal/bundler/bundler.go | package bundler
// The bundler is the core of the "build" and "transform" API calls. Each
// operation has two phases. The first phase scans the module graph, and is
// represented by the "ScanBundle" function. The second phase generates the
// output files from the module graph, and is implemented by the "Compile"
//... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | true |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/renamer/renamer.go | internal/renamer/renamer.go | package renamer
import (
"fmt"
"sort"
"strconv"
"sync"
"sync/atomic"
"github.com/evanw/esbuild/internal/ast"
"github.com/evanw/esbuild/internal/js_ast"
"github.com/evanw/esbuild/internal/js_lexer"
)
func ComputeReservedNames(moduleScopes []*js_ast.Scope, symbols ast.SymbolMap) map[string]uint32 {
names := m... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/xxhash/xxhash.go | internal/xxhash/xxhash.go | // Package xxhash implements the 64-bit variant of xxHash (XXH64) as described
// at http://cyan4973.github.io/xxHash/.
package xxhash
import (
"encoding/binary"
"errors"
"math/bits"
)
const (
prime1 uint64 = 11400714785074694791
prime2 uint64 = 14029467366897019727
prime3 uint64 = 1609587929392839161
prime4 u... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/xxhash/xxhash_other.go | internal/xxhash/xxhash_other.go | package xxhash
// Sum64 computes the 64-bit xxHash digest of b.
func Sum64(b []byte) uint64 {
// A simpler version would be
// d := New()
// d.Write(b)
// return d.Sum64()
// but this is faster, particularly for small inputs.
n := len(b)
var h uint64
if n >= 32 {
v1 := prime1v + prime2
v2 := prime2... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/iswin_windows.go | internal/fs/iswin_windows.go | //go:build windows
// +build windows
package fs
func CheckIfWindows() bool {
return true
}
| go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/fs_real.go | internal/fs/fs_real.go | package fs
import (
"fmt"
"io"
"io/ioutil"
"os"
"sort"
"strings"
"sync"
"syscall"
)
type realFS struct {
// Stores the file entries for directories we've listed before
entries map[string]entriesOrErr
// This stores data that will end up being returned by "WatchData()"
watchData map[string]privateWatchDat... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/modkey_unix.go | internal/fs/modkey_unix.go | //go:build darwin || freebsd || linux
// +build darwin freebsd linux
package fs
import (
"time"
"golang.org/x/sys/unix"
)
func modKey(path string) (ModKey, error) {
stat := unix.Stat_t{}
if err := unix.Stat(path, &stat); err != nil {
return ModKey{}, err
}
// We can't detect changes if the file system zero... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/filepath.go | internal/fs/filepath.go | // Code in this file has been forked from the "filepath" module in the Go
// source code to work around bugs with the WebAssembly build target. More
// information about why here: https://github.com/golang/go/issues/43768.
////////////////////////////////////////////////////////////////////////////////
// Copyright (... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/iswin_wasm.go | internal/fs/iswin_wasm.go | //go:build js && wasm
// +build js,wasm
package fs
import (
"os"
)
var checkedIfWindows bool
var cachedIfWindows bool
func CheckIfWindows() bool {
if !checkedIfWindows {
checkedIfWindows = true
// Hack: Assume that we're on Windows if we're running WebAssembly and
// the "C:\\" directory exists. This is a ... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/fs_mock.go | internal/fs/fs_mock.go | package fs
// This is a mock implementation of the "fs" module for use with tests. It does
// not actually read from the file system. Instead, it reads from a pre-specified
// map of file paths to files.
import (
"errors"
"path"
"strings"
"syscall"
)
type MockKind uint8
const (
MockUnix MockKind = iota
MockWi... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/error_other.go | internal/fs/error_other.go | //go:build (!js || !wasm) && !windows
// +build !js !wasm
// +build !windows
package fs
func is_ERROR_INVALID_NAME(err error) bool {
return false
}
| go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/iswin_other.go | internal/fs/iswin_other.go | //go:build (!js || !wasm) && !windows
// +build !js !wasm
// +build !windows
package fs
func CheckIfWindows() bool {
return false
}
| go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/modkey_other.go | internal/fs/modkey_other.go | //go:build !darwin && !freebsd && !linux
// +build !darwin,!freebsd,!linux
package fs
import (
"os"
"time"
)
var zeroTime time.Time
func modKey(path string) (ModKey, error) {
info, err := os.Stat(path)
if err != nil {
return ModKey{}, err
}
// We can't detect changes if the file system zeros out the modifi... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/fs_zip.go | internal/fs/fs_zip.go | package fs
// The Yarn package manager (https://yarnpkg.com/) has a custom installation
// strategy called "Plug'n'Play" where they install packages as zip files
// instead of directory trees, and then modify node to treat zip files like
// directories. This reduces package installation time because Yarn now only
// h... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/fs.go | internal/fs/fs.go | package fs
// Most of esbuild's internals use this file system abstraction instead of
// using native file system APIs. This lets us easily mock the file system
// for tests and also implement Yarn's virtual ".zip" file system overlay.
import (
"errors"
"os"
"sort"
"strings"
"sync"
"syscall"
)
type EntryKind u... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/fs_mock_test.go | internal/fs/fs_mock_test.go | package fs
import (
"fmt"
"testing"
)
func TestMockFSBasicUnix(t *testing.T) {
fs := MockFS(map[string]string{
"/README.md": "// README.md",
"/package.json": "// package.json",
"/src/index.js": "// src/index.js",
"/src/util.js": "// src/util.js",
}, MockUnix, "/")
// Test a missing file
_, err, _ :... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
evanw/esbuild | https://github.com/evanw/esbuild/blob/cd832972927f1f67b6d2cc895c06a8759c1cf309/internal/fs/error_wasm+windows.go | internal/fs/error_wasm+windows.go | //go:build (js && wasm) || windows
// +build js,wasm windows
package fs
import "syscall"
// This check is here in a conditionally-compiled file because Go's standard
// library for Plan 9 doesn't define a type called "syscall.Errno". Plan 9 is
// not a supported operating system but someone wanted to be able to comp... | go | MIT | cd832972927f1f67b6d2cc895c06a8759c1cf309 | 2026-01-07T08:35:49.242278Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.5.4/main.go | de/code/src/apps/ch.5.4/main.go | // Example code for Chapter 5.4 from "Build Web Application with Golang"
// Purpose: Show how to perform CRUD operations using a postgres driver
package main
import (
"database/sql"
"fmt"
"time"
_ "github.com/lib/pq"
)
const (
DB_USER = "user"
DB_PASSWORD = ""
DB_NAME = "test"
)
func main() {
dbinfo... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.4.1/main.go | de/code/src/apps/ch.4.1/main.go | // Example code for Chapter 4.1 from "Build Web Application with Golang"
// Purpose: Shows how to create a simple login using a template
// Run: `go run main.go`, then access `http://localhost:9090` and `http://localhost:9090/login`
package main
import (
"fmt"
"html/template"
"log"
"net/http"
"strings"
)
func sa... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.5.5/main.go | de/code/src/apps/ch.5.5/main.go | // Example code for Chapter 5.5
// Purpose is to show to use BeeDB ORM for basic CRUD operations for sqlite3
package main
import (
"database/sql"
"fmt"
"github.com/astaxie/beedb"
_ "github.com/mattn/go-sqlite3"
"time"
)
var orm beedb.Model
type Userinfo struct {
Uid int `beedb:"PK"`
Username string
... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.2.1/main.go | de/code/src/apps/ch.2.1/main.go | // Example code for Chapter ? from "Build Web Application with Golang"
// Purpose: Hello world example demonstrating UTF-8 support.
// To run in the console, type `go run main.go`
// You're missing language fonts, if you're seeing squares or question marks.
package main
import "fmt"
func main() {
fmt.Printf("Hell... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.4.5/main.go | de/code/src/apps/ch.4.5/main.go | // Example code for Chapter 4.5
// Purpose is to create a server to handle uploading files.
package main
import (
"apps/ch.4.4/nonce"
"apps/ch.4.4/validator"
"fmt"
"html/template"
"io"
"mime/multipart"
"net/http"
"os"
)
const MiB_UNIT = 1 << 20
var t *template.Template
var submissions nonce.Nonces = nonce.Ne... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.4.5/nonce/main.go | de/code/src/apps/ch.4.5/nonce/main.go | // A nonce is a number or string used only once.
// This is useful for generating a unique token for login pages to prevent duplicate submissions.
package nonce
import (
"crypto/md5"
"errors"
"fmt"
"io"
"math/rand"
"strconv"
"time"
)
// Contains a unique token
type Nonce struct {
Token string
}
// Keeps trac... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.4.5/validator/main.go | de/code/src/apps/ch.4.5/validator/main.go | // This file contains all the validators to validate the profile page.
package validator
import (
"errors"
"fmt"
"net/url"
"regexp"
"strconv"
"strings"
"time"
)
type ProfilePage struct {
Form *url.Values
}
type Errors struct {
Errors []error
}
// Goes through the form object and validates each element.
// A... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.4.5/client_upload/main.go | de/code/src/apps/ch.4.5/client_upload/main.go | package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"os"
)
func checkError(err error) {
if err != nil {
panic(err)
}
}
func postFile(filename string, targetUrl string) {
bodyBuf := &bytes.Buffer{}
bodyWriter := multipart.NewWriter(bodyBuf)
fileWriter, err := bodyWriter.Creat... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.5.3/main.go | de/code/src/apps/ch.5.3/main.go | // Example code for Chapter 5.3 from "Build Web Application with Golang"
// Purpose: Shows how to run simple CRUD operations using a sqlite driver
package main
import (
"database/sql"
"fmt"
_ "github.com/mattn/go-sqlite3"
"time"
)
const DB_PATH = "./foo.db"
func main() {
db, err := sql.Open("sqlite3", DB_PATH)
... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.4.4/main.go | de/code/src/apps/ch.4.4/main.go | // Example code for Chapter 3.2 from "Build Web Application with Golang"
// Purpose: Shows how to prevent duplicate submissions by using tokens
// Example code for Chapter 4.4 based off the code from Chapter 4.2
// Run `go run main.go` then access http://localhost:9090
package main
import (
"apps/ch.4.4/nonce"
"apps... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.4.4/nonce/main.go | de/code/src/apps/ch.4.4/nonce/main.go | // A nonce is a number or string used only once.
// This is useful for generating a unique token for login pages to prevent duplicate submissions.
package nonce
import (
"crypto/md5"
"errors"
"fmt"
"io"
"math/rand"
"strconv"
"time"
)
// Contains a unique token
type Nonce struct {
Token string
}
// Keeps trac... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
astaxie/build-web-application-with-golang | https://github.com/astaxie/build-web-application-with-golang/blob/c294b087b96d99d2593ad8f470151af5354bb57f/de/code/src/apps/ch.4.4/validator/main.go | de/code/src/apps/ch.4.4/validator/main.go | // This file contains all the validators to validate the profile page.
package validator
import (
"errors"
"fmt"
"net/url"
"regexp"
"strconv"
"strings"
"time"
)
type ProfilePage struct {
Form *url.Values
}
type Errors struct {
Errors []error
}
// Goes through the form object and validates each element.
// A... | go | BSD-3-Clause | c294b087b96d99d2593ad8f470151af5354bb57f | 2026-01-07T08:35:46.175972Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.