Sha256: 0ef5ea5bb511719fa94089c62bb7656442a00b42414567f1d867b4991bcb9c39

Contents?: true

Size: 1.76 KB

Versions: 62

Compression:

Stored size: 1.76 KB

Contents

/*
	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 [];
};

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
smock-0.1.268 node_modules/webpack/lib/RawModule.js
smock-0.1.267 node_modules/webpack/lib/RawModule.js
smock-0.1.266 node_modules/webpack/lib/RawModule.js
smock-0.1.265 node_modules/webpack/lib/RawModule.js
smock-0.1.264 node_modules/webpack/lib/RawModule.js
smock-0.1.263 node_modules/webpack/lib/RawModule.js
smock-0.1.262 node_modules/webpack/lib/RawModule.js
smock-0.1.261 node_modules/webpack/lib/RawModule.js
smock-0.1.260 node_modules/webpack/lib/RawModule.js
smock-0.1.259 node_modules/webpack/lib/RawModule.js
smock-0.1.258 node_modules/webpack/lib/RawModule.js
smock-0.1.256 node_modules/webpack/lib/RawModule.js
smock-0.1.255 node_modules/webpack/lib/RawModule.js
smock-0.1.254 node_modules/webpack/lib/RawModule.js
smock-0.1.253 node_modules/webpack/lib/RawModule.js
smock-0.1.252 node_modules/webpack/lib/RawModule.js
smock-0.1.251 node_modules/webpack/lib/RawModule.js
smock-0.1.250 node_modules/webpack/lib/RawModule.js
smock-0.1.249 node_modules/webpack/lib/RawModule.js
smock-0.1.247 node_modules/webpack/lib/RawModule.js