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-prettier
Advanced tools
Rollup plugin that can be used to run prettier on the final bundle.
Install the plugin with NPM:
npm install --save-dev prettier rollup-plugin-prettier
Then add it to your rollup configuration:
const path = require('path');
const prettier = require('rollup-plugin-prettier');
module.exports = {
input: path.join(__dirname, 'src', 'index.js'),
output: {
file: path.join(__dirname, 'dist', 'bundle.js'),
},
plugins: [
// Run plugin with prettier options.
prettier({
tabWidth: 2,
singleQuote: false,
}),
],
};
If source map is enabled in the global rollup options, then a source map will be generated on the formatted bundle (except if sourcemap are explicitely disabled in the prettier options).
Note that this may take some time since prettier
package is not able to generate a sourcemap and this plugin must compute the diff between the original bundle and the formatted result and generate the corresponding sourcemap: for this reason, sourcemap are disabled by default.
Here is an example:
const path = require('path');
const prettier = require('rollup-plugin-prettier');
module.exports = {
input: path.join(__dirname, 'src', 'index.js'),
output: {
file: path.join(__dirname, 'dist', 'bundle.js'),
sourcemap: true,
},
plugins: [
prettier({
sourcemap: true, // Can also be disabled/enabled here.
}),
],
};
4.1.0
prettier
dependency is now a peer dependency instead of a "direct" dependency: user of the plugin can choose to use prettier 1.x.x or prettier 2.x.x (note that this plugin should be compatible with all versions of prettier).sourceMap
was deprecated in favor of sourcemap
).sourcemap
option (see rollup #1583).sourcemap
(lowercase) option of rollup.magic-string
)MIT License (MIT)
If you find a bug or think about enhancement, feel free to contribute and submit an issue or a pull request.
FAQs
Run prettier formatter with rollup
We found that rollup-plugin-prettier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.