0.4.0 • Published 6 years ago

rollup-load-plugins v0.4.0

Weekly downloads
26
License
MIT
Repository
github
Last release
6 years ago

rollup-load-plugins

npm Dependencies Build Status Coverage Status JavaScript Standard Style

Loads Rollup plugins listed in package.json. Like gulp-load-plugins, but for Rollup.

Installation

npm install --save-dev rollup-load-plugins

Usage

import loadPlugins from 'rollup-load-plugins'
import { rollup } from 'rollup'

const plugins = loadPlugins()

// Then, if you have rollup-plugin-node-resolve and rollup-plugin-commonjs ...
rollup({
  plugins: [
    plugins.nodeResolve({ jsnext: true, main: true }),
    plugins.commonjs({ include: 'node_modules/**' })
  ]
})

Options

This is a subset of gulp-load-plugins's options. The behavior should be identical.

pattern

The glob(s) against which to match package names.

Default: ['rollup-plugin-*']

scope

The keys from package.json in which to discover plugins.

Default: ['dependencies', 'devDependencies', 'peerDependencies']

replaceString

The string or regexp to replace in the plugin name.

Default: /^rollup-plugin-/

camelize

Transform hyphenated plugin names to camelCase.

Default: true

cwd

The path to the package depending on the plugin. This option does not exist in gulp-load-plugins.

Default: process.cwd()

maintainScope

Treat package scopes as intermediary objects. With this option set to true, @mycompany/rollup-plugin-myplugin will be available as plugins.mycompany.myplugin. Setting it to false will create plugins.myplugin, which can create naming collisions.

Default: true

TODO

gulp-load-plugins contains a few more useful options that this package does not implement. Pull requests that implement those are appreciated.

Author

Tim De Pauw

License

MIT