Report constructor correctly when inheriting from Tapable

This commit is contained in:
Ahmet Katrancı 2015-08-18 12:35:57 +01:00
parent c0afdf9c6a
commit 8ff6cb5fed
9 changed files with 15 additions and 0 deletions

View File

@ -59,6 +59,8 @@ function Compilation(compiler) {
module.exports = Compilation;
Compilation.prototype = Object.create(Tapable.prototype);
Compilation.prototype.constructor = Compilation;
Compilation.prototype.templatesPlugin = function(name, fn) {
this.mainTemplate.plugin(name, fn);
this.chunkTemplate.plugin(name, fn);

View File

@ -152,6 +152,7 @@ function Compiler() {
module.exports = Compiler;
Compiler.prototype = Object.create(Tapable.prototype);
Compiler.prototype.constructor = Compiler;
Compiler.Watching = Watching;
Compiler.prototype.watch = function(watchOptions, handler) {

View File

@ -16,6 +16,8 @@ function ContextModuleFactory(resolvers) {
module.exports = ContextModuleFactory;
ContextModuleFactory.prototype = Object.create(Tapable.prototype);
ContextModuleFactory.prototype.constructor = ContextModuleFactory;
ContextModuleFactory.prototype.create = function(context, dependency, callback) {
this.applyPluginsAsyncWaterfall("before-resolve", {
context: context,

View File

@ -11,6 +11,8 @@ function DllModuleFactory() {
module.exports = DllModuleFactory;
DllModuleFactory.prototype = Object.create(Tapable.prototype);
DllModuleFactory.prototype.constructor = DllModuleFactory;
DllModuleFactory.prototype.create = function(context, dependency, callback) {
callback(null, new DllModule(context, dependency.dependencies, dependency.name, dependency.type));
};

View File

@ -88,6 +88,7 @@ function MultiCompiler(compilers) {
module.exports = MultiCompiler;
MultiCompiler.prototype = Object.create(Tapable.prototype);
MultiCompiler.prototype.constructor = MultiCompiler;
MultiCompiler.prototype.watch = function(watchDelay, handler) {
var watchings = this.compilers.map(function(compiler) {

View File

@ -11,6 +11,8 @@ function MultiModuleFactory() {
module.exports = MultiModuleFactory;
MultiModuleFactory.prototype = Object.create(Tapable.prototype);
MultiModuleFactory.prototype.constructor = MultiModuleFactory;
MultiModuleFactory.prototype.create = function(context, dependency, callback) {
callback(null, new MultiModule(context, dependency.dependencies, dependency.name));
};

View File

@ -133,6 +133,8 @@ function NormalModuleFactory(context, resolvers, parser, options) {
module.exports = NormalModuleFactory;
NormalModuleFactory.prototype = Object.create(Tapable.prototype);
NormalModuleFactory.prototype.constructor = NormalModuleFactory;
NormalModuleFactory.prototype.create = function(context, dependency, callback) {
context = context || this.context;
var request = dependency.request;

View File

@ -16,6 +16,8 @@ module.exports = Parser;
// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
Parser.prototype = Object.create(Tapable.prototype);
Parser.prototype.constructor = Parser;
Parser.prototype.initializeEvaluating = function() {
function joinRanges(startRange, endRange) {
if(!endRange) return startRange;

View File

@ -21,6 +21,7 @@ Template.toIdentifier = function(str) {
};
Template.prototype = Object.create(Tapable.prototype);
Template.prototype.constructor = Template;
Template.prototype.indent = function indent(str) {
if(Array.isArray(str)) {