forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModuleTemplate.js
24 lines (21 loc) · 970 Bytes
/
ModuleTemplate.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
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var Template = require("./Template");
function ModuleTemplate(outputOptions) {
Template.call(this, outputOptions);
}
module.exports = ModuleTemplate;
ModuleTemplate.prototype = Object.create(Template.prototype);
ModuleTemplate.prototype.constructor = ModuleTemplate;
ModuleTemplate.prototype.render = function(module, dependencyTemplates, chunk) {
var moduleSource = module.source(dependencyTemplates, this.outputOptions, this.requestShortener);
moduleSource = this.applyPluginsWaterfall("module", moduleSource, module, chunk, dependencyTemplates);
moduleSource = this.applyPluginsWaterfall("render", moduleSource, module, chunk, dependencyTemplates);
return this.applyPluginsWaterfall("package", moduleSource, module, chunk, dependencyTemplates);
};
ModuleTemplate.prototype.updateHash = function(hash) {
hash.update("1");
this.applyPlugins("hash", hash);
};