Gathering detailed insights and metrics for rollup-plugin-cleanup
Gathering detailed insights and metrics for rollup-plugin-cleanup
Gathering detailed insights and metrics for rollup-plugin-cleanup
Gathering detailed insights and metrics for rollup-plugin-cleanup
rollup-plugin-cleanup-dir
Automatically cleanup output.dir before writing a new bundle
rollup-plugin-cleanup-chunk
Extension of `rollup-plugin-cleanup` which allows to clean code in `renderChunk` hook
@nfts/plugin-cleanup
`Base on Rollup and TypeScript`
rollup-plugin-code-raker
A Rollup plugin that rakes your bundle to remove dead leaves.
Rollup plugin to remove comments, trim trailing spaces, compact empty lines, and normalize line endings
npm install rollup-plugin-cleanup
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (97.27%)
Makefile (2.73%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
100 Stars
58 Commits
5 Forks
3 Watchers
6 Branches
2 Contributors
Updated on Apr 04, 2025
Latest Version
3.2.1
Package Id
rollup-plugin-cleanup@3.2.1
Size
9.53 kB
NPM Version
6.14.4
Node Version
10.20.1
Published on
Sep 23, 2020
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
1
Rollup plugin to remove comments, trim trailing spaces, compact empty lines, and normalize line endings in JavaScript files.
With the rollup-plugin-cleanup you have:
From v3.1, this plugin no longer uses acorn. See more in the Whats New section.
rollup-plugin-cleanup requires node v10.13 or above, but avoid the buggy v11.x
Important:
rollup-plugin-cleanup is based on js-cleanup and can handle any JS-like file: TypeScript, Flow, React, ES9, etc, but it is mainly a postprocessor, so it should be runned in a later stage of your toolchain, after any preprocessor or transpiler.
Why not Uglify?
Uglify is a excelent minifier but you have little control over the results, while with js-cleanup your coding style remains intact and the removal of comments is strictly under your control.
I'm a full-stack developer with more than 20 year of experience and I try to share most of my work for free and help others, but this takes a significant amount of time and effort so, if you like my work, please consider...
Of course, feedback, PRs, and stars are also welcome ????
Thanks!
1npm install rollup-plugin-cleanup --save-dev 2# or with yarn 3yarn add rollup-plugin-cleanup -D
1import { rollup } from 'rollup'; 2import awesome from 'rollup-plugin-awesome'; 3import cleanup from 'rollup-plugin-cleanup'; 4 5rollup({ 6 input: 'src/main.js', 7 plugins: [ 8 awesome(), // other plugins 9 cleanup() // cleanup here 10 ] 11}).then(...)
That's it.
By default, only the .js, .jsx, and .tag files are processed, but you can expand or restrict the set of accepted files using the options include
, exclude
, and extensions
(see below).
From v3.1.0 normalizeEols
is deprecated in favor of lineEndings
and the properties ecmaVersion
, sourceType
, and acornOptions
are ignored. See more in Whats New section.
Name | Default | Description |
---|---|---|
comments | 'some' | Filter or array of filters that determinates which comments should be preserved. Use "all" to keep all, or "none" to remove all the comments. |
compactComments | true | Should js-cleanup also compact whitespace and blank lines in the preserved multiline comments? Line-ending normalization is always done. |
lineEndings | unix | Type of Line-ending for normalization: "unix", "mac", "win". |
maxEmptyLines | 0 | Maximum successive empty lines to preserve in the output. Use a positive value, or -1 to keep all the lines. |
sourcemap | true | Should a sourcemap be generated? |
extensions | ['js', 'jsx', 'mjs'] | String or array of strings with extensions of files to process. |
exclude | (none) | picomatch or array of picomatch patterns for paths to exclude of the process. |
include | (none) | picomatch or array of picomatch patterns for paths to include in the process. |
Instead the special 'all' or 'none' keywords, you can use any combination of custom filters along with any of these predefined ones:
Name | Will preserve... |
---|---|
some | Comments containing "@license", "@preserve", or starting with "!". |
license | Comments containing "@license". |
eslint | ESLint directives. |
flow | Facebook Flow directives, comment types, and flowlint comments. |
istanbul | istanbul ignore comments. |
jsdoc | JSDoc comments. |
jshint | JSHint directives. |
jslint | JSLint directives. |
sources | Sourcemap directives sourceURL and sourceMappingURL. |
ts | MS TypeScript Triple-Slash and @ts-* directives, plus the @jsx pragma. |
ts3s | TypeScript Triple-Slash directives. |
From v3.1.0, some
does not includes '@cc_on' and the jscs
filter was deprecated. See more in Whats New section.
'srcmaps' will be preserved as an alias to the 'sources' filter.
See the regexes in the js-cleanup src/predef-filters.ts file.
You can set custom filters through regexes that matches the content of the comments that you want to preserve.
The string to which the regex is applied does not includes the first slash, nor the */
terminator of the multiline comments, so the multiline comments begins with an asterisk (*
) and single-line comments begins with a slash (/
).
For example, the following filters will preserve ESLint directives and multiline comments starting with a dash:
1const cleanedCode = jsCleanup(code, null, { comments: ['eslint', /^\*-/] })
Changes in v3.2.1
The MIT License (MIT)
© 2018-2020 Alberto Martínez
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/26 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
19 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More