summaryrefslogtreecommitdiff
path: root/js/main.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2018-11-06 15:08:25 +1100
committerRyan Dahl <ry@tinyclouds.org>2018-11-06 06:37:16 -0800
commitf477b45a0a398e379ecafd2525c460f2793a43c2 (patch)
tree5a1782f818ad11fe0aa09fcc0d904b3a8ef7549f /js/main.ts
parent7a17e2aec6307d37b7fe3bd9c7af0beb15ec924b (diff)
Improve preparing stack traces
Diffstat (limited to 'js/main.ts')
-rw-r--r--js/main.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/js/main.ts b/js/main.ts
index 02e5dcb4d..176f098c7 100644
--- a/js/main.ts
+++ b/js/main.ts
@@ -9,11 +9,19 @@ import { args } from "./deno";
import { sendSync, handleAsyncMsgFromRust } from "./dispatch";
import { promiseErrorExaminer, promiseRejectHandler } from "./promise_util";
import { replLoop } from "./repl";
+import * as sourceMaps from "./v8_source_maps";
import { version } from "typescript";
-// Instantiate compiler at the top-level so it decodes source maps for the main
-// bundle during snapshot.
+// Install the source maps handler and do some pre-calculations so all of it is
+// available in the snapshot
const compiler = DenoCompiler.instance();
+sourceMaps.install({
+ installPrepareStackTrace: true,
+ getGeneratedContents: compiler.getGeneratedContents
+});
+const consumer = sourceMaps.loadConsumer("gen/bundle/main.js");
+assert(consumer != null);
+consumer!.computeColumnSpans();
function sendStart(): msg.StartRes {
const builder = flatbuffers.createBuilder();