@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 (27 loc) • 801 B
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true});
var _chunkKTEGKYAHjs = require('./chunk-KTEGKYAH.js');
// 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;
_chunkKTEGKYAHjs.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`);
}
};
}
exports.analyze = analyze;