mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-11-27 10:43:32 +00:00
Read Shiki assets through the ASSETS binding on Cloudflare
The deployed server worker uses openNext/customWorkers/defaultWrangler.jsonc directly (.github deploy actions), so the binding only needs adding there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,11 +17,11 @@ Commands (from `packages/gitbook`):
|
||||
| Cold first highlight, 3 langs (median) | 195 ms | 188 ms | | |
|
||||
| RSS after first highlight (median) | 207 MB | 207 MB | | |
|
||||
| **Cloudflare server worker** | | | | |
|
||||
| `handler.mjs` | 23.61 MB (gzip 5.21 MB) | | | |
|
||||
| ↳ Shiki in handler | 8.69 MB | | | |
|
||||
| Upload (wrangler dry-run) | 23 542 KiB (gzip 5 529 KiB) | | | |
|
||||
| Server heap after first render | 53.3 MB | | | |
|
||||
| Server heap after load | 71.6 MB | | | |
|
||||
| `handler.mjs` | 23.61 MB (gzip 5.21 MB) | — | 14.85 MB (gzip 3.82 MB) | |
|
||||
| ↳ Shiki in handler | 8.69 MB | — | 0 | |
|
||||
| Upload (wrangler dry-run) | 23 542 KiB (gzip 5 529 KiB) | — | 15 032 KiB (gzip 4 184 KiB) | |
|
||||
| Server heap after first render | 53.3 MB | — | 52.9 MB | |
|
||||
| Server heap after load | 71.6 MB | — | 52.9 MB (not comparable, see notes) | |
|
||||
| **Client** | | | | |
|
||||
| JS chunks | 12.60 MB (437 files) | 3.59 MB (142 files) | | |
|
||||
| ↳ grammar chunks | 8.19 MB (236 files) | 0 (2 remaining `scopeName` chunks are the Shiki engine and an unrelated lib) | | |
|
||||
@@ -36,3 +36,9 @@ Notes:
|
||||
- Vercel: the grammars still ship in the function, as on-demand JSON instead of module files; the
|
||||
trace only shrinks by ~1 MB. A dynamic `join(process.cwd(), 'public/~gitbook/static', path)` made
|
||||
file tracing pull all of `static` (65 MB trace); keeping `shiki` in the literal fixed it.
|
||||
- Cloudflare heap: the 3 follow-up requests re-rendered in the baseline run (~11 s each) but were
|
||||
served in <1 s after Task 3, so "after load" is not comparable. Heap after the first render is
|
||||
the like-for-like number: unchanged, since lazily imported grammar modules were never evaluated
|
||||
unless used. The Cloudflare gain is script size (−37 % raw, −24 % gzip upload), not heap.
|
||||
- Cloudflare render verified on the split workers: quickstart page 200, 154 highlighted tokens
|
||||
(same as baseline), grammars read through the server worker's `ASSETS` binding.
|
||||
|
||||
Reference in New Issue
Block a user