tapable-proxy

1.0.4 • Public • Published

Build Status Coverage

tapable-proxy

The pseudo tapable based on Proxy. tapable-proxy could create fake hooks which can be tapped even before the creation of real hooks.

Install

$ npm i tapable-proxy

Usage

const {
  create,
  APPLY_TAPS,
  SET_HOOKS
} = require('tapable-proxy')

// Create a fake hook proxy
const hooks = create()

hooks.afterEmit.tap('MyPlugin', compilation => {
  // ...
})

// Apply all taps to webpack compiler hooks
hooks[APPLY_TAPS](compiler.hooks)

// Proxy the follow-up taps to compiler hooks
hooks[SET_HOOKS](compiler.hooks)

hooks[APPLY_TAPS](realHooks, clean)

  • realHooks {[string]: Tapable} the real tapable hooks
  • clean? boolean=true If true, the tapped handlers will be maintained after applied. Defaults to true

hooks[SET_HOOKS](realHooks)

Set the underlying hooks of the proxy as realHooks, and after that follop-up taps will directly tap into realHooks.

License

MIT

/tapable-proxy/

    Package Sidebar

    Install

    npm i tapable-proxy

    Weekly Downloads

    0

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    7.19 kB

    Total Files

    6

    Last publish

    Collaborators

    • kael