From f477b45a0a398e379ecafd2525c460f2793a43c2 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 6 Nov 2018 15:08:25 +1100 Subject: Improve preparing stack traces --- js/main.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'js/main.ts') 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(); -- cgit v1.2.3