Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(987)

Unified Diff: node_modules/vulcanize/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-consumer.js

Issue 800513006: Added vulcanize under third_party/npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: node_modules/vulcanize/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-consumer.js
diff --git a/node_modules/karma/node_modules/source-map/lib/source-map/source-map-consumer.js b/node_modules/vulcanize/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-consumer.js
similarity index 94%
copy from node_modules/karma/node_modules/source-map/lib/source-map/source-map-consumer.js
copy to node_modules/vulcanize/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-consumer.js
index ea643bf09cae753dca9db155f07753abec01259a..5214d5e7c9f1ef61d573b397ab26003b0115375e 100644
--- a/node_modules/karma/node_modules/source-map/lib/source-map/source-map-consumer.js
+++ b/node_modules/vulcanize/node_modules/uglify-js/node_modules/source-map/lib/source-map/source-map-consumer.js
@@ -116,7 +116,7 @@ define(function (require, exports, module) {
Object.defineProperty(SourceMapConsumer.prototype, 'sources', {
get: function () {
return this._sources.toArray().map(function (s) {
- return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;
+ return this.sourceRoot ? util.join(this.sourceRoot, s) : s;
}, this);
}
});
@@ -177,12 +177,6 @@ define(function (require, exports, module) {
}
});
- SourceMapConsumer.prototype._nextCharIsMappingSeparator =
- function SourceMapConsumer_nextCharIsMappingSeparator(aStr) {
- var c = aStr.charAt(0);
- return c === ";" || c === ",";
- };
-
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
@@ -196,9 +190,10 @@ define(function (require, exports, module) {
var previousOriginalColumn = 0;
var previousSource = 0;
var previousName = 0;
+ var mappingSeparator = /^[,;]/;
var str = aStr;
- var temp = {};
var mapping;
+ var temp;
while (str.length > 0) {
if (str.charAt(0) === ';') {
@@ -214,41 +209,41 @@ define(function (require, exports, module) {
mapping.generatedLine = generatedLine;
// Generated column.
- base64VLQ.decode(str, temp);
+ temp = base64VLQ.decode(str);
mapping.generatedColumn = previousGeneratedColumn + temp.value;
previousGeneratedColumn = mapping.generatedColumn;
str = temp.rest;
- if (str.length > 0 && !this._nextCharIsMappingSeparator(str)) {
+ if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {
// Original source.
- base64VLQ.decode(str, temp);
+ temp = base64VLQ.decode(str);
mapping.source = this._sources.at(previousSource + temp.value);
previousSource += temp.value;
str = temp.rest;
- if (str.length === 0 || this._nextCharIsMappingSeparator(str)) {
+ if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {
throw new Error('Found a source, but no line and column');
}
// Original line.
- base64VLQ.decode(str, temp);
+ temp = base64VLQ.decode(str);
mapping.originalLine = previousOriginalLine + temp.value;
previousOriginalLine = mapping.originalLine;
// Lines are stored 0-based
mapping.originalLine += 1;
str = temp.rest;
- if (str.length === 0 || this._nextCharIsMappingSeparator(str)) {
+ if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {
throw new Error('Found a source and line, but no column');
}
// Original column.
- base64VLQ.decode(str, temp);
+ temp = base64VLQ.decode(str);
mapping.originalColumn = previousOriginalColumn + temp.value;
previousOriginalColumn = mapping.originalColumn;
str = temp.rest;
- if (str.length > 0 && !this._nextCharIsMappingSeparator(str)) {
+ if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {
// Original name.
- base64VLQ.decode(str, temp);
+ temp = base64VLQ.decode(str);
mapping.name = this._names.at(previousName + temp.value);
previousName += temp.value;
str = temp.rest;
@@ -320,7 +315,7 @@ define(function (require, exports, module) {
if (mapping && mapping.generatedLine === needle.generatedLine) {
var source = util.getArg(mapping, 'source', null);
- if (source != null && this.sourceRoot != null) {
+ if (source && this.sourceRoot) {
source = util.join(this.sourceRoot, source);
}
return {
@@ -350,7 +345,7 @@ define(function (require, exports, module) {
return null;
}
- if (this.sourceRoot != null) {
+ if (this.sourceRoot) {
aSource = util.relative(this.sourceRoot, aSource);
}
@@ -359,7 +354,7 @@ define(function (require, exports, module) {
}
var url;
- if (this.sourceRoot != null
+ if (this.sourceRoot
&& (url = util.urlParse(this.sourceRoot))) {
// XXX: file:// URIs and absolute paths lead to unexpected behavior for
// many users. We can help them out when they expect file:// URIs to
@@ -402,7 +397,7 @@ define(function (require, exports, module) {
originalColumn: util.getArg(aArgs, 'column')
};
- if (this.sourceRoot != null) {
+ if (this.sourceRoot) {
needle.source = util.relative(this.sourceRoot, needle.source);
}
@@ -464,7 +459,7 @@ define(function (require, exports, module) {
var sourceRoot = this.sourceRoot;
mappings.map(function (mapping) {
var source = mapping.source;
- if (source != null && sourceRoot != null) {
+ if (source && sourceRoot) {
source = util.join(sourceRoot, source);
}
return {

Powered by Google App Engine
This is Rietveld 408576698