diff --git a/.changeset/silly-numbers-collect.md b/.changeset/silly-numbers-collect.md new file mode 100644 index 0000000..5ed84a1 --- /dev/null +++ b/.changeset/silly-numbers-collect.md @@ -0,0 +1,5 @@ +--- +"sonda": patch +--- + +Round module type percentages to two decimal places diff --git a/packages/html-report/src/components/Dialogs/OutputDialog.svelte b/packages/html-report/src/components/Dialogs/OutputDialog.svelte index 750b4be..3a2b731 100644 --- a/packages/html-report/src/components/Dialogs/OutputDialog.svelte +++ b/packages/html-report/src/components/Dialogs/OutputDialog.svelte @@ -87,9 +87,9 @@ const formats = $derived.by( () => { return formats; } ); -const esmPercentage = $derived( Math.round( formats.esm / data.uncompressed * 100 ) ); -const cjsPercentage = $derived( Math.round( formats.cjs / data.uncompressed * 100 )); -const unknownPercentage = $derived( Math.round( formats.unknown / data.uncompressed * 100 ) ); +const esmPercentage = $derived( Math.round( formats.esm / data.uncompressed * 10000 ) / 100 ); +const cjsPercentage = $derived( Math.round( formats.cjs / data.uncompressed * 10000 ) / 100); +const unknownPercentage = $derived( Math.round( formats.unknown / data.uncompressed * 10000 ) / 100 ); const dependencies = $derived.by>( () => { const packageNameRegExp = /(?:.*node_modules\/)(@[^\/]+\/[^\/]+|[^\/]+)/;