The list of environments to support with wasm_exec.js was becoming too
large to maintain. With this change, wasm_exec.js expects that the
environment provides all necessary polyfills.
The standardized "globalThis" is used for accessing the environment.
wasm_exec.js now only provides stub fallbacks for globalThis.fs and
globalThis.process.
All code specific to Node.js is now in a separate file.
Change-Id: I076febbd94d4d7845260faad972f450f74a7b983
Reviewed-on: https://go-review.googlesource.com/c/go/+/347353
Trust: Richard Musiol <neelance@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit adds scripts for running the WebAssembly binaries that the
Go compiler will produce.
The script go_js_wasm_exec uses Node.js to run the binaries. Adding it
to PATH will enable "go run" and "go test" to work for js/wasm
without having to manually provide the -exec flag.
See https://golang.org/cmd/go/#hdr-Compile_and_run_Go_program
for more information.
The web page wasm_exec.html is an example on how to run the same
binaries in a web browser.
Both scripts use wasm_exec.js as a shared library.
Updates #18892
Change-Id: Ia4d9bea025957750baa0d0651243dc88f156f85d
Reviewed-on: https://go-review.googlesource.com/103255
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>