| 1 | // fixtures/bundles.mjs — the bundles the app ships, in one list. |
| 2 | // build-bundles.mjs builds and commits them; colophon-inputs.mjs builds |
| 3 | // the same list again, in memory, to name the packages inside them for |
| 4 | // the Colophon (internal/shipped). One list, so the Colophon cannot |
| 5 | // describe a bundle the app does not ship or miss one it does. |
| 6 | // |
| 7 | // The names here are the names internal/docs/assets.go's bundleKinds |
| 8 | // expects; that file panics at init if one of them has no committed |
| 9 | // file, so a build that silently stopped emitting one cannot start. |
| 10 | // |
| 11 | // Two bundles are kept separate on purpose. The editor is ProseMirror |
| 12 | // and Yjs — about 300KB — and only a document page needs it. The |
| 13 | // jump-to palette is a few KB and every signed-in page needs it, |
| 14 | // including the list. Bundling them together would make opening the |
| 15 | // list download an editor in order to offer a keyboard shortcut. |
| 16 | export const bundles = [ |
| 17 | { name: 'editor', entry: 'editor-entry.js' }, |
| 18 | { name: 'jumpto', entry: 'jump-to.mjs' }, |
| 19 | // The share page's Copy button: a few hundred bytes, and only that |
| 20 | // page needs it. |
| 21 | { name: 'share', entry: 'share-link.mjs' }, |
| 22 | // The font gate: every document page, writer or reader, before the |
| 23 | // editor (fonts-gate.mjs). |
| 24 | { name: 'fontsgate', entry: 'fonts-gate.mjs' }, |
| 25 | // The hold: a classic, blocking script in <head>, so an IIFE. |
| 26 | { name: 'fontshold', entry: 'fonts-hold.js', format: 'iife' }, |
| 27 | ] |
| 28 | |
| 29 | // The esbuild options every bundle is built with. |
| 30 | export const options = { bundle: true, minify: true, target: 'es2020' } |
| 31 | |