Socket
Book a DemoInstallSign in
Socket

brrp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brrp

ESM bundle npm modules for browsers and nodejs

latest
npmnpm
Version
0.0.9
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

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.

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.

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.

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 under the hood for optimal compression targetted at ES6+.

FAQs

Package last updated on 04 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts