tapable
Advanced tools
Comparing version 2.0.0-beta.7 to 2.0.0-beta.8
@@ -74,4 +74,4 @@ /* | ||
function AsyncParallelBailHook(args = []) { | ||
const hook = new Hook(args); | ||
function AsyncParallelBailHook(args = [], name = undefined) { | ||
const hook = new Hook(args, name); | ||
hook.constructor = AsyncParallelBailHook; | ||
@@ -78,0 +78,0 @@ hook.compile = COMPILE; |
@@ -26,4 +26,4 @@ /* | ||
function AsyncParallelHook(args = []) { | ||
const hook = new Hook(args); | ||
function AsyncParallelHook(args = [], name = undefined) { | ||
const hook = new Hook(args, name); | ||
hook.constructor = AsyncParallelHook; | ||
@@ -30,0 +30,0 @@ hook.compile = COMPILE; |
@@ -31,4 +31,4 @@ /* | ||
function AsyncSeriesBailHook(args = []) { | ||
const hook = new Hook(args); | ||
function AsyncSeriesBailHook(args = [], name = undefined) { | ||
const hook = new Hook(args, name); | ||
hook.constructor = AsyncSeriesBailHook; | ||
@@ -35,0 +35,0 @@ hook.compile = COMPILE; |
@@ -26,4 +26,4 @@ /* | ||
function AsyncSeriesHook(args = []) { | ||
const hook = new Hook(args); | ||
function AsyncSeriesHook(args = [], name = undefined) { | ||
const hook = new Hook(args, name); | ||
hook.constructor = AsyncSeriesHook; | ||
@@ -30,0 +30,0 @@ hook.compile = COMPILE; |
@@ -26,4 +26,4 @@ /* | ||
function AsyncSeriesLoopHook(args = []) { | ||
const hook = new Hook(args); | ||
function AsyncSeriesLoopHook(args = [], name = undefined) { | ||
const hook = new Hook(args, name); | ||
hook.constructor = AsyncSeriesLoopHook; | ||
@@ -30,0 +30,0 @@ hook.compile = COMPILE; |
@@ -34,6 +34,6 @@ /* | ||
function AsyncSeriesWaterfallHook(args = []) { | ||
function AsyncSeriesWaterfallHook(args = [], name = undefined) { | ||
if (args.length < 1) | ||
throw new Error("Waterfall hooks must have at least one argument"); | ||
const hook = new Hook(args); | ||
const hook = new Hook(args, name); | ||
hook.constructor = AsyncSeriesWaterfallHook; | ||
@@ -40,0 +40,0 @@ hook.compile = COMPILE; |
@@ -12,4 +12,5 @@ /* | ||
class HookMap { | ||
constructor(factory) { | ||
constructor(factory, name = undefined) { | ||
this._map = new Map(); | ||
this.name = name; | ||
this._factory = factory; | ||
@@ -16,0 +17,0 @@ this._interceptors = []; |
@@ -10,4 +10,5 @@ /* | ||
class MultiHook { | ||
constructor(hooks) { | ||
constructor(hooks, name = undefined) { | ||
this.hooks = hooks; | ||
this.name = name; | ||
} | ||
@@ -47,3 +48,6 @@ | ||
withOptions(options) { | ||
return new MultiHook(this.hooks.map(h => h.withOptions(options))); | ||
return new MultiHook( | ||
this.hooks.map(h => h.withOptions(options)), | ||
this.name | ||
); | ||
} | ||
@@ -50,0 +54,0 @@ } |
@@ -40,4 +40,4 @@ /* | ||
function SyncBailHook(args = []) { | ||
const hook = new Hook(args); | ||
function SyncBailHook(args = [], name = undefined) { | ||
const hook = new Hook(args, name); | ||
hook.constructor = SyncBailHook; | ||
@@ -44,0 +44,0 @@ hook.tapAsync = TAP_ASYNC; |
@@ -35,4 +35,4 @@ /* | ||
function SyncHook(args = []) { | ||
const hook = new Hook(args); | ||
function SyncHook(args = [], name = undefined) { | ||
const hook = new Hook(args, name); | ||
hook.constructor = SyncHook; | ||
@@ -39,0 +39,0 @@ hook.tapAsync = TAP_ASYNC; |
@@ -35,4 +35,4 @@ /* | ||
function SyncLoopHook(args = []) { | ||
const hook = new Hook(args); | ||
function SyncLoopHook(args = [], name = undefined) { | ||
const hook = new Hook(args, name); | ||
hook.constructor = SyncLoopHook; | ||
@@ -39,0 +39,0 @@ hook.tapAsync = TAP_ASYNC; |
@@ -44,6 +44,6 @@ /* | ||
function SyncWaterfallHook(args = []) { | ||
function SyncWaterfallHook(args = [], name = undefined) { | ||
if (args.length < 1) | ||
throw new Error("Waterfall hooks must have at least one argument"); | ||
const hook = new Hook(args); | ||
const hook = new Hook(args, name); | ||
hook.constructor = SyncWaterfallHook; | ||
@@ -50,0 +50,0 @@ hook.tapAsync = TAP_ASYNC; |
{ | ||
"name": "tapable", | ||
"version": "2.0.0-beta.7", | ||
"version": "2.0.0-beta.8", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "Just a little module for plugins.", |
@@ -88,3 +88,4 @@ type FixedSizeArray<T extends number, U> = T extends 0 | ||
export class HookMap<H> { | ||
constructor(factory: HookFactory<H>); | ||
constructor(factory: HookFactory<H>, name?: string); | ||
name: string | undefined; | ||
get(key: any): H | undefined; | ||
@@ -96,3 +97,4 @@ for(key: any): H; | ||
export class MultiHook<H> { | ||
constructor(hooks: H[]); | ||
constructor(hooks: H[], name?: string); | ||
name: string | undefined; | ||
tap(options: string | Tap, fn?: Function): void; | ||
@@ -99,0 +101,0 @@ tapAsync(options: string | Tap, fn?: Function): void; |
43593
1154