Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to go modules and simplify package structure #57

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@
/demo/
/github/
/node_modules/
/pkg/
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
ESBUILD_VERSION = $(shell cat version.txt)

esbuild: src/esbuild/*/*.go
GOPATH=`pwd` go build -o esbuild esbuild/main
esbuild: pkg/*/*.go cmd/*/*.go
go build -o esbuild ./cmd/esbuild

test:
GOPATH=`pwd` go test ./...
go test ./...

update-version-go:
echo "package main\n\nconst esbuildVersion = \"$(ESBUILD_VERSION)\"" > src/esbuild/main/version.go
echo "package main\n\nconst esbuildVersion = \"$(ESBUILD_VERSION)\"" > cmd/esbuild/version.go

platform-all: update-version-go test
make -j5 platform-windows platform-darwin platform-linux platform-wasm platform-neutral

platform-windows:
mkdir -p npm/esbuild-windows-64/bin
cd npm/esbuild-windows-64 && npm version "$(ESBUILD_VERSION)" --allow-same-version
GOOS=windows GOARCH=amd64 GOPATH=`pwd` go build -o npm/esbuild-windows-64/esbuild.exe esbuild/main
GOOS=windows GOARCH=amd64 go build -o npm/esbuild-windows-64/esbuild.exe ./cmd/esbuild

platform-darwin:
mkdir -p npm/esbuild-darwin-64/bin
cd npm/esbuild-darwin-64 && npm version "$(ESBUILD_VERSION)" --allow-same-version
GOOS=darwin GOARCH=amd64 GOPATH=`pwd` go build -o npm/esbuild-darwin-64/bin/esbuild esbuild/main
GOOS=darwin GOARCH=amd64 go build -o npm/esbuild-darwin-64/bin/esbuild ./cmd/esbuild

platform-linux:
mkdir -p npm/esbuild-linux-64/bin
cd npm/esbuild-linux-64 && npm version "$(ESBUILD_VERSION)" --allow-same-version
GOOS=linux GOARCH=amd64 GOPATH=`pwd` go build -o npm/esbuild-linux-64/bin/esbuild esbuild/main
GOOS=linux GOARCH=amd64 go build -o npm/esbuild-linux-64/bin/esbuild ./cmd/esbuild

platform-wasm:
GOOS=js GOARCH=wasm GOPATH=`pwd` go build -o npm/esbuild-wasm/esbuild.wasm esbuild/main
GOOS=js GOARCH=wasm go build -o npm/esbuild-wasm/esbuild.wasm ./cmd/esbuild
cd npm/esbuild-wasm && npm version "$(ESBUILD_VERSION)" --allow-same-version
cp "$(shell go env GOROOT)/misc/wasm/wasm_exec.js" npm/esbuild-wasm/wasm_exec.js

Expand Down
14 changes: 7 additions & 7 deletions src/esbuild/main/main.go → cmd/esbuild/main.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package main

import (
"esbuild/ast"
"esbuild/bundler"
"esbuild/fs"
"esbuild/lexer"
"esbuild/logging"
"esbuild/parser"
"esbuild/resolver"
"fmt"
"github.com/evanw/esbuild/pkg/ast"
"github.com/evanw/esbuild/pkg/bundler"
"github.com/evanw/esbuild/pkg/fs"
"github.com/evanw/esbuild/pkg/lexer"
"github.com/evanw/esbuild/pkg/logging"
"github.com/evanw/esbuild/pkg/parser"
"github.com/evanw/esbuild/pkg/resolver"
"io/ioutil"
"os"
"path/filepath"
Expand Down
3 changes: 3 additions & 0 deletions cmd/esbuild/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package main

const esbuildVersion = "0.0.17"
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/evanw/esbuild

go 1.13
2 changes: 1 addition & 1 deletion npm/esbuild-darwin-64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esbuild-darwin-64",
"version": "0.0.16",
"version": "0.0.17",
"description": "The macOS 64-bit binary for esbuild, a JavaScript bundler.",
"repository": "https://github.com/evanw/esbuild",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion npm/esbuild-linux-64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esbuild-linux-64",
"version": "0.0.16",
"version": "0.0.17",
"description": "The Linux 64-bit binary for esbuild, a JavaScript bundler.",
"repository": "https://github.com/evanw/esbuild",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion npm/esbuild-wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esbuild-wasm",
"version": "0.0.16",
"version": "0.0.17",
"description": "The cross-platform WebAssembly binary for esbuild, a JavaScript bundler.",
"repository": "https://github.com/evanw/esbuild",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion npm/esbuild-windows-64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esbuild-windows-64",
"version": "0.0.16",
"version": "0.0.17",
"description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.",
"repository": "https://github.com/evanw/esbuild",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion npm/esbuild/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esbuild",
"version": "0.0.16",
"version": "0.0.17",
"description": "An extremely fast JavaScript bundler and minifier.",
"repository": "https://github.com/evanw/esbuild",
"scripts": {
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions src/esbuild/bundler/bundler.go → pkg/bundler/bundler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package bundler
import (
"bytes"
"encoding/base64"
"esbuild/ast"
"esbuild/fs"
"esbuild/lexer"
"esbuild/logging"
"esbuild/parser"
"esbuild/printer"
"esbuild/resolver"
"fmt"
"github.com/evanw/esbuild/pkg/ast"
"github.com/evanw/esbuild/pkg/fs"
"github.com/evanw/esbuild/pkg/lexer"
"github.com/evanw/esbuild/pkg/logging"
"github.com/evanw/esbuild/pkg/parser"
"github.com/evanw/esbuild/pkg/printer"
"github.com/evanw/esbuild/pkg/resolver"
"sort"
"strings"
"sync"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package bundler

import (
"esbuild/fs"
"esbuild/logging"
"esbuild/parser"
"esbuild/resolver"
"github.com/evanw/esbuild/pkg/fs"
"github.com/evanw/esbuild/pkg/logging"
"github.com/evanw/esbuild/pkg/parser"
"github.com/evanw/esbuild/pkg/resolver"
"path"
"testing"
)
Expand Down
4 changes: 2 additions & 2 deletions src/esbuild/bundler/renamer.go → pkg/bundler/renamer.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package bundler

import (
"esbuild/ast"
"esbuild/lexer"
"github.com/evanw/esbuild/pkg/ast"
"github.com/evanw/esbuild/pkg/lexer"
"sort"
"strconv"
)
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/esbuild/lexer/lexer.go → pkg/lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ package lexer
// accurately.

import (
"esbuild/ast"
"esbuild/logging"
"fmt"
"github.com/evanw/esbuild/pkg/ast"
"github.com/evanw/esbuild/pkg/logging"
"strconv"
"strings"
"unicode"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package lexer

import (
"esbuild/logging"
"fmt"
"github.com/evanw/esbuild/pkg/logging"
"math"
"strings"
"testing"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/esbuild/logging/logging.go → pkg/logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package logging
// default.

import (
"esbuild/ast"
"fmt"
"github.com/evanw/esbuild/pkg/ast"
"os"
"os/exec"
"runtime"
Expand Down
6 changes: 3 additions & 3 deletions src/esbuild/parser/parser.go → pkg/parser/parser.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package parser

import (
"esbuild/ast"
"esbuild/lexer"
"esbuild/logging"
"fmt"
"github.com/evanw/esbuild/pkg/ast"
"github.com/evanw/esbuild/pkg/lexer"
"github.com/evanw/esbuild/pkg/logging"
"math"
"reflect"
"strings"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package parser

import (
"esbuild/ast"
"esbuild/lexer"
"esbuild/logging"
"github.com/evanw/esbuild/pkg/ast"
"github.com/evanw/esbuild/pkg/lexer"
"github.com/evanw/esbuild/pkg/logging"
)

type jsonParser struct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package parser

import (
"esbuild/ast"
"esbuild/logging"
"esbuild/printer"
"fmt"
"github.com/evanw/esbuild/pkg/ast"
"github.com/evanw/esbuild/pkg/logging"
"github.com/evanw/esbuild/pkg/printer"
"testing"
)

Expand Down
4 changes: 2 additions & 2 deletions src/esbuild/printer/printer.go → pkg/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package printer

import (
"bytes"
"esbuild/ast"
"esbuild/lexer"
"fmt"
"github.com/evanw/esbuild/pkg/ast"
"github.com/evanw/esbuild/pkg/lexer"
"math"
"strconv"
"strings"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package printer

import (
"esbuild/logging"
"esbuild/parser"
"github.com/evanw/esbuild/pkg/logging"
"github.com/evanw/esbuild/pkg/parser"
"testing"
)

Expand Down
10 changes: 5 additions & 5 deletions src/esbuild/resolver/resolver.go → pkg/resolver/resolver.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package resolver

import (
"esbuild/ast"
"esbuild/fs"
"esbuild/lexer"
"esbuild/logging"
"esbuild/parser"
"github.com/evanw/esbuild/pkg/ast"
"github.com/evanw/esbuild/pkg/fs"
"github.com/evanw/esbuild/pkg/lexer"
"github.com/evanw/esbuild/pkg/logging"
"github.com/evanw/esbuild/pkg/parser"
"strings"
"sync"
)
Expand Down
3 changes: 0 additions & 3 deletions src/esbuild/main/version.go

This file was deleted.

2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.16
0.0.17