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

rollup-plugin-modify

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-modify

Modify rollup output with find / replace dynamically

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28K
increased by4.6%
Maintainers
1
Weekly downloads
 
Created
Source

version license

🔎 rollup-plugin-modify

Modify rollup output with find / replace dynamically.

Usage

npm i rollup-plugin-modify

Explicit single using find, replace keys

import modify from 'rollup-plugin-modify'

export default {
  plugins: [
    modify({
      find: String | RegExp,
      replace: String | Function
    })
  ]
}

Terse multiple using key, value

import modify from 'rollup-plugin-modify'

export default {
  plugins: [
    modify({
      'find this text': 'replace with this here',
      'process.env.PORT': 5000
    })
  ]
}

find: String|RegExp

Supply a string or RegExp to find what you are looking for

replace: String|Function

Supply a string to directly replace what you've found, or a function to dynamically modify your findings

Example using String for both find and replace
modify({
  find: 'eval',
  replace: 'lava'
})
Example using RegExp for find and a Function for replace
modify({
  find: /svg\((.*?)\)/,
  replace: (match, path) => JSON.stringify(fs.readFileSync(path, 'utf8'))
})

Keywords

FAQs

Package last updated on 14 Feb 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