go.mod, cmd/tsconnect: bump esbuild

Follow-up to #8044
Updates #8043

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I88bc933de3939119f8afa3ccfed26a14e7e7af62
This commit is contained in:
Andrew Dunham 2023-05-04 14:34:19 -04:00
parent 82c1dd8732
commit ba52a46bc0
3 changed files with 22 additions and 7 deletions

View File

@ -11,6 +11,7 @@ import (
"net"
"os"
"os/exec"
"os/signal"
"path"
"path/filepath"
"runtime"
@ -71,7 +72,7 @@ func commonSetup(dev bool) (*esbuild.BuildOptions, error) {
},
},
},
JSXMode: esbuild.JSXModeAutomatic,
JSX: esbuild.JSXAutomatic,
}, nil
}
@ -137,16 +138,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

@ -21,7 +21,7 @@ require (
github.com/dave/jennifer v1.6.1
github.com/dblohm7/wingoes v0.0.0-20230821191801-fc76608aecf0
github.com/dsnet/try v0.0.3
github.com/evanw/esbuild v0.14.53
github.com/evanw/esbuild v0.19.2
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

@ -260,8 +260,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.19.2 h1:Ju+VvhVepfXW+sNQ189j9aLK4brlN36lEZUajJaK3Ig=
github.com/evanw/esbuild v0.19.2/go.mod h1:iINY06rn799hi48UqEnaQvVfZWe6W9bET78LbvN8VWk=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=