tapable

  • Version 2.2.1
  • Published
  • 46.9 kB
  • No dependencies
  • MIT license

Install

npm i tapable
yarn add tapable
pnpm add tapable

Overview

Just a little module for plugins.

Index

Classes

class AsyncHook

class AsyncHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends Hook<
T,
R,
AdditionalOptions
> {}

    method tapAsync

    tapAsync: (
    options: string | (Tap & IfSet<AdditionalOptions>),
    fn: (...args: Append<AsArray<T>, InnerCallback<Error, R>>) => void
    ) => void;

      method tapPromise

      tapPromise: (
      options: string | (Tap & IfSet<AdditionalOptions>),
      fn: (...args: AsArray<T>) => Promise<R>
      ) => void;

        class AsyncParallelBailHook

        class AsyncParallelBailHook<
        T,
        R,
        AdditionalOptions = UnsetAdditionalOptions
        > extends AsyncHook<T, R, AdditionalOptions> {}

          class AsyncParallelHook

          class AsyncParallelHook<
          T,
          AdditionalOptions = UnsetAdditionalOptions
          > extends AsyncHook<T, void, AdditionalOptions> {}

            class AsyncSeriesBailHook

            class AsyncSeriesBailHook<
            T,
            R,
            AdditionalOptions = UnsetAdditionalOptions
            > extends AsyncHook<T, R, AdditionalOptions> {}

              class AsyncSeriesHook

              class AsyncSeriesHook<
              T,
              AdditionalOptions = UnsetAdditionalOptions
              > extends AsyncHook<T, void, AdditionalOptions> {}

                class AsyncSeriesLoopHook

                class AsyncSeriesLoopHook<
                T,
                AdditionalOptions = UnsetAdditionalOptions
                > extends AsyncHook<T, void, AdditionalOptions> {}

                  class AsyncSeriesWaterfallHook

                  class AsyncSeriesWaterfallHook<
                  T,
                  AdditionalOptions = UnsetAdditionalOptions
                  > extends AsyncHook<T, AsArray<T>[0], AdditionalOptions> {}

                    class Hook

                    class Hook<T, R, AdditionalOptions = UnsetAdditionalOptions> {}

                      constructor

                      constructor(
                      args?:
                      | (readonly string[] & { 0: string; length: 1 })
                      | (readonly string[] & { 0: string; length: number }),
                      name?: string
                      );

                        property name

                        name: string;

                          property taps

                          taps: FullTap[];

                            method callAsync

                            callAsync: (...args: Append<AsArray<T>, Callback<Error, R>>) => void;

                              method intercept

                              intercept: (interceptor: HookInterceptor<T, R, AdditionalOptions>) => void;

                                method isUsed

                                isUsed: () => boolean;

                                  method promise

                                  promise: (...args: AsArray<T>) => Promise<R>;

                                    method tap

                                    tap: (
                                    options: string | (Tap & IfSet<AdditionalOptions>),
                                    fn: (...args: AsArray<T>) => R
                                    ) => void;

                                      method withOptions

                                      withOptions: (
                                      options: TapOptions & IfSet<AdditionalOptions>
                                      ) => Omit<this, 'call' | 'callAsync' | 'promise'>;

                                        class HookMap

                                        class HookMap<H> {}

                                          constructor

                                          constructor(factory: HookFactory<H>, name?: string);

                                            property name

                                            name: string;

                                              method for

                                              for: (key: any) => H;

                                                method get

                                                get: (key: any) => H | undefined;

                                                  method intercept

                                                  intercept: (interceptor: HookMapInterceptor<H>) => void;

                                                    class MultiHook

                                                    class MultiHook<H> {}

                                                      constructor

                                                      constructor(hooks: H[], name?: string);

                                                        property name

                                                        name: string;

                                                          method tap

                                                          tap: (options: string | Tap, fn?: Function) => void;

                                                            method tapAsync

                                                            tapAsync: (options: string | Tap, fn?: Function) => void;

                                                              method tapPromise

                                                              tapPromise: (options: string | Tap, fn?: Function) => void;

                                                                class SyncBailHook

                                                                class SyncBailHook<
                                                                T,
                                                                R,
                                                                AdditionalOptions = UnsetAdditionalOptions
                                                                > extends SyncHook<T, R, AdditionalOptions> {}

                                                                  class SyncHook

                                                                  class SyncHook<T, R = void, AdditionalOptions = UnsetAdditionalOptions> extends Hook<
                                                                  T,
                                                                  R,
                                                                  AdditionalOptions
                                                                  > {}

                                                                    method call

                                                                    call: (...args: AsArray<T>) => R;

                                                                      class SyncLoopHook

                                                                      class SyncLoopHook<T, AdditionalOptions = UnsetAdditionalOptions> extends SyncHook<
                                                                      T,
                                                                      void,
                                                                      AdditionalOptions
                                                                      > {}

                                                                        class SyncWaterfallHook

                                                                        class SyncWaterfallHook<
                                                                        T,
                                                                        AdditionalOptions = UnsetAdditionalOptions
                                                                        > extends SyncHook<T, AsArray<T>[0], AdditionalOptions> {}

                                                                          class UnsetAdditionalOptions

                                                                          class UnsetAdditionalOptions {}

                                                                            Interfaces

                                                                            interface HookInterceptor

                                                                            interface HookInterceptor<T, R, AdditionalOptions = UnsetAdditionalOptions> {}

                                                                              property call

                                                                              call?: (...args: any[]) => void;

                                                                                property done

                                                                                done?: () => void;

                                                                                  property error

                                                                                  error?: (err: Error) => void;

                                                                                    property loop

                                                                                    loop?: (...args: any[]) => void;

                                                                                      property name

                                                                                      name?: string;

                                                                                        property register

                                                                                        register?: (
                                                                                        tap: FullTap & IfSet<AdditionalOptions>
                                                                                        ) => FullTap & IfSet<AdditionalOptions>;

                                                                                          property result

                                                                                          result?: (result: R) => void;

                                                                                            property tap

                                                                                            tap?: (tap: FullTap & IfSet<AdditionalOptions>) => void;

                                                                                              interface HookMapInterceptor

                                                                                              interface HookMapInterceptor<H> {}

                                                                                                property factory

                                                                                                factory?: HookFactory<H>;

                                                                                                  Type Aliases

                                                                                                  type Append

                                                                                                  type Append<T extends any[], U> = {
                                                                                                  0: [U];
                                                                                                  1: [T[0], U];
                                                                                                  2: [T[0], T[1], U];
                                                                                                  3: [T[0], T[1], T[2], U];
                                                                                                  4: [T[0], T[1], T[2], T[3], U];
                                                                                                  5: [T[0], T[1], T[2], T[3], T[4], U];
                                                                                                  6: [T[0], T[1], T[2], T[3], T[4], T[5], U];
                                                                                                  7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], U];
                                                                                                  8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], U];
                                                                                                  }[Measure<T['length']>];

                                                                                                    type ArgumentNames

                                                                                                    type ArgumentNames<T extends any[]> = FixedSizeArray<T['length'], string>;

                                                                                                      type AsArray

                                                                                                      type AsArray<T> = T extends any[] ? T : [T];

                                                                                                        type Callback

                                                                                                        type Callback<E, T> = (error: E | null, result?: T) => void;

                                                                                                          type FixedSizeArray

                                                                                                          type FixedSizeArray<T extends number, U> = T extends 0
                                                                                                          ? void[]
                                                                                                          : ReadonlyArray<U> & {
                                                                                                          0: U;
                                                                                                          length: T;
                                                                                                          };

                                                                                                            type FullTap

                                                                                                            type FullTap = Tap & {
                                                                                                            type: 'sync' | 'async' | 'promise';
                                                                                                            fn: Function;
                                                                                                            };

                                                                                                              type HookFactory

                                                                                                              type HookFactory<H> = (key: any, hook?: H) => H;

                                                                                                                type IfSet

                                                                                                                type IfSet<X> = X extends UnsetAdditionalOptions ? {} : X;

                                                                                                                  type InnerCallback

                                                                                                                  type InnerCallback<E, T> = (error?: E | null | false, result?: T) => void;

                                                                                                                    type Measure

                                                                                                                    type Measure<T extends number> = T extends 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
                                                                                                                    ? T
                                                                                                                    : never;

                                                                                                                      type Tap

                                                                                                                      type Tap = TapOptions & {
                                                                                                                      name: string;
                                                                                                                      };

                                                                                                                        type TapOptions

                                                                                                                        type TapOptions = {
                                                                                                                        before?: string;
                                                                                                                        stage?: number;
                                                                                                                        };

                                                                                                                          Package Files (1)

                                                                                                                          Dependencies (0)

                                                                                                                          No dependencies.

                                                                                                                          Dev Dependencies (6)

                                                                                                                          Peer Dependencies (0)

                                                                                                                          No peer dependencies.

                                                                                                                          Badge

                                                                                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/tapable.

                                                                                                                          • Markdown
                                                                                                                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/tapable)
                                                                                                                          • HTML
                                                                                                                            <a href="https://www.jsdocs.io/package/tapable"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>