|
|
@ -14,6 +14,9 @@ var fileContentsCache = {};
|
|
|
|
// Maps a file path to a source map for that file
|
|
|
|
// Maps a file path to a source map for that file
|
|
|
|
var sourceMapCache = {};
|
|
|
|
var sourceMapCache = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Regex for detecting source maps
|
|
|
|
|
|
|
|
var reSourceMap = /^data:application\/json[^,]+base64,/;
|
|
|
|
|
|
|
|
|
|
|
|
function isInBrowser() {
|
|
|
|
function isInBrowser() {
|
|
|
|
return ((typeof window !== 'undefined') && (typeof XMLHttpRequest === 'function'));
|
|
|
|
return ((typeof window !== 'undefined') && (typeof XMLHttpRequest === 'function'));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -97,10 +100,10 @@ function retrieveSourceMap(source) {
|
|
|
|
|
|
|
|
|
|
|
|
// Read the contents of the source map
|
|
|
|
// Read the contents of the source map
|
|
|
|
var sourceMapData;
|
|
|
|
var sourceMapData;
|
|
|
|
var dataUrlPrefix = "data:application/json;base64,";
|
|
|
|
if (reSourceMap.test(sourceMappingURL)) {
|
|
|
|
if (sourceMappingURL.slice(0, dataUrlPrefix.length).toLowerCase() == dataUrlPrefix) {
|
|
|
|
|
|
|
|
// Support source map URL as a data url
|
|
|
|
// Support source map URL as a data url
|
|
|
|
sourceMapData = new Buffer(sourceMappingURL.slice(dataUrlPrefix.length), "base64").toString();
|
|
|
|
var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(',') + 1);
|
|
|
|
|
|
|
|
sourceMapData = new Buffer(rawData, "base64").toString();
|
|
|
|
sourceMappingURL = null;
|
|
|
|
sourceMappingURL = null;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// Support source map URLs relative to the source URL
|
|
|
|
// Support source map URLs relative to the source URL
|
|
|
|