JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3394592
  • Score
    100M100P100Q209495F

Functionality commonly needed by Rollup plugins

Package Exports

  • rollup-pluginutils
  • rollup-pluginutils/src/createFilter.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rollup-pluginutils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rollup-pluginutils

A set of functions commonly used by Rollup plugins.

Installation

npm install --save rollup-pluginutils

Usage

createFilter

So far, this is the only exported function.

import { createFilter } from 'rollup-pluginutils';

export default function myPlugin ( options = {} ) {
  // `options.include` and `options.exclude` can each be a minimatch
  // pattern, or an array of minimatch patterns, relative to process.cwd()
  var filter = createFilter( options.include, options.exclude );

  return {
    transform ( code, id ) {
      // if `options.include` is omitted or has zero length, filter
      // will return `true` by default. Otherwise, an ID must match
      // one or more of the minimatch patterns, and must not match
      // any of the `options.exclude` patterns.
      if ( !filter( id ) ) return;

      // proceed with the transformation...
    }
  };
}

License

MIT