measure-bundle-size
v1.6.0
Published
[![Coverage Status](https://coveralls.io/repos/github/ambar/vscode-bundle-size/badge.svg?branch=main)](https://coveralls.io/github/ambar/vscode-bundle-size?branch=main) [![npm version](https://badgen.net/npm/v/measure-bundle-size)](https://www.npmjs.com/p
Downloads
1,301
Readme
measure-bundle-size
Install
yarn add measure-bundle-size
Usage
import {measureIterable, measure, type MeasureResult} from 'measure-bundle-size'
type MeasureOptions = {
debug?: boolean
log?: (...args: any[]) => void
stats?: boolean | 'tree' | 'table'
workspaceFolder?: string
flowPattern?: RegExp
loader?: esbuild.BuildOptions['loader']
}
// Lazy async generator API
type measureIterable = (input: string, fileName?: string | null, MeasureOptions) => AsyncGenerator<MeasureResult>
for await (const result of measureIterable(`code`, __filename, {
debug: true,
log: () => {},
stats: 'table',
workspaceFolder: '.',
})) {
//
}
// Promise API
type measure = (input: string, fileName?: string | null, MeasureOptions) => Promise<MeasureResult[]>
const results = await measure(`code`, __filename, {
debug: true,
log: () => {},
stats: 'table',
workspaceFolder: '.',
})