UNPKG

@soleil-se/build-app

Version:

Script for building WebApps, RESTApps, Widgets and MCP Servers with Svelte in Sitevision.

22 lines (17 loc) 672 B
import { basename } from 'path'; import { gzipSizeSync } from 'gzip-size'; import prettyBytes from 'pretty-bytes'; import chalk from 'chalk'; import { getTimestamp } from '@soleil-se/build-utils/log'; export default function bundleSize() { return { name: 'rollup-plugin-bundle-size', generateBundle({ file }, bundle) { const asset = basename(file); const { code } = bundle[asset]; const original = prettyBytes(code.length); const gzipped = prettyBytes(gzipSizeSync(code)); console.log(getTimestamp(), `${chalk.green('Created bundle')} ${file}: ${chalk.yellow(original)}${chalk.greenBright(gzipped)} (gzip)`); }, }; }