Gathering detailed insights and metrics for rollup-plugin-output-size
Gathering detailed insights and metrics for rollup-plugin-output-size
Gathering detailed insights and metrics for rollup-plugin-output-size
Gathering detailed insights and metrics for rollup-plugin-output-size
A Rollup plugin that displays output bundle sizes.
npm install rollup-plugin-output-size
Typescript
Module System
Min. Node Version
Node Version
NPM Version
53.5
Supply Chain
100
Quality
81.5
Maintenance
100
Vulnerability
99.6
License
TypeScript (92.13%)
JavaScript (7.87%)
Total Downloads
74,285
Last Day
273
Last Week
1,982
Last Month
10,549
Last Year
67,484
3 Stars
89 Commits
2 Watching
1 Branches
1 Contributors
Latest Version
1.5.0
Package Id
rollup-plugin-output-size@1.5.0
Unpacked Size
23.26 kB
Size
6.62 kB
File Count
7
NPM Version
10.8.2
Node Version
20.18.0
Publised On
17 Nov 2024
Cumulative downloads
Total Downloads
Last day
-32.6%
273
Compared to previous day
Last week
-12%
1,982
Compared to previous week
Last month
103.1%
10,549
Compared to previous month
Last year
937.9%
67,484
Compared to previous year
2
1
26
A Rollup plugin that displays output bundle sizes.
This project was inspired by rollup-plugin-bundle-size.
1npm install --save-dev rollup-plugin-output-size
1// ESM 2import outputSize from 'rollup-plugin-output-size'; 3 4// CommonJS 5const { outputSize } = require('rollup-plugin-output-size');
Use the plugin, example rollup.config.js
:
1import outputSize from 'rollup-plugin-output-size'; 2 3export default { 4 input: 'index.js', 5 output: { dir: 'dist' }, 6 plugins: [outputSize(/* plugin options */)] 7};
You can change and override the behavior of this plugin through its options. Note that all options are optional.
Type: boolean | OutputType[]
Default: false
Disable output types display.
Set to true
to disable output for all output types, or set an array to specify which output types will not be displayed.
Output types are: asset
, chunk
, and entry
.
Note: Both
chunk
andentry
output types areOutputChunk
s butentry
chunks haveisEntry
values oftrue
.
This option does not affect summary
output.
Type: boolean | OutputType[]
Default: true
Get gzipped sizes of output.
Set to false
to skip getting gzipped size, or set an array to only get gzipped sizes of specified output types.
Type: boolean
Default: false
Disable output. This will also skip the handle
and summary
callbacks.
Type: boolean | 'always' | SummaryCallback
Default: true
Display summary output.
false
to disable summary output.'always'
to force summary output even if there is only one (1) output.See types in
summary.types.ts
.
[!NOTE]
The total gzip size of the summary output may not be entirely accurate as it is only the sum of all the individual output gzip sizes. If you need a more accurate size, you can use archiver to create an archive with all output contents and get the gzip size of that instead.
Type: (info: OutputInfo, output: OutputAsset | OutputChunk) => void | Promise<void>
Override the default logging of output info.
The second argument output
is the current Rollup output asset or chunk to log, while the first argument is the OutputInfo
.
See types in
output.types.ts
.
This package also includes some utility functions that you may find helpful, especially when making use of the handle
and summary
options.
Type: (info: OutputInfo) => string
Used to get the default display format of output info.
1import outputSize, { format } from 'rollup-plugin-output-size'; 2 3export default { 4 input: 'index.js', 5 output: { dir: 'dist' }, 6 plugins: [ 7 outputSize({ 8 handle(info) { 9 console.log(format(info)); 10 } 11 }) 12 ] 13};
1[{type}] {path} is {hSize} → {gzip.hSize} (gzip)
Type: (input: string | Uint8Array) => Promise<Size>
Used to get the gzipped size of input.
1import outputSize, { gzip } from 'rollup-plugin-output-size'; 2 3export default { 4 input: 'index.js', 5 output: { dir: 'dist' }, 6 plugins: [ 7 outputSize({ 8 gzip: false, 9 async handle(info, output) { 10 const data = output.type === 'chunk' ? output.code : output.source; 11 const gzipInfo = await gzip(data); 12 console.log(info.path, gzipInfo); 13 } 14 }) 15 ] 16};
Type: (summary: Summary) => string
Used to get the default display format of summary info.
1import outputSize, { summarize } from 'rollup-plugin-output-size'; 2 3export default { 4 input: 'index.js', 5 output: { dir: 'dist' }, 6 plugins: [ 7 outputSize({ 8 summary(summary) { 9 console.log(summarize(summary)); 10 } 11 }) 12 ] 13};
1[total] {entry.hSize} + {chunk.hSize} + {asset.hSize} = {total.hSize} 2[total] {gzip.entry.hSize} + {gzip.chunk.hSize} + {gzip.asset.hSize} = {gzip.total.hSize} (gzip)
Licensed under the MIT License.
No vulnerabilities found.
No security vulnerabilities found.