webpack-core
Advanced tools
Comparing version 0.1.5 to 0.2.0
@@ -6,2 +6,3 @@ /* | ||
var RawSource = require("./RawSource"); | ||
var OriginalSource = require("./OriginalSource"); | ||
var path = require("path"); // TODO refactor | ||
@@ -238,6 +239,10 @@ | ||
function onModuleBuild(source) { | ||
function onModuleBuild(source, sourceMap) { | ||
if(!Buffer.isBuffer(source) && typeof source !== "string") | ||
return onModuleBuildFailed.call(this, new Error("Final loader didn't returned Buffer or String")); | ||
this._source = new RawSource(source); | ||
if(this.identifier) { | ||
this._source = new OriginalSource(source, this.identifier(), sourceMap); | ||
} else { | ||
this._source = new RawSource(source); | ||
} | ||
return callback(); | ||
@@ -244,0 +249,0 @@ } |
@@ -5,2 +5,5 @@ /* | ||
*/ | ||
var SourceNode = require("source-map").SourceNode; | ||
var SourceMapConsumer = require("source-map").SourceMapConsumer; | ||
function Source() { | ||
@@ -26,6 +29,10 @@ this._result = null; | ||
}; | ||
Source.prototype.origins = function() { | ||
Source.prototype.node = function() { | ||
if(!this._result) | ||
this._result = this._bake(); | ||
return this._result.origins; | ||
if(this._result.node) | ||
return this._result.node; | ||
if(this._result.map) | ||
return SourceNode.fromStringWithSourceMap(this._result.source, new SourceMapConsumer(this._result.map)); | ||
return new SourceNode(null, null, null, this._result.source); | ||
}; | ||
@@ -36,5 +43,4 @@ Source.prototype.updateHash = function(hash) { | ||
hash.update(this._result.source || ""); | ||
// TODO | ||
// hash.update(this._result.map || ""); | ||
// hash.update(this._result.origins || ""); | ||
if(this._result.map) | ||
hash.update(JSON.stringify(this._result.map)); | ||
}; |
{ | ||
"name": "webpack-core", | ||
"version": "0.1.5", | ||
"version": "0.2.0", | ||
"author": "Tobias Koppers @sokra", | ||
"description": "The core of webpack and enhanced-require.", | ||
"dependencies": { | ||
"source-map": "https://github.com/sokra/source-map/archive/master.tar.gz" | ||
}, | ||
@@ -8,0 +9,0 @@ "licenses": [ |
@@ -8,2 +8,3 @@ # webpack-core | ||
* the loader stuff | ||
* SourceMap stuff | ||
@@ -10,0 +11,0 @@ Not useable as standalone module, but this may change in the future. |
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
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
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
23360
17
693
16
1
1