GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — OpenAgentPack/scripts/check-web-bundle.ts at main · modelstudioai/OpenAgentPack

Expand file tree

/

check-web-bundle.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
30 lines (25 loc) · 1.18 KB
/

check-web-bundle.ts

Copy path

File metadata and controls

30 lines (25 loc) · 1.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { readdirSync, statSync } from "node:fs";
import { join, resolve } from "node:path";
// The webui ships as a single self-contained IIFE bundle (see apps/webui/vite.config.ts):
// the Bailian console injects the entry as a classic <script>, so code-splitting into
// ES-module chunks is not an option. Enforce a budget on the *total* JavaScript instead.
const MAX_TOTAL_JAVASCRIPT_BYTES = 1536 * 1024;
const assetsDir = resolve(import.meta.dirname, "../apps/webui/dist/assets");
const jsFiles = readdirSync(assetsDir)
.filter((file) => file.endsWith(".js"))
.map((file) => ({ file, bytes: statSync(join(assetsDir, file)).size }));
const totalBytes = jsFiles.reduce((sum, { bytes }) => sum + bytes, 0);
if (totalBytes > MAX_TOTAL_JAVASCRIPT_BYTES) {
for (const { file, bytes } of jsFiles) {
console.error(` ${file}: ${(bytes / 1024).toFixed(1)} KiB`);
}
console.error(
`Total JavaScript ${(totalBytes / 1024).toFixed(1)} KiB exceeds the ${(MAX_TOTAL_JAVASCRIPT_BYTES / 1024).toFixed(
0,
)} KiB budget`,
);
process.exit(1);
}
console.log(
`✓ WebUI JavaScript is within the ${(MAX_TOTAL_JAVASCRIPT_BYTES / 1024).toFixed(0)} KiB budget (${(totalBytes / 1024).toFixed(1)} KiB)`,
);
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.