# esbuild-plugin-flow

> Esbuild plugin to strip types for Flow files

Latest version **0.3.2** (published 2021-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install esbuild-plugin-flow
pnpm add esbuild-plugin-flow
yarn add esbuild-plugin-flow
bun add esbuild-plugin-flow
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.2 |
| Published | 2021-05-11 |
| First published | 2020-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | Dalci de Jesus Bagolin |
| Maintainers | dalcib |
| Keywords | esbuild, plugin, flow |

## Links

- npm: https://www.npmjs.com/package/esbuild-plugin-flow
- Repository: https://github.com/dalcib/esbuild-plugin-flow
- Homepage: https://github.com/dalcib/esbuild-plugin-flow#readme
- Issues: https://github.com/dalcib/esbuild-plugin-flow/issues
- npm.io page: https://npm.io/package/esbuild-plugin-flow

## Dependencies (1)

- [flow-remove-types](https://npm.io/package/flow-remove-types.md) ^2.137.0

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.3.2 (latest) — 2021-05-11
- 0.3.1 — 2021-05-11
- 0.3.0 — 2021-02-25
- 0.2.0 — 2020-12-05
- 0.1.0 — 2020-11-21

## README

# esbuild-plugin-flow

Esbuild plugin to strip types for Flow files using [flow-remove-types](https://www.npmjs.com/package/flow-remove-types)

## Installation

```
npm i --dev https://github.com/dalcib/esbuild-plugin-flow
```

## Usage

The esbuild [plugin API](https://esbuild.github.io/plugins/) isn't supported via CLI, so use a custom build script like so:

```js
const esbuild = require('esbuild')
const flow = require('esbuild-plugin-flow')

esbuild
  .build({
    entryPoints: ['index.js'],
    outfile: 'dist/bundle.js',
    bundle: true,
    plugins: [flow(/\.flow\.jsx?$/)],
  })
  .catch(() => process.exit(1))
```

## Options

The plugin has to parameters: `regexp` and `[force]`

### regexp

The plugin needs a RegExp to define:

#### a) paths or packages to be included

```javascript
;/node_modules\\package.*\.jsx?$/
```

#### b) extentions

```javascript
;/\.flow\.jsx?$/
```

#### c) a combination of both

```javascript
;/node_modules\\package1.*\.jsx?$|node_modules\\package2.*\.jsx?$|\.flow\.jsx?$/
```

### force [optional]

A Boolean indicating that the plugin must act regardless of the existence of flow annotations (`// @flow` or `/** @flow /*`) in the file.

## Entry Point

Due to limitations of Esbuild, the entry point is not processed.

## Tests

For test, copy the folder `flow-pkg` to node_modules and run `node tests/test`

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