Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Allow source map helpers to fail gracefully for non-string content.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Jan 3, 2018
1 parent c37e118 commit ce81a9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/create-source-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function createSourceMap(filePath, content) {
let lineCount = -1
let mapping = ""

while (newlineRegExp.test(content)) {
while (newlineRegExp.test(content) || lineCount < 0) {
mapping += (++lineCount ? ";" : "") + "AA" + (lineCount ? "C" : "A") + "A"
}

Expand Down
4 changes: 4 additions & 0 deletions src/util/get-source-mapping-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const minLength = nameLength + 6
const { trim } = String.prototype

function getSourceMappingURL(content) {
if (typeof content !== "string") {
return ""
}

const { length } = content

if (length < minLength) {
Expand Down

0 comments on commit ce81a9b

Please sign in to comment.