Repository navigation
Commit 131ad07
authored
## Summary
- Enable `minify: true` + `keepNames: true` in the esbuild config that
produces `dist-experimental/index.js`.
- `dist-experimental/index.js`: **1395K → 683K (–60%)**.
- `dist-experimental/` total: **2.7M → 1.79M**, comfortably under the 3M
cap.
- Loosen the `patchHostDefault()` regex so it survives identifier
mangling — both legacy `dist/` (`env=env`) and the new minified
`dist-experimental/` (`env=Ue`) get patched correctly.
## Why
Issue #117 (`area:tarball`): the experimental bundle ships unminified,
paying a ~700K size penalty in every `npx @forgeplan/web init
--experimental` install. PRD-014 SC-1 already pins a ≤3M cap on `dist/`;
minifying brings the experimental shape closer to a future graduation
target with headroom for upgrades.
Notes on choices:
- `keepNames: true` — preserves `Function.name` / `class.name` so sirv,
polka, and SvelteKit error formatters that key off names still resolve.
- `legalComments: "none"` was already set, so no license-banner
regression.
- The 3M cap (`DIST_EXPERIMENTAL_MAX_BYTES`) is left as-is — 1.79M
actual leaves 40% headroom for legitimate growth (Svelte/d3/adapter-node
bumps).
## Test plan
- [x] `npm run build` succeeds, both `dist/` and `dist-experimental/`
produced.
- [x] `[build] patched HOST default 0.0.0.0 → 127.0.0.1 in
./dist/index.js (env=env)` — legacy still patches.
- [x] `[build] patched HOST default 0.0.0.0 → 127.0.0.1 in
./dist-experimental/index.js (env=Ue)` — minified bundle gets the
loopback patch with the mangled identifier captured.
- [x] `npm run smoke` passes (legacy `dist/` happy path).
- [x] Experimental shim smoke (manual): init `--experimental`, start
server, probe endpoints — `/api/health` ok, `/api/list` ok, `GET /`
returns HTML, all 200.
- [x] `dirSizeBytes(DIST_EXPERIMENTAL)` = 1.88M, well below
`DIST_EXPERIMENTAL_MAX_BYTES = 3M` cap.
Refs: PRD-014, #117
🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 file changed
Lines changed: 24 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
172 | 178 | | |
173 | 179 | | |
174 | 180 | | |
175 | 181 | | |
176 | 182 | | |
177 | | - | |
178 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
179 | 190 | | |
180 | 191 | | |
181 | 192 | | |
| |||
290 | 301 | | |
291 | 302 | | |
292 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
293 | 313 | | |
294 | 314 | | |
295 | 315 | | |
| |||
0 commit comments