webpack-core
Advanced tools
Comparing version 0.2.6 to 0.2.7
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -251,3 +251,3 @@ /* | ||
return onModuleBuildFailed.call(this, new Error("Final loader didn't returned Buffer or String")); | ||
if(this.identifier) { | ||
if(this.identifier && this.useSourceMap) { | ||
this._source = new OriginalSource(source, this.identifier(), sourceMap); | ||
@@ -254,0 +254,0 @@ } else { |
@@ -0,0 +0,0 @@ /* |
@@ -9,5 +9,12 @@ /* | ||
var splitAtChars = ";{}".split(""); | ||
var splitAt = {}; | ||
splitAtChars.forEach(function(ch) { splitAt[ch] = true; }); | ||
function isSplitter(c) { | ||
switch(c) { | ||
case 10: // \n | ||
case 59: // ; | ||
case 123: // { | ||
case 125: // } | ||
return true; | ||
} | ||
return false; | ||
} | ||
function _splitCode(code) { | ||
@@ -17,5 +24,6 @@ var result = []; | ||
for(; i < code.length; i++) { | ||
if(splitAt[code[i]] === true) { | ||
result.push(code.substring(j, i + 1)); | ||
j = i + 1; | ||
if(isSplitter(code.charCodeAt(i))) { | ||
while(isSplitter(code.charCodeAt(++i))); | ||
result.push(code.substring(j, i)); | ||
j = i; | ||
} | ||
@@ -22,0 +30,0 @@ } |
@@ -10,5 +10,5 @@ /* | ||
var node = source.node(); | ||
var append = [prefix]; | ||
node = new SourceNode(null, null, null, [ | ||
prefix, | ||
this._cloneAndReplace(node, /\n/g, "\n" + prefix) | ||
this._cloneAndPrefix(node, prefix, append) | ||
]); | ||
@@ -20,5 +20,8 @@ SourceMapNodeSource.call(this, node); | ||
PrefixSource.prototype = Object.create(SourceMapNodeSource.prototype); | ||
PrefixSource.prototype._cloneAndReplace = function cloneAndReplace(node, regExp, replacement) { | ||
PrefixSource.prototype._cloneAndPrefix = function cloneAndPrefix(node, prefix, append) { | ||
if(typeof node === "string") { | ||
return node.replace(regExp, replacement); | ||
var result = node.replace(/\n(.)/g, prefix + "$1"); | ||
if(append.length > 0) result = append.pop() + result; | ||
if(/\n$/.test(node)) append.push(prefix); | ||
return result; | ||
} else { | ||
@@ -30,11 +33,9 @@ var newNode = new SourceNode( | ||
node.children.map(function(node) { | ||
return cloneAndReplace(node, regExp, replacement); | ||
return cloneAndPrefix(node, prefix, append); | ||
}), | ||
node.name | ||
); | ||
node.walkSourceContents(function(file, content) { | ||
newNode.setSourceContent(file, content); | ||
}); | ||
newNode.sourceContents = node.sourceContents; | ||
return newNode; | ||
} | ||
}; |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -45,3 +45,3 @@ /* | ||
}; | ||
Source.prototype.updateHash = function(hash) { | ||
SourceMapNodeSource.prototype.updateHash = function(hash) { | ||
if(!this._node) this._node = this._bake(); | ||
@@ -48,0 +48,0 @@ updateHashForNode(this._node, hash); |
@@ -0,0 +0,0 @@ /* |
{ | ||
"name": "webpack-core", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "The core of webpack and enhanced-require.", |
@@ -0,0 +0,0 @@ # webpack-core |
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
797
25804