From 8e22320b64ca3fe80e59f0a1b4421cb043ff08d5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Thu, 24 Jan 2019 19:32:43 +0000 Subject: [PATCH 1/2] fix(deps): update dependency source-map to ^0.7.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c2b0505c..42e8d260 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "pretty-ms": "^4.0.0", "protobufjs": "~6.8.6", "semver": "^5.5.1", - "source-map": "^0.6.1", + "source-map": "^0.7.0", "split": "^1.0.1", "teeny-request": "^3.3.0" }, From bc5aff8732e7f0bbaa263251ba7f5bc30645caf4 Mon Sep 17 00:00:00 2001 From: Maggie Nolan Date: Fri, 1 Feb 2019 09:16:27 -0800 Subject: [PATCH 2/2] update sourcemapper to work with source-map 0.7.0 --- ts/src/sourcemapper/sourcemapper.ts | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/ts/src/sourcemapper/sourcemapper.ts b/ts/src/sourcemapper/sourcemapper.ts index 9dadd58a..1d9c56d6 100644 --- a/ts/src/sourcemapper/sourcemapper.ts +++ b/ts/src/sourcemapper/sourcemapper.ts @@ -35,7 +35,7 @@ const MAP_EXT = '.map'; export interface MapInfoCompiled { mapFileDir: string; - mapConsumer: sourceMap.RawSourceMap; + mapConsumer: sourceMap.SourceMapConsumer; } export interface GeneratedLocation { @@ -68,24 +68,15 @@ async function processSourceMap( } mapPath = path.normalize(mapPath); - let contents; + let contents: sourceMap.RawSourceMap; try { contents = await readFile(mapPath, 'utf8'); } catch (e) { throw new Error('Could not read source map file ' + mapPath + ': ' + e); } - - let consumer: sourceMap.RawSourceMap; + let consumer: sourceMap.SourceMapConsumer; try { - // TODO: Determine how to reconsile the type conflict where `consumer` - // is constructed as a SourceMapConsumer but is used as a - // RawSourceMap. - // TODO: Resolve the cast of `contents as any` (This is needed because the - // type is expected to be of `RawSourceMap` but the existing - // working code uses a string.) - consumer = new sourceMap.SourceMapConsumer( - contents as {} as sourceMap.RawSourceMap) as {} as - sourceMap.RawSourceMap; + consumer = await new sourceMap.SourceMapConsumer(contents); } catch (e) { throw new Error( 'An error occurred while reading the ' + @@ -100,7 +91,7 @@ async function processSourceMap( */ const dir = path.dirname(mapPath); const generatedBase = - consumer.file ? consumer.file : path.basename(mapPath, MAP_EXT); + contents.file ? contents.file : path.basename(mapPath, MAP_EXT); const generatedPath = path.resolve(dir, generatedBase); infoMap.set(generatedPath, {mapFileDir: dir, mapConsumer: consumer}); @@ -196,7 +187,7 @@ export class SourceMapper { file: path.resolve(entry.mapFileDir, pos.source), line: pos.line || undefined, name: pos.name || location.name, - column: pos.column, + column: pos.column || undefined, }; } }