Skip to content

Commit 22c65b8

Browse files
committed
Use Node's native source map support instead of a third-party module.
Since Node 12 it supports the --enable-source-maps flag, which has been considered stable since Node 14. Given we are now on 18, we can drop the unneeded dependency and use the built-in flag.
1 parent 6770879 commit 22c65b8

File tree

4 files changed

+2
-40
lines changed

4 files changed

+2
-40
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ _Note: GopherJS will try to write compiled object files of the core packages to
5757

5858
#### gopherjs run, gopherjs test
5959

60-
If you want to use `gopherjs run` or `gopherjs test` to run the generated code locally, install Node.js 10.0.0 (or newer), and the `source-map-support` module:
61-
62-
```
63-
npm install --global source-map-support
64-
```
60+
If you want to use `gopherjs run` or `gopherjs test` to run the generated code locally, install Node.js 18 (or newer).
6561

6662
On supported `GOOS` platforms, it's possible to make system calls (file system access, etc.) available. See [doc/syscalls.md](https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md) for instructions on how to do so.
6763

package-lock.json

Lines changed: 0 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"name": "gopherjs",
33
"license": "BSD-2-Clause",
4-
"dependencies": {
5-
"source-map-support": "^0.5.19"
6-
},
74
"optionalDependencies": {
85
"syscall": "file:./node-syscall"
96
}

tool.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -838,13 +838,7 @@ func sprintError(err error) string {
838838
func runNode(script string, args []string, dir string, quiet bool, out io.Writer) error {
839839
var allArgs []string
840840
if b, _ := strconv.ParseBool(os.Getenv("SOURCE_MAP_SUPPORT")); os.Getenv("SOURCE_MAP_SUPPORT") == "" || b {
841-
allArgs = []string{"--require", "source-map-support/register"}
842-
if err := exec.Command("node", "--require", "source-map-support/register", "--eval", "").Run(); err != nil {
843-
if !quiet {
844-
fmt.Fprintln(os.Stderr, "gopherjs: Source maps disabled. Install source-map-support module for nice stack traces. See https://github.com/gopherjs/gopherjs#gopherjs-run-gopherjs-test.")
845-
}
846-
allArgs = []string{}
847-
}
841+
allArgs = []string{"--enable-source-maps"}
848842
}
849843

850844
if runtime.GOOS != "windows" {

0 commit comments

Comments
 (0)