Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@rollup/plugin-run
Advanced tools
🍣 A Rollup plugin which runs your bundles in Node once they're built.
Using this plugin gives much faster results compared to what you would do with nodemon.
This plugin requires an LTS Node version (v14.0.0+) and Rollup v2.0.0+.
Using npm:
npm install @rollup/plugin-run --save-dev
Create a rollup.config.js
configuration file and import the plugin:
import run from '@rollup/plugin-run';
export default {
input: 'src/index.js',
output: {
file: 'dist/index.js',
format: 'cjs'
},
plugins: [run()]
};
Then call rollup
either via the CLI or the API. If the build produces any errors, the plugin will write a 'alias' character to stderr, which should be audible on most systems.
The plugin forks
a child process with the generated file, every time the bundle is rebuilt (after first closing the previous process, if it's not the first run).
Note: This plugin works with Rollup's code-splitting if you're using dynamic import(...)
— the only constraint is that you have a single entry point specified in the config.
This plugin supports pass through option available for child_process.fork(...).
Example:
Debugging with sourcemaps using source-map-support:
// rollup.config.js
import run from '@rollup/plugin-run';
export default {
input: 'src/index.js',
output: {
file: 'dist/index.js',
format: 'cjs',
+ sourcemap: true
},
plugins: [
- run()
+ run({
+ execArgv: ['-r', 'source-map-support/register']
+ })
]
};
allowRestarts
Type: Boolean
Default: false
If true
, instructs the plugin to listen to stdin
for the sequences listed below followed by enter (carriage return).
input
Type: String
Default: null
Specifies the entry point this plugin will use. Not necessary if you only have a single entry point.
stdin
Input ActionsWhen this option is enabled, stdin
will listen for the following input and perform the associated action:
restart
→ Kills the currently running bundle and starts it again. Note: This does not create a new bundle, the bundle is run again "as-is". This can be used to test configuration changes or other changes that are made without modifying your source
Also allowed: rs
, CTRL+K
clear
→ Clears the screen of all text
Also allowed: cls
, CTRL+L
The feature is usually intended for development use, you may prefer to only include it when Rollup is being run in watch mode:
// rollup.config.js
import run from '@rollup/plugin-run';
+const dev = process.env.ROLLUP_WATCH === 'true';
export default {
input: 'src/index.js',
output: {
file: 'dist/index.js',
format: 'cjs'
},
plugins: [
- run()
+ dev && run()
]
};
FAQs
Run your bundle after you've built it
The npm package @rollup/plugin-run receives a total of 5,842 weekly downloads. As such, @rollup/plugin-run popularity was classified as popular.
We found that @rollup/plugin-run demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.