@storm-software/build-tools
Version:
A comprehensive set of tools for building and managing projects within a Storm workspace. Includes builders such as rollup, rolldown, tsup, and unbuild, along with various utilities.
33 lines (30 loc) • 686 B
JavaScript
import {
writeInfo
} from "./chunk-R2HS3O2S.mjs";
// src/plugins/analyze.ts
var formatBytes = (bytes) => {
if (bytes === 0) {
return "0 Bytes";
}
if (bytes === 1) {
return "1 Byte";
}
const k = 1e3;
const dm = 3;
const sizes = ["Bytes", "KB", "MB", "GB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
};
function analyze() {
return {
name: "storm:plugin-analyzer",
renderChunk(source, chunk) {
const sourceBytes = formatBytes(source.length);
const fileName = chunk.fileName;
writeInfo(` - ${fileName} ${sourceBytes}`);
}
};
}
export {
analyze
};