From c89c68ad3ab499977d7070541a4e87f8ae8e8533 Mon Sep 17 00:00:00 2001 From: Mia <49593536+mia-pi-git@users.noreply.github.com> Date: Sun, 26 Nov 2023 22:49:46 -0600 Subject: [PATCH] Use source maps for better error stacks This has been very annoying. --- package-lock.json | 25 ++++++++++++++++++++++++- package.json | 3 ++- server/index.ts | 1 + 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 71b906479467..6f8c25ef99ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,8 @@ "preact": "^10.5.15", "preact-render-to-string": "^5.1.19", "probe-image-size": "^7.2.3", - "sockjs": "^0.3.21" + "sockjs": "^0.3.21", + "source-map-support": "^0.5.21" }, "bin": { "pokemon-showdown": "pokemon-showdown" @@ -685,6 +686,11 @@ "ieee754": "^1.1.13" } }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, "node_modules/buffer-writer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", @@ -3140,6 +3146,23 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "node_modules/split2": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/split2/-/split2-4.1.0.tgz", diff --git a/package.json b/package.json index c4ab0c37a335..e60834c4ab6c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "preact": "^10.5.15", "preact-render-to-string": "^5.1.19", "probe-image-size": "^7.2.3", - "sockjs": "^0.3.21" + "sockjs": "^0.3.21", + "source-map-support": "^0.5.21" }, "optionalDependencies": { "better-sqlite3": "^7.6.2", diff --git a/server/index.ts b/server/index.ts index ea4d88a95b60..49475d19dc74 100644 --- a/server/index.ts +++ b/server/index.ts @@ -55,6 +55,7 @@ if (isNaN(nodeVersion) || nodeVersion < 16) { } import {FS, Repl} from '../lib'; +import 'source-map-support/register'; /********************************************************* * Set up most of our globals