Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
rollup-plugin-replace
Advanced tools
Readme
Replace strings in files while bundling them.
npm install --save-dev rollup-plugin-replace
Generally, you need to ensure that rollup-plugin-replace goes before other things (like rollup-plugin-commonjs) in your plugins
array, so that those plugins can apply any optimisations such as dead code removal.
// rollup.config.js
import replace from 'rollup-plugin-replace';
export default {
// ...
plugins: [
replace({
ENVIRONMENT: JSON.stringify('production')
})
]
};
{
// a minimatch pattern, or array of patterns, of files that
// should be processed by this plugin (if omitted, all files
// are included by default)...
include: 'config.js',
// ...and those that shouldn't, if `include` is otherwise
// too permissive
exclude: 'node_modules/**',
// To replace every occurrence of `<@foo@>` instead of every
// occurrence of `foo`, supply delimiters
delimiters: ['<@', '@>'],
// All other options are treated as `string: replacement`
// replacers...
VERSION: '1.0.0',
ENVIRONMENT: JSON.stringify('development'),
// or `string: (id) => replacement` functions...
__dirname: (id) => `'${path.dirname(id)}'`,
// ...unless you want to be careful about separating
// values from other options, in which case you can:
values: {
VERSION: '1.0.0',
ENVIRONMENT: JSON.stringify('development')
}
}
By default, values will only match if they are surrounded by word boundaries — i.e. with options like this...
{
changed: 'replaced'
}
...and code like this...
console.log('changed');
console.log('unchanged');
...the result will be this:
console.log('replaced');
console.log('unchanged');
If that's not what you want, specify empty strings as delimiters:
{
changed: 'replaced',
delimiters: ['', '']
}
MIT
FAQs
[![](https://img.shields.io/npm/v/rollup-plugin-replace.svg?style=flat)](https://www.npmjs.com/package/rollup-plugin-replace)
The npm package rollup-plugin-replace receives a total of 64,962 weekly downloads. As such, rollup-plugin-replace popularity was classified as popular.
We found that rollup-plugin-replace demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.