0.3.2 • Published 3 years ago

esbuild-plugin-flow v0.3.2

Weekly downloads
132
License
MIT
Repository
github
Last release
3 years ago

esbuild-plugin-flow

Esbuild plugin to strip types for Flow files using flow-remove-types

Installation

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

Usage

The esbuild plugin API isn't supported via CLI, so use a custom build script like so:

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

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

b) extentions

;/\.flow\.jsx?$/

c) a combination of both

;/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

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago