Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-pluginutils

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-pluginutils

Functionality commonly needed by Rollup plugins

  • 2.8.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is rollup-pluginutils?

The rollup-pluginutils package provides utility functions to help in the creation of Rollup plugins. It includes functions for filtering files, creating caches, and other common tasks needed when developing Rollup plugins.

What are rollup-pluginutils's main functionalities?

createFilter

The createFilter function allows you to create a filter function based on include and exclude patterns. This is useful for determining which files should be processed by your plugin.

const { createFilter } = require('rollup-pluginutils');

const filter = createFilter(['**/*.js', '**/*.jsx'], 'node_modules/**');

console.log(filter('src/main.js')); // true
console.log(filter('node_modules/foo.js')); // false

dataToEsm

The dataToEsm function converts a JavaScript object into an ES module export. This is useful for embedding JSON or other data directly into your Rollup bundles.

const { dataToEsm } = require('rollup-pluginutils');

const data = { foo: 'bar' };
const esmCode = dataToEsm(data);

console.log(esmCode); // export default {"foo":"bar"};

attachScopes

The attachScopes function attaches scope information to an AST, which can be useful for analyzing and transforming code.

const { attachScopes } = require('rollup-pluginutils');
const acorn = require('acorn');

const ast = acorn.parse('const x = 1;');
const scope = attachScopes(ast, 'scope');

console.log(scope.contains('x')); // true

Other packages similar to rollup-pluginutils

Keywords

FAQs

Package last updated on 13 Sep 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc