1.0.4 • Published 5 years ago

tapable-proxy v1.0.4

Weekly downloads
60
License
MIT
Repository
github
Last release
5 years ago

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

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.0

5 years ago