MCPcopy Index your code
hub / github.com/matthewmueller/joy

github.com/matthewmueller/joy @v0.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.2.0 ↗ · + Follow
1,773 symbols 3,963 edges 230 files 862 documented · 49% 9 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

joy compiler

⚠️ Joy development is currently on hold. Recent Go -> WASM developments look like a more promising path to Go being a great choice for frontend development. I'm thrilled to see development moving so quickly now and I think our efforts are better spent improving the Go to WASM compiler. As for Joy, there are quite a few interesting nuggets of code in here that I'd encourage you to dig up, polish and open source 😊

Thanks for your interest in this project!

❤️ Matt


Translate idiomatic Go into concise Javascript that works in every browser. Use Go's type system and world-class tooling to build large web applications with confidence.

Visit mat.tm/joy to learn more about Joy.


Getting Started     ·    Examples     ·    Using the CLI

Contributing    ·    FAQ    ·    More Links

Joy API    ·    DOM API (coming soon!)    ·    Virtual DOM API (coming soon!)


Getting Started

1. Install Joy:

curl -sfL https://raw.githubusercontent.com/matthewmueller/joy/master/install.sh | sh

Note: you can also download from the releases tab.

2. Create a main.go file with the following code:

package main

func main() {
  println("hi world!")
}

3. Run the code in a real browser:

joy run main.go

4. See the compiled Javascript:

joy main.go

Examples

Visit https://mat.tm/joy/#examples or peruse the test suite.

Using the CLI

Compile Go into Javascript:

joy <main.go>

Compile and run the Go code in headless chrome:

joy run <main.go>

Build a development version of the code:

joy build --dev <main.go>...

Build a production version of the code (coming soon!):

joy build <main.go>...

Start a development server with livereload:

joy serve <main.go>...

Run joy help for additional details.

Contributing

So happy to hear you're interested in contributing! Here's a quick rundown of how to get setup:

Setup

  1. Make sure you have the Go environment setup on your computer. There are quite a few better resources online on how to do that

  2. go get -u -v github.com/matthewmueller/joy/... to install the compiler from source

  3. go test -v to run all the tests

Links and tips:

  • https://astexplorer.net/: I've been using this to figure out how to build the JS tree
  • http://goast.yuroyoro.net/ : Simple Go AST viewer
  • https://github.com/estree/estree/blob/master/es5.md: Link to the ES3 AST format, this is implemented in syntax.go
  • 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
  • pretty.Println(ast) will pretty print the JS AST (requires this package)
  • ast.Print(nil, node) will pretty print the Go AST

If you have any further questions, open an issue or reach out to me on twitter.

FAQ

Visit https://mat.tm/joy/#faq to view the FAQ.

More Links

  • Run joy help to see what else Joy can do for you
  • Visit mat.tm/joy to read more about Joy's origins
  • Chat with us in #joy-compiler on Slack at gophers.slack.com
  • Star github.com/matthewmueller/joy to follow the development
  • Follow twitter.com/mattmueller for project updates

Extension points exported contracts — how you extend this code

Stringer (Interface)
Stringer interface [45 implementers]
testdata/39-inner-interfaces/input.go
Child (Interface)
Child interface [16 implementers]
internal/_vdom/inputs/vdom.go
ID (Interface)
ID interface [20 implementers]
internal/compiler/def/def.go
INode (Interface)
INode interface [60 implementers]
internal/jsast/syntax.go
VNode (Interface)
VNode interface [2 implementers]
testdata/37-deep-interfaces/input.go
VNode (Interface)
VNode interface [2 implementers]
testdata/40-vnodes/input.go
EventTarget (Interface)
EventTarget interface [2 implementers]
testdata/_49-jsx/window/window.go
Method (Interface)
Method interface [2 implementers]
internal/_dom/defs/method.go

Core symbols most depended-on inside this repo

ID
called by 67
internal/compiler/def/def.go
Rewrite
called by 61
internal/compiler/def/def.go
Name
called by 58
internal/compiler/def/def.go
expression
called by 54
internal/compiler/translator/translator.go
ID
called by 47
internal/_dom/graph/graph.go
generate
called by 44
internal/jsast/assemble.go
Path
called by 42
internal/compiler/graph/graph.go
String
called by 30
internal/compiler/def/def.go

Shape

Method 835
Function 636
Struct 215
Interface 75
TypeAlias 12

Languages

Go90%
TypeScript10%

Modules by API surface

internal/jsast/syntax.go189 symbols
testdata/_49-jsx/window/window.go92 symbols
internal/compiler/translator/translator.go80 symbols
internal/jsast/assemble.go72 symbols
internal/bindata/bindata.go46 symbols
internal/jsast/api.go42 symbols
internal/compiler/def/def.go35 symbols
internal/compiler/defs/interface.go33 symbols
internal/compiler/defs/function.go31 symbols
testdata/_71-vdom/preact.js30 symbols
testdata/_63-vdom-zero-values/preact.js30 symbols
testdata/_60-chaining/preact/preact.js30 symbols

For agents

$ claude mcp add joy \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact