From b3400d822f6e9a1100e693cc06cd09c8249d4422 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 25 Oct 2018 11:00:14 -0400 Subject: Decode main.js.map during snapshotting. Pro: time ./out/debug/deno tests/error_001.ts 3.0s -> 0.4s Con: time ./tool/build.py snapshot 33s -> 1m52s out/debug/gen/snapshot_deno.bin 39M -> 121M --- js/compiler.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'js/compiler.ts') diff --git a/js/compiler.ts b/js/compiler.ts index 941691f5c..a6b6e6970 100644 --- a/js/compiler.ts +++ b/js/compiler.ts @@ -388,6 +388,7 @@ export class DenoCompiler let lastModule: ModuleMetaData | undefined; sourceMaps.install({ installPrepareStackTrace: true, + getGeneratedContents: (fileName: string): string | RawSourceMap => { this._log("compiler.getGeneratedContents", fileName); if (fileName === "gen/bundle/main.js") { @@ -419,6 +420,11 @@ export class DenoCompiler } } }); + // Pre-compute source maps for main.js.map. This will happen at compile-time + // as long as Compiler is instanciated before the snapshot is created.. + const consumer = sourceMaps.loadConsumer("gen/bundle/main.js"); + assert(consumer != null); + consumer!.computeColumnSpans(); } private constructor() { -- cgit v1.2.3