fix: harden frontend state and tooling

This commit is contained in:
zhoujun0601
2026-08-13 12:04:23 -04:00
parent 833908ac9c
commit a027edda88
19 changed files with 1773 additions and 392 deletions
+16
View File
@@ -0,0 +1,16 @@
import { readdir, stat } from "node:fs/promises";
import { resolve } from "node:path";
const assets = resolve("../backend/internal/web/dist/assets");
const files = (await readdir(assets)).filter((file) => file.endsWith(".js"));
const limit = 500_000;
const oversized = [];
for (const file of files) {
const size = (await stat(resolve(assets, file))).size;
if (size > limit) oversized.push(`${file}: ${size} bytes`);
}
if (oversized.length) {
throw new Error(
`JavaScript bundle 超过 ${limit} bytes:\n${oversized.join("\n")}`,
);
}