Code coverage report for lib\RawModule.js

Statements: 91.89% (34 / 37)      Branches: 66.67% (4 / 6)      Functions: 72.73% (8 / 11)      Lines: 91.89% (34 / 37)      Ignored: none     

All files » lib\ » RawModule.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66        1 1 1   1 20 20 20 20 20 20   1   1   1 162     1 52     1       1 20 20     1 20 12   8     1 40     1 8 8 8     1 8     1       1      
/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
var Module = require("./Module");
var OriginalSource = require("webpack-core/lib/OriginalSource");
var RawSource = require("webpack-core/lib/RawSource");
 
function RawModule(source, identifier, readableIdentifier) {
	Module.call(this);
	this.sourceStr = source;
	this.identifierStr = identifier || this.sourceStr;
	this.readableIdentifierStr = readableIdentifier || this.identifierStr;
	this.cacheable = true;
	this.built = false;
}
module.exports = RawModule;
 
RawModule.prototype = Object.create(Module.prototype);
 
RawModule.prototype.identifier = function() {
	return this.identifierStr;
};
 
RawModule.prototype.readableIdentifier = function(requestShortener) {
	return requestShortener.shorten(this.readableIdentifierStr);
};
 
RawModule.prototype.needRebuild = function(fileTimestamps, contextTimestamps) {
	return false;
};
 
RawModule.prototype.build = function(options, compilation, resolver, fs, callback) {
	this.builtTime = new Date().getTime();
	callback();
};
 
RawModule.prototype.source = function(dependencyTemplates, outputOptions, requestShortener) {
	if(this.useSourceMap)
		return new OriginalSource(this.sourceStr, this.identifier());
	else
		return new RawSource(this.sourceStr);
};
 
RawModule.prototype.size = function() {
	return this.sourceStr.length;
};
 
RawModule.prototype.getSourceHash = function() {
	var hash = require("crypto").createHash("md5");
	hash.update(this.sourceStr);
	return hash.digest("hex");
};
 
RawModule.prototype.getAllModuleDependencies = function() {
	return [];
};
 
RawModule.prototype.createTemplate = function() {
	return new RawModule(this.sourceStr, "template of " + this.id);
};
 
RawModule.prototype.getTemplateArguments = function() {
	return [];
};