chore: import upstream snapshot with attribution
Build documentation / build (push) Failing after 0s
Unit tests / build (18) (push) Has been cancelled
Unit tests / build (20) (push) Has been cancelled
Unit tests / build (22) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:44:39 +08:00
commit 311a3666c4
703 changed files with 71017 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import { readFileSync } from "node:fs";
import { gzipSync } from "node:zlib";
import path from "node:path";
import { colors } from "./logger.mjs";
export const formatSize = (bytes) => {
if (bytes < 1024) return `${bytes}b`;
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}kb`;
return `${(bytes / (1024 * 1024)).toFixed(2)}mb`;
};
export const reportSize = (outfile, log) => {
const content = readFileSync(outfile);
const size = content.length;
const gzipSize = gzipSync(content).length;
const filename = path.basename(outfile);
log.done(
`${colors.bright}${filename}${colors.reset} ${colors.gray}${formatSize(size)}${colors.reset} ${colors.dim}(gzip: ${formatSize(gzipSize)})${colors.reset}`,
);
};