Skip to content

Commit

Permalink
golly to joy
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmueller committed Dec 3, 2017
1 parent 106943b commit e4c218f
Show file tree
Hide file tree
Showing 923 changed files with 3,239 additions and 3,239 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ test:

jsx:
@echo "==> Running jsx example..."
@go run cmd/golly/golly.go build ./testdata/49-jsx/
@go run cmd/joy/joy.go build ./testdata/49-jsx/
.PHONY: jsx

hn:
@echo "==> Running hackernews example..."
@go run cmd/golly/golly.go serve ./_examples/hn
@go run cmd/joy/joy.go serve ./_examples/hn
.PHONY: hn

# Install the commands.
Expand All @@ -25,6 +25,6 @@ install:
dom:
@go run internal/dom/main.go
# @go generate ./internal/gendom/main.go
# @go run cmd/golly/golly.go build ./_examples/dom
# @go run cmd/joy/joy.go build ./_examples/dom
# @go run _examples/dom/dom.go
.PHONY: dom
20 changes: 10 additions & 10 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Golly gee, it's another Go to JS compiler.
Joy gee, it's another Go to JS compiler.

![img](https://cldup.com/uQb67D_DJT.png)

Expand All @@ -10,8 +10,8 @@ Golly gee, it's another Go to JS compiler.
- https://golang.org/ref/spec: You may need to refer to this to see what types are possible in Go's AST
- To run all tests: `go test -v`
- To run individual tests: `go test -v -run Test/08`
- To run examples: `go run cmd/golly/main.go --pkg $(PWD)/_examples/dom`
- To see a callgraph: `go run cmd/golly/main.go --pkg $(PWD)/_examples/dom --graph`
- To run examples: `go run cmd/joy/main.go --pkg $(PWD)/_examples/dom`
- To see a callgraph: `go run cmd/joy/main.go --pkg $(PWD)/_examples/dom --graph`
- `pretty.Println(ast)` will pretty print the JS AST
- `ast.Print(nil, node)` will pretty print the Go AST

Expand All @@ -33,21 +33,21 @@ Golly gee, it's another Go to JS compiler.

## Tradeoffs

**Go will compile Golly code, but Golly will probably not compile existing Go code**
**Go will compile Joy code, but Joy will probably not compile existing Go code**

Just because your code is running in Go does not mean it will run on Golly without modification. For everything that browserify & webpack brought to the community, they also brought with it mysteriously large builds.
Just because your code is running in Go does not mean it will run on Joy without modification. For everything that browserify & webpack brought to the community, they also brought with it mysteriously large builds.

Golly aims to generate clean, minimal & performant ES3 code that works in every browser. It will not jump hoops to make your Go code work inside the browser.
Joy aims to generate clean, minimal & performant ES3 code that works in every browser. It will not jump hoops to make your Go code work inside the browser.

If you need browser compatibility with existing Go code, GopherJS is much better suited for that task.

**Golly doesn't include Go's wonderful standard library**
**Joy doesn't include Go's wonderful standard library**

All 3rd party packages are opt-in. This is to make sure that our builds remain purposeful and small. Over time, Golly will add compatibility with certain standard library packages where it makes sense.
All 3rd party packages are opt-in. This is to make sure that our builds remain purposeful and small. Over time, Joy will add compatibility with certain standard library packages where it makes sense.

**Golly aims to be a browser solution, not a node.js solution**
**Joy aims to be a browser solution, not a node.js solution**

While there's a good chance Golly programs will work in node.js, it's not the focus of this project. The stack we're going for here is Go on the backend and Go on the frontend compiled with Golly.
While there's a good chance Joy programs will work in node.js, it's not the focus of this project. The stack we're going for here is Go on the backend and Go on the frontend compiled with Joy.

## Additional Motivation

Expand Down
8 changes: 4 additions & 4 deletions _examples/hn/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package app
import (
"strconv"

"github.com/matthewmueller/golly/jsx"
"github.com/matthewmueller/golly/_examples/hn/fetch"
"github.com/matthewmueller/golly/_examples/hn/item"
"github.com/matthewmueller/golly/_examples/hn/preact"
"github.com/matthewmueller/joy/jsx"
"github.com/matthewmueller/joy/_examples/hn/fetch"
"github.com/matthewmueller/joy/_examples/hn/item"
"github.com/matthewmueller/joy/_examples/hn/preact"
)

var api = "https://hacker-news.firebaseio.com"
Expand Down
2 changes: 1 addition & 1 deletion _examples/hn/fetch/fetch.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package fetch

import (
"github.com/matthewmueller/golly/js"
"github.com/matthewmueller/joy/js"
)

// Options struct
Expand Down
8 changes: 4 additions & 4 deletions _examples/hn/input.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package main

import (
"github.com/matthewmueller/golly/dom/document"
"github.com/matthewmueller/golly/jsx"
"github.com/matthewmueller/golly/_examples/hn/app"
"github.com/matthewmueller/golly/_examples/hn/preact"
"github.com/matthewmueller/joy/dom/document"
"github.com/matthewmueller/joy/jsx"
"github.com/matthewmueller/joy/_examples/hn/app"
"github.com/matthewmueller/joy/_examples/hn/preact"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion _examples/hn/item/item.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package item

import "github.com/matthewmueller/golly/jsx"
import "github.com/matthewmueller/joy/jsx"

// Item from hacker news
type Item struct {
Expand Down
6 changes: 3 additions & 3 deletions _examples/hn/preact/preact.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package preact

import (
"github.com/matthewmueller/golly/dom/document"
"github.com/matthewmueller/golly/js"
"github.com/matthewmueller/golly/jsx"
"github.com/matthewmueller/joy/dom/document"
"github.com/matthewmueller/joy/js"
"github.com/matthewmueller/joy/jsx"
)

var preact = js.RawFile("./preact.js")
Expand Down
6 changes: 3 additions & 3 deletions _examples/hn/topitems/topitems.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package topitems

import (
"github.com/matthewmueller/golly/jsx"
"github.com/matthewmueller/golly/testdata/56-hn-preact/item"
"github.com/matthewmueller/golly/testdata/56-hn-preact/preact"
"github.com/matthewmueller/joy/jsx"
"github.com/matthewmueller/joy/testdata/56-hn-preact/item"
"github.com/matthewmueller/joy/testdata/56-hn-preact/preact"
)

type component struct {
Expand Down
10 changes: 5 additions & 5 deletions _examples/window/window.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package main

import (
"github.com/matthewmueller/golly/dom/htmlanchorelement"
"github.com/matthewmueller/golly/dom/htmlhtmlelement"
"github.com/matthewmueller/golly/dom/websocket"
"github.com/matthewmueller/golly/dom/window"
"github.com/matthewmueller/golly/dom/xmlhttprequest"
"github.com/matthewmueller/joy/dom/htmlanchorelement"
"github.com/matthewmueller/joy/dom/htmlhtmlelement"
"github.com/matthewmueller/joy/dom/websocket"
"github.com/matthewmueller/joy/dom/window"
"github.com/matthewmueller/joy/dom/xmlhttprequest"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions all_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package golly_test
package joy_test

import (
"bytes"
Expand All @@ -16,8 +16,8 @@ import (

"github.com/apex/log"
"github.com/apex/log/handlers/text"
"github.com/matthewmueller/golly/api"
"github.com/matthewmueller/golly/internal/chrome"
"github.com/matthewmueller/joy/api"
"github.com/matthewmueller/joy/internal/chrome"
"github.com/pkg/errors"
)

Expand Down
4 changes: 2 additions & 2 deletions api/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package api
import (
"context"

"github.com/matthewmueller/golly/internal/compiler"
"github.com/matthewmueller/golly/internal/compiler/script"
"github.com/matthewmueller/joy/internal/compiler"
"github.com/matthewmueller/joy/internal/compiler/script"
)

// BuildSettings struct
Expand Down
2 changes: 1 addition & 1 deletion api/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"errors"

"github.com/matthewmueller/golly/internal/chrome"
"github.com/matthewmueller/joy/internal/chrome"
)

// RunSettings struct
Expand Down
6 changes: 3 additions & 3 deletions api/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/apex/log/handlers/text"
"github.com/jaschaephraim/lrserver"
"github.com/julienschmidt/httprouter"
"github.com/matthewmueller/golly/internal/compiler"
"github.com/matthewmueller/golly/internal/compiler/util"
"github.com/matthewmueller/joy/internal/compiler"
"github.com/matthewmueller/joy/internal/compiler/util"
"github.com/radovskyb/watcher"
)

Expand Down Expand Up @@ -100,7 +100,7 @@ func Serve(ctx context.Context, settings *ServeSettings) error {
case <-w.Event:
files, err := c.Compile(settings.Packages...)
if err != nil {
log.WithError(err).Errorf("error compiling golly")
log.WithError(err).Errorf("error compiling joy")
continue
}
bundleLock.Lock()
Expand Down
12 changes: 6 additions & 6 deletions cmd/golly/golly.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ import (
"strings"
"syscall"

"github.com/matthewmueller/golly/internal/chrome"
"github.com/matthewmueller/golly/internal/compiler/util"
"github.com/matthewmueller/joy/internal/chrome"
"github.com/matthewmueller/joy/internal/compiler/util"

kingpin "gopkg.in/alecthomas/kingpin.v2"

"github.com/apex/log"
"github.com/apex/log/handlers/text"
"github.com/matthewmueller/golly/api"
"github.com/matthewmueller/golly/internal/compiler"
"github.com/matthewmueller/joy/api"
"github.com/matthewmueller/joy/internal/compiler"
"github.com/pkg/errors"
)

var (
cli = kingpin.New("golly", "Go to Javascript compiler")
cli = kingpin.New("joy", "Go to Javascript compiler")
root = cli.Flag("root", "package root").String()

buildCmd = cli.Command("build", "build the packages")
Expand Down Expand Up @@ -82,7 +82,7 @@ func run(ctx context.Context) error {
}
filePath := path.Join(cwd, *runFile)

root, err := util.GollyPath()
root, err := util.JoyPath()
if err != nil {
return errors.Wrapf(err, "error getting root path")
}
Expand Down
2 changes: 1 addition & 1 deletion dom/angleinstancedarrays/angleinstancedarrays.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package angleinstancedarrays

import "github.com/matthewmueller/golly/js"
import "github.com/matthewmueller/joy/js"

// ANGLEInstancedArrays struct
// js:"ANGLEInstancedArrays,omit"
Expand Down
6 changes: 3 additions & 3 deletions dom/animationevent/animationevent.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package animationevent

import (
"github.com/matthewmueller/golly/dom/animationeventinit"
"github.com/matthewmueller/golly/dom/window"
"github.com/matthewmueller/golly/js"
"github.com/matthewmueller/joy/dom/animationeventinit"
"github.com/matthewmueller/joy/dom/window"
"github.com/matthewmueller/joy/js"
)

var _ window.Event = (*AnimationEvent)(nil)
Expand Down
2 changes: 1 addition & 1 deletion dom/animationeventinit/animationeventinit.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package animationeventinit

import "github.com/matthewmueller/golly/dom/eventinit"
import "github.com/matthewmueller/joy/dom/eventinit"

type AnimationEventInit struct {
*eventinit.EventInit
Expand Down
4 changes: 2 additions & 2 deletions dom/assertionoptions/assertionoptions.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package assertionoptions

import (
"github.com/matthewmueller/golly/dom/scopedcredentialdescriptor"
"github.com/matthewmueller/golly/dom/webauthnextensions"
"github.com/matthewmueller/joy/dom/scopedcredentialdescriptor"
"github.com/matthewmueller/joy/dom/webauthnextensions"
)

type AssertionOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion dom/audiobuffer/audiobuffer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package audiobuffer

import "github.com/matthewmueller/golly/js"
import "github.com/matthewmueller/joy/js"

// AudioBuffer struct
// js:"AudioBuffer,omit"
Expand Down
2 changes: 1 addition & 1 deletion dom/audiolistener/audiolistener.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package audiolistener

import "github.com/matthewmueller/golly/js"
import "github.com/matthewmueller/joy/js"

// AudioListener struct
// js:"AudioListener,omit"
Expand Down
8 changes: 4 additions & 4 deletions dom/audionode/analysernode.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package audionode

import (
"github.com/matthewmueller/golly/dom/channelcountmode"
"github.com/matthewmueller/golly/dom/channelinterpretation"
"github.com/matthewmueller/golly/dom/window"
"github.com/matthewmueller/golly/js"
"github.com/matthewmueller/joy/dom/channelcountmode"
"github.com/matthewmueller/joy/dom/channelinterpretation"
"github.com/matthewmueller/joy/dom/window"
"github.com/matthewmueller/joy/js"
)

var _ AudioNode = (*AnalyserNode)(nil)
Expand Down
12 changes: 6 additions & 6 deletions dom/audionode/audiobuffersourcenode.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package audionode

import (
"github.com/matthewmueller/golly/dom/audiobuffer"
"github.com/matthewmueller/golly/dom/audioparam"
"github.com/matthewmueller/golly/dom/channelcountmode"
"github.com/matthewmueller/golly/dom/channelinterpretation"
"github.com/matthewmueller/golly/dom/window"
"github.com/matthewmueller/golly/js"
"github.com/matthewmueller/joy/dom/audiobuffer"
"github.com/matthewmueller/joy/dom/audioparam"
"github.com/matthewmueller/joy/dom/channelcountmode"
"github.com/matthewmueller/joy/dom/channelinterpretation"
"github.com/matthewmueller/joy/dom/window"
"github.com/matthewmueller/joy/js"
)

var _ AudioNode = (*AudioBufferSourceNode)(nil)
Expand Down
14 changes: 7 additions & 7 deletions dom/audionode/audiocontext.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package audionode

import (
"github.com/matthewmueller/golly/dom/audiobuffer"
"github.com/matthewmueller/golly/dom/audiocontextstate"
"github.com/matthewmueller/golly/dom/audiolistener"
"github.com/matthewmueller/golly/dom/htmlmediaelement"
"github.com/matthewmueller/golly/dom/periodicwave"
"github.com/matthewmueller/golly/dom/periodicwaveconstraints"
"github.com/matthewmueller/golly/dom/window"
"github.com/matthewmueller/joy/dom/audiobuffer"
"github.com/matthewmueller/joy/dom/audiocontextstate"
"github.com/matthewmueller/joy/dom/audiolistener"
"github.com/matthewmueller/joy/dom/htmlmediaelement"
"github.com/matthewmueller/joy/dom/periodicwave"
"github.com/matthewmueller/joy/dom/periodicwaveconstraints"
"github.com/matthewmueller/joy/dom/window"
)

// AudioContext interface
Expand Down
8 changes: 4 additions & 4 deletions dom/audionode/audiodestinationnode.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package audionode

import (
"github.com/matthewmueller/golly/dom/channelcountmode"
"github.com/matthewmueller/golly/dom/channelinterpretation"
"github.com/matthewmueller/golly/dom/window"
"github.com/matthewmueller/golly/js"
"github.com/matthewmueller/joy/dom/channelcountmode"
"github.com/matthewmueller/joy/dom/channelinterpretation"
"github.com/matthewmueller/joy/dom/window"
"github.com/matthewmueller/joy/js"
)

var _ AudioNode = (*AudioDestinationNode)(nil)
Expand Down
6 changes: 3 additions & 3 deletions dom/audionode/audionode.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package audionode

import (
"github.com/matthewmueller/golly/dom/channelcountmode"
"github.com/matthewmueller/golly/dom/channelinterpretation"
"github.com/matthewmueller/golly/dom/window"
"github.com/matthewmueller/joy/dom/channelcountmode"
"github.com/matthewmueller/joy/dom/channelinterpretation"
"github.com/matthewmueller/joy/dom/window"
)

// AudioNode interface
Expand Down
Loading

0 comments on commit e4c218f

Please sign in to comment.