From c431c9d261b960c54cfed9abe386ff719c6370b0 Mon Sep 17 00:00:00 2001 From: Nathan Holland Date: Tue, 31 Oct 2017 17:50:51 -0600 Subject: [PATCH 1/2] Add extra check for null mapping source in addMappingWithCode --- lib/source-node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/source-node.js b/lib/source-node.js index 8bcdbe38..7b76d717 100644 --- a/lib/source-node.js +++ b/lib/source-node.js @@ -151,7 +151,7 @@ SourceNode.fromStringWithSourceMap = if (mapping === null || mapping.source === undefined) { node.add(code); } else { - var source = aRelativePath + var source = aRelativePath && mapping.source ? util.join(aRelativePath, mapping.source) : mapping.source; node.add(new SourceNode(mapping.originalLine, From 5cccc9effa7af6fd07d536afcb877fee40835aeb Mon Sep 17 00:00:00 2001 From: Nathan Holland Date: Sun, 29 Apr 2018 14:19:31 -0600 Subject: [PATCH 2/2] Remove check for undefined mapping source, add path check to util.join --- lib/source-node.js | 2 +- lib/util.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/source-node.js b/lib/source-node.js index 7b76d717..8bcdbe38 100644 --- a/lib/source-node.js +++ b/lib/source-node.js @@ -151,7 +151,7 @@ SourceNode.fromStringWithSourceMap = if (mapping === null || mapping.source === undefined) { node.add(code); } else { - var source = aRelativePath && mapping.source + var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source; node.add(new SourceNode(mapping.originalLine, diff --git a/lib/util.js b/lib/util.js index 2c4e3366..d8650615 100644 --- a/lib/util.js +++ b/lib/util.js @@ -197,7 +197,7 @@ function join(aRoot, aPath) { if (aRoot === "") { aRoot = "."; } - if (aPath === "") { + if (!aPath || aPath === "") { aPath = "."; } var aPathUrl = urlParse(aPath);