summaryrefslogtreecommitdiff
path: root/js/compiler.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-10-25 11:00:14 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-11-05 13:26:54 -0800
commitb3400d822f6e9a1100e693cc06cd09c8249d4422 (patch)
treec93f4119d3e911f6201b827b13c1f7528f8892a7 /js/compiler.ts
parent27ecfc1617c79d23255e025fcbd0257b3523906a (diff)
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
Diffstat (limited to 'js/compiler.ts')
-rw-r--r--js/compiler.ts6
1 files changed, 6 insertions, 0 deletions
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() {