Skip to content

Commit

Permalink
add svelte viewer. add context to transpiler. add http, import map es…
Browse files Browse the repository at this point in the history
…build plugins (#402)

* add ascii -> html rendering. add context to transpiler. add http, import map esbuild plugins.

* added better error handling

* add svelte bundling, static rendering, and more tests

* bump github.com/livebud/js

* run go mod tidy

* setup for hot reload

* add basic hot reload to example script
  • Loading branch information
matthewmueller committed Apr 16, 2023
1 parent e84c6d6 commit 3f67df9
Show file tree
Hide file tree
Showing 37 changed files with 2,081 additions and 301 deletions.
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/ajg/form v1.5.2-0.20200323032839-9aeb3cf462e1
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59
github.com/bep/debounce v1.2.1
github.com/buildkite/terminal-to-html v3.2.0+incompatible
github.com/cespare/xxhash v1.1.0
github.com/evanw/esbuild v0.14.11
github.com/fatih/structtag v1.2.0
Expand All @@ -19,7 +20,7 @@ require (
github.com/keegancsmith/rpc v1.3.0
github.com/lithammer/dedent v1.1.0
github.com/livebud/bud-test-plugin v0.0.9
github.com/livebud/js v0.0.0-20221112072017-b9e63b92aad5
github.com/livebud/js v0.0.0-20230416184227-ef633a94787b
github.com/livebud/transpiler v0.0.3
github.com/matthewmueller/diff v0.0.0-20220104030700-cb2fe910d90c
github.com/matthewmueller/gotext v0.0.0-20210424201144-265ed61725ac
Expand All @@ -32,7 +33,7 @@ require (
github.com/xlab/treeprint v1.1.0
go.kuoruan.net/v8go-polyfills v0.5.1-0.20220727011656-c74c5b408ebd
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sync v0.1.0
golang.org/x/tools v0.1.11-0.20220513221640-090b14e8501f
honnef.co/go/tools v0.3.3
rogchap.com/v8go v0.8.0
Expand Down
9 changes: 6 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 h1:WWB576BN5zNSZc
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I=
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
github.com/buildkite/terminal-to-html v3.2.0+incompatible h1:WdXzl7ZmYzCAz4pElZosPaUlRTW+qwVx/SkQSCa1jXs=
github.com/buildkite/terminal-to-html v3.2.0+incompatible/go.mod h1:BFFdFecOxCgjdcarqI+8izs6v85CU/1RA/4Bqh4GR7E=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down Expand Up @@ -76,8 +78,8 @@ github.com/livebud/bud-test-nested-plugin v0.0.5 h1:MpPp20Gng0F+Kvl+L9kttu6nsJIY
github.com/livebud/bud-test-nested-plugin v0.0.5/go.mod h1:M3QujkGG4ggZ6h75t5zF8MEJFrLTwa2USeIYHQdO2YQ=
github.com/livebud/bud-test-plugin v0.0.9 h1:JmS4aj+NV52RUroteLs+ld6rcbkBwio7p9qPNutTsqM=
github.com/livebud/bud-test-plugin v0.0.9/go.mod h1:GTxMZ8W4BIyGIOgAA4hvPHMDDTkaZtfcuhnOcSu3y8M=
github.com/livebud/js v0.0.0-20221112072017-b9e63b92aad5 h1:7fYJMOnT4WrnjRhJ8B6HiJBGcDVFd9jam0205gn9y1k=
github.com/livebud/js v0.0.0-20221112072017-b9e63b92aad5/go.mod h1:TDkks+mVAlB96mxcbIAftAxpGteCxoBYGVF1JThjcLk=
github.com/livebud/js v0.0.0-20230416184227-ef633a94787b h1:blPLG/F7wT8E20kMLPHsWL3hyWSw4M/2a6JgRwFXJPg=
github.com/livebud/js v0.0.0-20230416184227-ef633a94787b/go.mod h1:Xkuu9hOX5C6DVDx9MLyIqwRC/mT2VfR5KlEJWL/HNOs=
github.com/livebud/transpiler v0.0.3 h1:OFKPsmfTOywBDoOE/ZFMVjAupk/xVXFlXoAgZNRhh5Q=
github.com/livebud/transpiler v0.0.3/go.mod h1:vQYMN//Y2cnM55tw0lOmLGbEETugP7alxTyhQHzNdTI=
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
Expand Down Expand Up @@ -149,8 +151,9 @@ golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
2 changes: 1 addition & 1 deletion internal/entrypoint/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func listViews(fsys fs.FS, tree *tree, dir string) (views []*View, err error) {
views = append(views, subviews...)
continue
}
if !valid.ViewEntry(name) {
if !valid.View(name) {
continue
}
ext := path.Ext(name)
Expand Down
5 changes: 5 additions & 0 deletions internal/errs/errs.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ func Join(errs ...error) error {
return agg
}

// Errors is an optional interface that be used to unwrap multiple errors
type Errors interface {
Errors() []error
}

// Format reverses the error order to make the cause come first
func Format(err error) string {
// Most errors in Bud are joined by a period
Expand Down
25 changes: 25 additions & 0 deletions internal/terminal/html.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package terminal

import (
"bytes"
_ "embed"

terminal "github.com/buildkite/terminal-to-html"
)

// Pre tag
func Pre(data []byte) []byte {
var b bytes.Buffer
b.WriteString(`<pre class="term-container">`)
b.Write(terminal.Render(data))
b.WriteString(`</pre>`)
return b.Bytes()
}

//go:embed terminal.css
var css []byte

// CSS that needs to be rendered
func CSS() []byte {
return css
}

0 comments on commit 3f67df9

Please sign in to comment.