Skip to content

Commit

Permalink
Update Sobek to version with ESM support
Browse files Browse the repository at this point in the history
This still doesn't use them just updates to it
  • Loading branch information
mstoykov committed Jul 9, 2024
1 parent a3e64d8 commit ecde461
Show file tree
Hide file tree
Showing 24 changed files with 2,695 additions and 123 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require (
github.com/go-sourcemap/sourcemap v2.1.4+incompatible
github.com/golang/protobuf v1.5.4
github.com/gorilla/websocket v1.5.1
github.com/grafana/sobek v0.0.0-20240626131919-5be1e93c7efc
github.com/grafana/xk6-browser v1.6.1-0.20240701105714-29f6ef3049fe
github.com/grafana/xk6-dashboard v0.7.5
github.com/grafana/xk6-output-prometheus-remote v0.4.0
Expand Down Expand Up @@ -75,6 +74,7 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grafana/sobek v0.0.0-20240708142253-1d1dbd360a51
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/grafana/sobek v0.0.0-20240626131919-5be1e93c7efc h1:4aFnXIV4UQu+5NL3ZlmYxTZ5hVUXu/U/TKsvBUt5wsA=
github.com/grafana/sobek v0.0.0-20240626131919-5be1e93c7efc/go.mod h1:tUEHKWaMrxFGrMgjeAH85OEceCGQiSl6a/6Wckj/Vf4=
github.com/grafana/sobek v0.0.0-20240708142253-1d1dbd360a51 h1:OqNtCMYUW2mEg5Ang0zMAeuexLSeqoOEVi/MufZXfBI=
github.com/grafana/sobek v0.0.0-20240708142253-1d1dbd360a51/go.mod h1:tUEHKWaMrxFGrMgjeAH85OEceCGQiSl6a/6Wckj/Vf4=
github.com/grafana/xk6-browser v1.6.1-0.20240701105714-29f6ef3049fe h1:uE7e1Lzris7YuM5mRLulkUGBIL9WmPHvLrA2RyZLyy8=
github.com/grafana/xk6-browser v1.6.1-0.20240701105714-29f6ef3049fe/go.mod h1:TNngUsbmV3I5NDVklGxjpAR2znEjYEsBtHQirGw8nAI=
github.com/grafana/xk6-dashboard v0.7.5 h1:TcILyffT/Ea/XD7xG1jMA5lwtusOPRbEQsQDHmO30Mk=
Expand Down
14 changes: 7 additions & 7 deletions js/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func TestNewBundle(t *testing.T) {
// ES2015 modules are not supported
{
"Modules", "base", `export default function() {};`,
"file:///script.js: Line 1:28 Unexpected reserved word (and 2 more errors)",
"file:///script.js: Line 1:28 export not supported in script (and 3 more errors)",
},
// BigInt is not supported
{
Expand Down Expand Up @@ -532,7 +532,7 @@ func TestNewBundleFromArchive(t *testing.T) {

checkArchive(t, arc, lib.RuntimeOptions{}, "") // default options
checkArchive(t, arc, extCompatModeRtOpts, "")
checkArchive(t, arc, baseCompatModeRtOpts, "Unexpected reserved word")
checkArchive(t, arc, baseCompatModeRtOpts, "export not supported in script")
})

t.Run("es6_script_explicit", func(t *testing.T) {
Expand All @@ -543,7 +543,7 @@ func TestNewBundleFromArchive(t *testing.T) {

checkArchive(t, arc, lib.RuntimeOptions{}, "")
checkArchive(t, arc, extCompatModeRtOpts, "")
checkArchive(t, arc, baseCompatModeRtOpts, "Unexpected reserved word")
checkArchive(t, arc, baseCompatModeRtOpts, "export not supported in script")
})

t.Run("es5_script_with_extended", func(t *testing.T) {
Expand Down Expand Up @@ -579,10 +579,10 @@ func TestNewBundleFromArchive(t *testing.T) {
t.Parallel()
arc, err := getArchive(t, es6Code, extCompatModeRtOpts)
require.NoError(t, err)
arc.CompatibilityMode = "blah" // intentionally break the archive
checkArchive(t, arc, lib.RuntimeOptions{}, "invalid compatibility mode") // fails when it uses the archive one
checkArchive(t, arc, extCompatModeRtOpts, "") // works when I force the compat mode
checkArchive(t, arc, baseCompatModeRtOpts, "Unexpected reserved word") // failes because of ES6
arc.CompatibilityMode = "blah" // intentionally break the archive
checkArchive(t, arc, lib.RuntimeOptions{}, "invalid compatibility mode") // fails when it uses the archive one
checkArchive(t, arc, extCompatModeRtOpts, "") // works when I force the compat mode
checkArchive(t, arc, baseCompatModeRtOpts, "export not supported in script") // failes because of ES6
})

t.Run("script_options_dont_overwrite_metadata", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/grafana/sobek/.tc39_test262_checkout.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/grafana/sobek/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 91 additions & 0 deletions vendor/github.com/grafana/sobek/ast/node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 8 additions & 15 deletions vendor/github.com/grafana/sobek/builtin_object.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions vendor/github.com/grafana/sobek/builtin_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ecde461

Please sign in to comment.