go.md, cmd/tsconnect: bump esbuild

Follow-up to #8044
Updates #8043

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I88bc933de3939119f8afa3ccfed26a14e7e7af62
andrew/bump-esbuild
Andrew Dunham 2023-05-04 14:34:19 -04:00
parent 73d128238e
commit edf79e99ee
3 changed files with 22 additions and 7 deletions

View File

@ -9,6 +9,7 @@ import (
"net"
"os"
"os/exec"
"os/signal"
"path"
"path/filepath"
"runtime"
@ -66,7 +67,7 @@ func commonSetup(dev bool) (*esbuild.BuildOptions, error) {
},
},
},
JSXMode: esbuild.JSXModeAutomatic,
JSX: esbuild.JSXAutomatic,
}, nil
}
@ -132,16 +133,30 @@ func runEsbuildServe(buildOptions esbuild.BuildOptions) {
if err != nil {
log.Fatalf("Cannot parse port: %v", err)
}
result, err := esbuild.Serve(esbuild.ServeOptions{
buildCtx, buildCtxErr := esbuild.Context(buildOptions)
if buildCtxErr != nil {
log.Fatalf("Could not create BuildContext: %v", buildCtxErr)
}
result, err := buildCtx.Serve(esbuild.ServeOptions{
Port: uint16(port),
Host: host,
Servedir: "./",
}, buildOptions)
})
if err != nil {
log.Fatalf("Cannot start esbuild server: %v", err)
}
if err := buildCtx.Watch(esbuild.WatchOptions{}); err != nil {
log.Fatalf("Cannot start esbuild watcher: %v", err)
}
log.Printf("Listening on http://%s:%d\n", result.Host, result.Port)
result.Wait()
// Wait for Ctrl-C
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, os.Interrupt)
<-sigCh
log.Printf("Shutting down due to signal")
buildCtx.Dispose()
}
func runEsbuild(buildOptions esbuild.BuildOptions) esbuild.BuildResult {

2
go.mod
View File

@ -20,7 +20,7 @@ require (
github.com/dave/jennifer v1.6.1
github.com/dblohm7/wingoes v0.0.0-20230426155039-111c8c3b57c8
github.com/dsnet/try v0.0.3
github.com/evanw/esbuild v0.14.53
github.com/evanw/esbuild v0.17.18
github.com/frankban/quicktest v1.14.5
github.com/fxamacker/cbor/v2 v2.4.0
github.com/go-json-experiment/json v0.0.0-20230321051131-ccbac49a6929

4
go.sum
View File

@ -279,8 +279,8 @@ github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCv
github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww=
github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4=
github.com/evanw/esbuild v0.14.53 h1:9uU73SZUmP1jRQhaC6hPm9aoqFGYlPwfk7OrhG6AhpQ=
github.com/evanw/esbuild v0.14.53/go.mod h1:iINY06rn799hi48UqEnaQvVfZWe6W9bET78LbvN8VWk=
github.com/evanw/esbuild v0.17.18 h1:Bgc11CEvauUX+UbBAwQ5JEzY8wzzAPxoLVwBaKvAAiU=
github.com/evanw/esbuild v0.17.18/go.mod h1:iINY06rn799hi48UqEnaQvVfZWe6W9bET78LbvN8VWk=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=