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/v8_source_maps.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'js/v8_source_maps.ts') diff --git a/js/v8_source_maps.ts b/js/v8_source_maps.ts index f73cc2d38..cd61955d2 100644 --- a/js/v8_source_maps.ts +++ b/js/v8_source_maps.ts @@ -186,7 +186,7 @@ function CallSiteToString(frame: CallSite): string { // Regex for detecting source maps const reSourceMap = /^data:application\/json[^,]+base64,/; -function loadConsumer(source: string): SourceMapConsumer | null { +export function loadConsumer(source: string): SourceMapConsumer | null { let consumer = consumers.get(source); if (consumer == null) { const code = getGeneratedContents(source); @@ -210,8 +210,8 @@ function loadConsumer(source: string): SourceMapConsumer | null { sourceMapData = arrayToStr(ui8); sourceMappingURL = source; } else { - // Support source map URLs relative to the source URL - //sourceMappingURL = supportRelativeURL(source, sourceMappingURL); + // TODO Support source map URLs relative to the source URL + // sourceMappingURL = supportRelativeURL(source, sourceMappingURL); sourceMapData = getGeneratedContents(sourceMappingURL); } @@ -219,7 +219,6 @@ function loadConsumer(source: string): SourceMapConsumer | null { typeof sourceMapData === "string" ? JSON.parse(sourceMapData) : sourceMapData; - //console.log("sourceMapData", sourceMapData); consumer = new SourceMapConsumer(rawSourceMap); consumers.set(source, consumer); } @@ -242,7 +241,7 @@ function retrieveSourceMapURL(fileData: string): string | null { return lastMatch[1]; } -function mapSourcePosition(position: Position): MappedPosition { +export function mapSourcePosition(position: Position): MappedPosition { const consumer = loadConsumer(position.source); if (consumer == null) { return position; -- cgit v1.2.3