webpack-sources
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -0,0 +0,0 @@ /* |
@@ -14,21 +14,43 @@ /* | ||
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; | ||
} | ||
@@ -45,3 +67,5 @@ | ||
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") | ||
@@ -51,3 +75,3 @@ map.add(item); | ||
map.add(item.listMap(options)); | ||
}); | ||
} | ||
return map; | ||
@@ -57,3 +81,5 @@ } | ||
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") | ||
@@ -63,3 +89,3 @@ hash.update(item); | ||
item.updateHash(hash); | ||
}); | ||
} | ||
} | ||
@@ -66,0 +92,0 @@ } |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -64,4 +64,9 @@ /* | ||
}, 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; | ||
} | ||
@@ -68,0 +73,0 @@ |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
{ | ||
"name": "webpack-sources", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Source code handling classes for webpack", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -133,3 +133,3 @@ # webpack-sources | ||
Represents source code, which is mapped line by line to the orginal file. | ||
Represents source code, which is mapped line by line to the original file. | ||
@@ -136,0 +136,0 @@ ``` js |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27990
684