format: prettify entire project
This commit is contained in:
89
node_modules/source-map-js/lib/util.js
generated
vendored
89
node_modules/source-map-js/lib/util.js
generated
vendored
@ -26,7 +26,8 @@ function getArg(aArgs, aName, aDefaultValue) {
|
||||
}
|
||||
exports.getArg = getArg;
|
||||
|
||||
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
||||
var urlRegexp =
|
||||
/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
|
||||
var dataUrlRegexp = /^data:.+\,.+$/;
|
||||
|
||||
function urlParse(aUrl) {
|
||||
@ -39,7 +40,7 @@ function urlParse(aUrl) {
|
||||
auth: match[2],
|
||||
host: match[3],
|
||||
port: match[4],
|
||||
path: match[5]
|
||||
path: match[5],
|
||||
};
|
||||
}
|
||||
exports.urlParse = urlParse;
|
||||
@ -57,7 +58,7 @@ function urlGenerate(aParsedUrl) {
|
||||
url += aParsedUrl.host;
|
||||
}
|
||||
if (aParsedUrl.port) {
|
||||
url += ":" + aParsedUrl.port
|
||||
url += ':' + aParsedUrl.port;
|
||||
}
|
||||
if (aParsedUrl.path) {
|
||||
url += aParsedUrl.path;
|
||||
@ -78,7 +79,7 @@ var MAX_CACHED_INPUTS = 32;
|
||||
function lruMemoize(f) {
|
||||
var cache = [];
|
||||
|
||||
return function(input) {
|
||||
return function (input) {
|
||||
for (var i = 0; i < cache.length; i++) {
|
||||
if (cache[i].input === input) {
|
||||
var temp = cache[0];
|
||||
@ -131,13 +132,13 @@ var normalize = lruMemoize(function normalize(aPath) {
|
||||
var i = 0;
|
||||
while (true) {
|
||||
start = i;
|
||||
i = path.indexOf("/", start);
|
||||
i = path.indexOf('/', start);
|
||||
if (i === -1) {
|
||||
parts.push(path.slice(start));
|
||||
break;
|
||||
} else {
|
||||
parts.push(path.slice(start, i));
|
||||
while (i < path.length && path[i] === "/") {
|
||||
while (i < path.length && path[i] === '/') {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@ -193,11 +194,11 @@ exports.normalize = normalize;
|
||||
* - Joining for example 'http://' and 'www.example.com' is also supported.
|
||||
*/
|
||||
function join(aRoot, aPath) {
|
||||
if (aRoot === "") {
|
||||
aRoot = ".";
|
||||
if (aRoot === '') {
|
||||
aRoot = '.';
|
||||
}
|
||||
if (aPath === "") {
|
||||
aPath = ".";
|
||||
if (aPath === '') {
|
||||
aPath = '.';
|
||||
}
|
||||
var aPathUrl = urlParse(aPath);
|
||||
var aRootUrl = urlParse(aRoot);
|
||||
@ -223,8 +224,9 @@ function join(aRoot, aPath) {
|
||||
return urlGenerate(aRootUrl);
|
||||
}
|
||||
|
||||
var joined = aPath.charAt(0) === '/'
|
||||
? aPath
|
||||
var joined =
|
||||
aPath.charAt(0) === '/' ?
|
||||
aPath
|
||||
: normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
|
||||
|
||||
if (aRootUrl) {
|
||||
@ -246,8 +248,8 @@ exports.isAbsolute = function (aPath) {
|
||||
* @param aPath The path or URL to be made relative to aRoot.
|
||||
*/
|
||||
function relative(aRoot, aPath) {
|
||||
if (aRoot === "") {
|
||||
aRoot = ".";
|
||||
if (aRoot === '') {
|
||||
aRoot = '.';
|
||||
}
|
||||
|
||||
aRoot = aRoot.replace(/\/$/, '');
|
||||
@ -258,7 +260,7 @@ function relative(aRoot, aPath) {
|
||||
// a prefix that fits, or we run out of components to remove.
|
||||
var level = 0;
|
||||
while (aPath.indexOf(aRoot + '/') !== 0) {
|
||||
var index = aRoot.lastIndexOf("/");
|
||||
var index = aRoot.lastIndexOf('/');
|
||||
if (index < 0) {
|
||||
return aPath;
|
||||
}
|
||||
@ -275,16 +277,16 @@ function relative(aRoot, aPath) {
|
||||
}
|
||||
|
||||
// Make sure we add a "../" for each component we removed from the root.
|
||||
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
||||
return Array(level + 1).join('../') + aPath.substr(aRoot.length + 1);
|
||||
}
|
||||
exports.relative = relative;
|
||||
|
||||
var supportsNullProto = (function () {
|
||||
var obj = Object.create(null);
|
||||
return !('__proto__' in obj);
|
||||
}());
|
||||
})();
|
||||
|
||||
function identity (s) {
|
||||
function identity(s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -326,15 +328,17 @@ function isProtoString(s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
|
||||
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
|
||||
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
|
||||
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
|
||||
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
|
||||
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 9) !== 95 /* '_' */) {
|
||||
if (
|
||||
s.charCodeAt(length - 1) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
|
||||
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
|
||||
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
|
||||
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
|
||||
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
|
||||
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
|
||||
s.charCodeAt(length - 9) !== 95 /* '_' */
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -385,8 +389,12 @@ function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
|
||||
}
|
||||
exports.compareByOriginalPositions = compareByOriginalPositions;
|
||||
|
||||
function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) {
|
||||
var cmp
|
||||
function compareByOriginalPositionsNoSource(
|
||||
mappingA,
|
||||
mappingB,
|
||||
onlyCompareOriginal
|
||||
) {
|
||||
var cmp;
|
||||
|
||||
cmp = mappingA.originalLine - mappingB.originalLine;
|
||||
if (cmp !== 0) {
|
||||
@ -421,7 +429,11 @@ exports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource;
|
||||
* source/name/original line and column the same. Useful when searching for a
|
||||
* mapping with a stubbed out mapping.
|
||||
*/
|
||||
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
|
||||
function compareByGeneratedPositionsDeflated(
|
||||
mappingA,
|
||||
mappingB,
|
||||
onlyCompareGenerated
|
||||
) {
|
||||
var cmp = mappingA.generatedLine - mappingB.generatedLine;
|
||||
if (cmp !== 0) {
|
||||
return cmp;
|
||||
@ -449,9 +461,14 @@ function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGene
|
||||
|
||||
return strcmp(mappingA.name, mappingB.name);
|
||||
}
|
||||
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
|
||||
exports.compareByGeneratedPositionsDeflated =
|
||||
compareByGeneratedPositionsDeflated;
|
||||
|
||||
function compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) {
|
||||
function compareByGeneratedPositionsDeflatedNoLine(
|
||||
mappingA,
|
||||
mappingB,
|
||||
onlyCompareGenerated
|
||||
) {
|
||||
var cmp = mappingA.generatedColumn - mappingB.generatedColumn;
|
||||
if (cmp !== 0 || onlyCompareGenerated) {
|
||||
return cmp;
|
||||
@ -474,7 +491,8 @@ function compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompa
|
||||
|
||||
return strcmp(mappingA.name, mappingB.name);
|
||||
}
|
||||
exports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine;
|
||||
exports.compareByGeneratedPositionsDeflatedNoLine =
|
||||
compareByGeneratedPositionsDeflatedNoLine;
|
||||
|
||||
function strcmp(aStr1, aStr2) {
|
||||
if (aStr1 === aStr2) {
|
||||
@ -528,7 +546,8 @@ function compareByGeneratedPositionsInflated(mappingA, mappingB) {
|
||||
|
||||
return strcmp(mappingA.name, mappingB.name);
|
||||
}
|
||||
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
|
||||
exports.compareByGeneratedPositionsInflated =
|
||||
compareByGeneratedPositionsInflated;
|
||||
|
||||
/**
|
||||
* Strip any JSON XSSI avoidance prefix from the string (as documented
|
||||
@ -577,7 +596,7 @@ function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
|
||||
if (sourceMapURL) {
|
||||
var parsed = urlParse(sourceMapURL);
|
||||
if (!parsed) {
|
||||
throw new Error("sourceMapURL could not be parsed");
|
||||
throw new Error('sourceMapURL could not be parsed');
|
||||
}
|
||||
if (parsed.path) {
|
||||
// Strip the last path component, but keep the "/".
|
||||
|
Reference in New Issue
Block a user