From 363723fc84f7b8477592e0105aeb331ec9a017af Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Aug 2017 05:01:11 +0200 Subject: node_modules --- node_modules/tapable/lib/Tapable.js | 75 +++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) (limited to 'node_modules/tapable/lib/Tapable.js') diff --git a/node_modules/tapable/lib/Tapable.js b/node_modules/tapable/lib/Tapable.js index c7521baf7..a8514c416 100644 --- a/node_modules/tapable/lib/Tapable.js +++ b/node_modules/tapable/lib/Tapable.js @@ -84,11 +84,13 @@ Tapable.prototype.applyPlugins2 = function applyPlugins2(name, param1, param2) { Tapable.prototype.applyPluginsWaterfall = function applyPluginsWaterfall(name, init) { if(!this._plugins[name]) return init; - var args = Array.prototype.slice.call(arguments, 2); + var args = Array.prototype.slice.call(arguments, 1); var plugins = this._plugins[name]; var current = init; - for(var i = 0; i < plugins.length; i++) - current = plugins[i].apply(this, [current].concat(args)); + for(var i = 0; i < plugins.length; i++) { + args[0] = current; + current = plugins[i].apply(this, args); + } return current; }; @@ -101,6 +103,24 @@ Tapable.prototype.applyPluginsWaterfall0 = function applyPluginsWaterfall0(name, return current; }; +Tapable.prototype.applyPluginsWaterfall1 = function applyPluginsWaterfall1(name, init, param) { + var plugins = this._plugins[name]; + if(!plugins) return init; + var current = init; + for(var i = 0; i < plugins.length; i++) + current = plugins[i].call(this, current, param); + return current; +}; + +Tapable.prototype.applyPluginsWaterfall2 = function applyPluginsWaterfall2(name, init, param1, param2) { + var plugins = this._plugins[name]; + if(!plugins) return init; + var current = init; + for(var i = 0; i < plugins.length; i++) + current = plugins[i].call(this, current, param1, param2); + return current; +}; + Tapable.prototype.applyPluginsBailResult = function applyPluginsBailResult(name) { if(!this._plugins[name]) return; var args = Array.prototype.slice.call(arguments, 1); @@ -124,6 +144,50 @@ Tapable.prototype.applyPluginsBailResult1 = function applyPluginsBailResult1(nam } }; +Tapable.prototype.applyPluginsBailResult2 = function applyPluginsBailResult2(name, param1, param2) { + if(!this._plugins[name]) return; + var plugins = this._plugins[name]; + for(var i = 0; i < plugins.length; i++) { + var result = plugins[i].call(this, param1, param2); + if(typeof result !== "undefined") { + return result; + } + } +}; + +Tapable.prototype.applyPluginsBailResult3 = function applyPluginsBailResult3(name, param1, param2, param3) { + if(!this._plugins[name]) return; + var plugins = this._plugins[name]; + for(var i = 0; i < plugins.length; i++) { + var result = plugins[i].call(this, param1, param2, param3); + if(typeof result !== "undefined") { + return result; + } + } +}; + +Tapable.prototype.applyPluginsBailResult4 = function applyPluginsBailResult4(name, param1, param2, param3, param4) { + if(!this._plugins[name]) return; + var plugins = this._plugins[name]; + for(var i = 0; i < plugins.length; i++) { + var result = plugins[i].call(this, param1, param2, param3, param4); + if(typeof result !== "undefined") { + return result; + } + } +}; + +Tapable.prototype.applyPluginsBailResult5 = function applyPluginsBailResult5(name, param1, param2, param3, param4, param5) { + if(!this._plugins[name]) return; + var plugins = this._plugins[name]; + for(var i = 0; i < plugins.length; i++) { + var result = plugins[i].call(this, param1, param2, param3, param4, param5); + if(typeof result !== "undefined") { + return result; + } + } +}; + Tapable.prototype.applyPluginsAsyncSeries = Tapable.prototype.applyPluginsAsync = function applyPluginsAsyncSeries(name) { var args = Array.prototype.slice.call(arguments, 1); var callback = args.pop(); @@ -289,6 +353,11 @@ Tapable.prototype.applyPluginsParallelBailResult1 = function applyPluginsParalle } }; +Tapable.prototype.hasPlugins = function hasPlugins(name) { + var plugins = this._plugins[name]; + return plugins && plugins.length > 0; +}; + Tapable.prototype.plugin = function plugin(name, fn) { if(Array.isArray(name)) { -- cgit v1.2.3