sourcemap-validator
Advanced tools
Comparing version 1.0.6 to 1.0.7
13
index.js
@@ -8,3 +8,4 @@ var validate | ||
, template = require('lodash.template') | ||
, jsesc = require('jsesc'); | ||
, jsesc = require('jsesc') | ||
, fancyArrow = String.fromCharCode(parseInt(2192,16)); | ||
@@ -89,5 +90,3 @@ // Lifted from UglifyJS | ||
, errMsg | ||
, mapRef = template('<%=generatedLine%>:<%=generatedColumn%>' | ||
+ String.fromCharCode(parseInt(2192,16)) // Fancy arrow! | ||
+ '<%=originalLine%>:<%=originalColumn%> "<%=name%>" in <%=source%>')(mapping) | ||
, mapRef | ||
, expected | ||
@@ -98,4 +97,5 @@ , actuals = [] | ||
if(mapping.name) { | ||
if(!splitSrcs[mapping.source]) | ||
if(!splitSrcs[mapping.source]) { | ||
throw new Error(mapping.source + ' not found in ' + Object.keys(splitSrcs).join(', ')); | ||
} | ||
@@ -131,2 +131,5 @@ originalLine = splitSrcs[mapping.source][mapping.originalLine - 1]; | ||
if(!success) { | ||
mapRef = template('<%=generatedLine%>:<%=generatedColumn%>' | ||
+ fancyArrow | ||
+ '<%=originalLine%>:<%=originalColumn%> "<%=name%>" in <%=source%>')(mapping); | ||
errMsg = template('' | ||
@@ -133,0 +136,0 @@ + 'Warning: mismatched names\n' |
@@ -21,3 +21,3 @@ { | ||
], | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"repository": { | ||
@@ -24,0 +24,0 @@ "type": "git", |
@@ -26,8 +26,7 @@ sourcemap-validator | ||
, assert = require('assert') | ||
, raw = fs.readFileSync('jquery.js') | ||
, min = fs.readFileSync('jquery.min.js') | ||
, map = fs.readFileSync('jquery.min.map'); | ||
, min = fs.readFileSync('jquery.min.js', 'utf-8') | ||
, map = fs.readFileSync('jquery.min.map', 'utf-8'); | ||
assert.doesNotThrow(function () { | ||
validate({'jquery.js': raw}, min, map); | ||
validate(min, map, {'jquery.js': raw}); | ||
}, 'The sourcemap is not valid'); | ||
@@ -40,9 +39,9 @@ ``` | ||
, assert = require('assert') | ||
, min = fs.readFileSync('bundle.min.js') | ||
, map = fs.readFileSync('bundle.min.map'); | ||
, min = fs.readFileSync('bundle.min.js', 'utf-8') | ||
, map = fs.readFileSync('bundle.min.map', 'utf-8'); | ||
// Browserify bundles have inline sourceContent in their maps | ||
// so pass an emtpy object as the first argument. | ||
// so no need to pass a `sourceContent` object. | ||
assert.doesNotThrow(function () { | ||
validate({}, min, map); | ||
validate(min, map); | ||
}, 'The sourcemap is not valid'); | ||
@@ -49,0 +48,0 @@ ``` |
1321314
27159
90