# brrp

> ESM bundle npm modules for browsers and nodejs

Latest version **0.0.9** (published 2021-02-04) · (Apache-2.0 AND MIT) license · 0 weekly downloads

## Install

```sh
npm install brrp
pnpm add brrp
yarn add brrp
bun add brrp
```

Provides the command `brrp`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2021-02-04 |
| First published | 2020-07-04 |
| Weekly downloads | 0 |
| License | (Apache-2.0 AND MIT) |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 11 |
| Unpacked size | 13.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mikeal Rogers |
| Maintainers | mikeal |

## Links

- npm: https://www.npmjs.com/package/brrp
- npm.io page: https://npm.io/package/brrp

## Dependencies (11)

- [tempy](https://npm.io/package/tempy.md) ^0.7.0
- [yargs](https://npm.io/package/yargs.md) ^16.2.0
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.2
- [rollup](https://npm.io/package/rollup.md) ^2.27.0
- [standard](https://npm.io/package/standard.md) ^14.3.4
- [@rollup/plugin-json](https://npm.io/package/@rollup/plugin-json.md) ^4.1.0
- [rollup-plugin-terser](https://npm.io/package/rollup-plugin-terser.md) ^7.0.2
- [@rollup/plugin-commonjs](https://npm.io/package/@rollup/plugin-commonjs.md) ^15.0.0
- [@rollup/plugin-node-resolve](https://npm.io/package/@rollup/plugin-node-resolve.md) ^9.0.0
- [rollup-plugin-node-polyfills](https://npm.io/package/rollup-plugin-node-polyfills.md) ^0.2.1
- [rollup-plugin-preserve-shebangs](https://npm.io/package/rollup-plugin-preserve-shebangs.md) ^0.2.0

## Recent versions

- 0.0.9 (latest) — 2021-02-04
- 0.0.8 — 2020-10-10
- 0.0.7 — 2020-09-17
- 0.0.6 — 2020-09-16
- 0.0.5 — 2020-08-18
- 0.0.4 — 2020-07-06
- 0.0.3 — 2020-07-06
- 0.0.2 — 2020-07-06
- 0.0.1 — 2020-07-04
- 0.0.0 — 2020-07-04

## README

# brrp

Creates ESM bundles of npm packages for use in the browser or Node.js.

# Usage

## CLI

```
$ brrp -x lodash.merge > lodash-merge.bundle.js
```

This will do a fresh install of the npm module `lodash.merge` in temporary
directory and then create a bundle of the module.

If you have the target module already installed in your local npm project
you can avoid running any `npm install` locally by omitting the `-x` property.

```
$ brrp lodash.merge > lodash-merge.bundle.js
```

## As a module.

You can import `brrp` into Node.js for use in your own tooling.

```js
import { install, browserBundle } from 'brrp'

const { input } = await install('lodash.merge')
const stream = browserBundle({input})

for await (const chunk of stream) {
  process.stdout.write(chunk)
}
```

## Inject Node.js polyfills

By default we don't bundle in any Node.js polyfills. You can include them
by using the `-p` or `--node-polyfills` option.

```
$ brrp -x -p base-x
```

Or, if you're using `brrp` as a module.

```js
import { install, browserBundle } from 'brrp'

const { input } = await install('lodash.merge')
const nodePolyfills = true
const stream = browserBundle({input, nodePolyfills})

for await (const chunk of stream) {
  process.stdout.write(chunk)
}
```
## Minification

```
$ brrp -x -m bent
```

Or, if you're using `brrp` as a module.

```js
import { install, browserBundle } from 'brrp'

const { input } = await install('bent')
const minify = true
const stream = browserBundle({input, minify})

for await (const chunk of stream) {
  process.stdout.write(chunk)
}
```

We use [`terser`](https://github.com/terser/terser) under the hood
for optimal compression targetted at ES6+.

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