# tapable-proxy

> The pseudo tapable based on Proxy

Latest version **1.0.4** (published 2019-08-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install tapable-proxy
pnpm add tapable-proxy
yarn add tapable-proxy
bun add tapable-proxy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2019-08-28 |
| First published | 2019-05-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6 |
| Dependencies | 2 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | kaelzhang |
| Maintainers | kael |
| Keywords | tapable-proxy |

## Links

- npm: https://www.npmjs.com/package/tapable-proxy
- Repository: https://github.com/kaelzhang/tapable-proxy
- Homepage: https://github.com/kaelzhang/tapable-proxy#readme
- Issues: https://github.com/kaelzhang/tapable-proxy/issues
- npm.io page: https://npm.io/package/tapable-proxy

## Dependencies (2)

- [err-object](https://npm.io/package/err-object.md) ^5.1.4
- [core-util-is](https://npm.io/package/core-util-is.md) ^1.0.2

## Recent versions

- 1.0.4 (latest) — 2019-08-28
- 1.0.3 — 2019-05-22
- 1.0.2 — 2019-05-22
- 1.0.1 — 2019-05-22
- 1.0.0 — 2019-05-22
- 0.0.0 — 2019-05-21

## README

[![Build Status](https://travis-ci.org/kaelzhang/tapable-proxy.svg?branch=master)](https://travis-ci.org/kaelzhang/tapable-proxy)
[![Coverage](https://codecov.io/gh/kaelzhang/tapable-proxy/branch/master/graph/badge.svg)](https://codecov.io/gh/kaelzhang/tapable-proxy)
<!-- optional appveyor tst
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/kaelzhang/tapable-proxy?branch=master&svg=true)](https://ci.appveyor.com/project/kaelzhang/tapable-proxy)
-->
<!-- optional npm version
[![NPM version](https://badge.fury.io/js/tapable-proxy.svg)](http://badge.fury.io/js/tapable-proxy)
-->
<!-- optional npm downloads
[![npm module downloads per month](http://img.shields.io/npm/dm/tapable-proxy.svg)](https://www.npmjs.org/package/tapable-proxy)
-->
<!-- optional dependency status
[![Dependency Status](https://david-dm.org/kaelzhang/tapable-proxy.svg)](https://david-dm.org/kaelzhang/tapable-proxy)
-->

# tapable-proxy

The pseudo tapable based on [Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy). `tapable-proxy` could create fake hooks which can be tapped even before the creation of real hooks.

## Install

```sh
$ npm i tapable-proxy
```

## Usage

```js
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](https://www.npmjs.com/package/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](LICENSE)

---
_Source: https://npm.io/package/tapable-proxy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
