diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-10-25 11:00:14 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-11-05 13:26:54 -0800 |
commit | b3400d822f6e9a1100e693cc06cd09c8249d4422 (patch) | |
tree | c93f4119d3e911f6201b827b13c1f7528f8892a7 /js/v8_source_maps.ts | |
parent | 27ecfc1617c79d23255e025fcbd0257b3523906a (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/v8_source_maps.ts')
-rw-r--r-- | js/v8_source_maps.ts | 9 |
1 files changed, 4 insertions, 5 deletions
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; |