webpack-sources
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -58,4 +58,7 @@ /* | ||
this.children.forEach(function(item) { | ||
item.updateHash(hash); | ||
if(typeof item === "string") | ||
hash.update(item); | ||
else | ||
item.updateHash(hash); | ||
}); | ||
}; |
{ | ||
"name": "webpack-sources", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Source code handling classes for webpack", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -65,2 +65,43 @@ var should = require("should"); | ||
}); | ||
it('should be able to handle strings for all methods', function() { | ||
var source = new ConcatSource( | ||
new RawSource("Hello World\n"), | ||
new OriginalSource("console.log('test');\nconsole.log('test2');\n", "console.js") | ||
); | ||
source.add("console.log('string')"); | ||
var expectedSource = [ | ||
"Hello World", | ||
"console.log('test');", | ||
"console.log('test2');", | ||
"console.log('string')", | ||
].join("\n"); | ||
var expectedMap1 = { | ||
version: 3, | ||
file: "x", | ||
mappings: ";AAAA;AACA;", | ||
sources: [ | ||
"console.js" | ||
], | ||
sourcesContent: [ | ||
"console.log('test');\nconsole.log('test2');\n", | ||
] | ||
}; | ||
source.size().should.be.eql(76); | ||
source.source().should.be.eql(expectedSource); | ||
source.map({ | ||
columns: false | ||
}).should.be.eql(expectedMap1); | ||
source.sourceAndMap({ | ||
columns: false | ||
}).should.be.eql({ | ||
source: expectedSource, | ||
map: expectedMap1 | ||
}); | ||
var hash = require('crypto').createHash('sha256') | ||
source.updateHash(hash) | ||
var digest = hash.digest('hex') | ||
digest.should.be.eql('c7172c1aa78e1ab61b365fadb9b6f192a770c2b91c8b5c65314b4911431a1a31') | ||
}) | ||
}); |
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
32571
23
762