aboutsummaryrefslogtreecommitdiff
path: root/node_modules/webpack-sources/lib
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-12-10 21:51:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2017-12-10 21:51:33 +0100
commit0469abd4a9c9270a1fdc962969e36e63699af8b4 (patch)
treef9864d4a4148621378958794cbbfdc2393733283 /node_modules/webpack-sources/lib
parent6947e79bbc258f7bc96af424ddb71a511f0c15a3 (diff)
upgrade dependencies
Diffstat (limited to 'node_modules/webpack-sources/lib')
-rw-r--r--node_modules/webpack-sources/lib/ConcatSource.js54
-rw-r--r--node_modules/webpack-sources/lib/ReplaceSource.js9
2 files changed, 47 insertions, 16 deletions
diff --git a/node_modules/webpack-sources/lib/ConcatSource.js b/node_modules/webpack-sources/lib/ConcatSource.js
index 8dc712d9c..b2b59707b 100644
--- a/node_modules/webpack-sources/lib/ConcatSource.js
+++ b/node_modules/webpack-sources/lib/ConcatSource.js
@@ -11,25 +11,47 @@ const Source = require("./Source");
class ConcatSource extends Source {
constructor() {
super();
- this.children = Array.prototype.slice.call(arguments);
+ this.children = [];
+ for(var i = 0; i < arguments.length; i++) {
+ var item = arguments[i];
+ if(item instanceof ConcatSource) {
+ var children = item.children;
+ for(var j = 0; j < children.length; j++)
+ this.children.push(children[j]);
+ } else {
+ this.children.push(item);
+ }
+ }
}
add(item) {
- this.children.push(item);
+ if(item instanceof ConcatSource) {
+ var children = item.children;
+ for(var j = 0; j < children.length; j++)
+ this.children.push(children[j]);
+ } else {
+ this.children.push(item);
+ }
}
source() {
- return this.children.map(function(item) {
- return typeof item === "string" ? item : item.source();
- }).join("");
+ let source = "";
+ const children = this.children;
+ for(let i = 0; i < children.length; i++) {
+ const child = children[i];
+ source += typeof child === "string" ? child : child.source();
+ }
+ return source;
}
size() {
- return this.children.map(function(item) {
- return typeof item === "string" ? item.length : item.size();
- }).reduce(function(sum, s) {
- return sum + s;
- }, 0);
+ let size = 0;
+ const children = this.children;
+ for(let i = 0; i < children.length; i++) {
+ const child = children[i];
+ size += typeof child === "string" ? child.length : child.size();
+ }
+ return size;
}
node(options) {
@@ -41,22 +63,26 @@ class ConcatSource extends Source {
listMap(options) {
const map = new SourceListMap();
- this.children.forEach(function(item) {
+ var children = this.children;
+ for(var i = 0; i < children.length; i++) {
+ var item = children[i];
if(typeof item === "string")
map.add(item);
else
map.add(item.listMap(options));
- });
+ }
return map;
}
updateHash(hash) {
- this.children.forEach(function(item) {
+ var children = this.children;
+ for(var i = 0; i < children.length; i++) {
+ var item = children[i];
if(typeof item === "string")
hash.update(item);
else
item.updateHash(hash);
- });
+ }
}
}
diff --git a/node_modules/webpack-sources/lib/ReplaceSource.js b/node_modules/webpack-sources/lib/ReplaceSource.js
index 93cd549d1..7bc4bc880 100644
--- a/node_modules/webpack-sources/lib/ReplaceSource.js
+++ b/node_modules/webpack-sources/lib/ReplaceSource.js
@@ -61,8 +61,13 @@ class ReplaceSource extends Source {
var splitted2 = this._splitString(splitted1[0], Math.floor(repl[0]));
result.push(splitted1[1], repl[2], splitted2[0]);
}, this);
- result = result.reverse();
- return result.join("");
+
+ // write out result array in reverse order
+ let resultStr = "";
+ for(let i = result.length - 1; i >= 0; --i) {
+ resultStr += result[i];
+ }
+ return resultStr;
}
node(options) {