lmjtfy.git / ds-bundle / README.md
1# Chapter 15: ds-bundle, the one script the page loads
2
3Most websites load JavaScript from somewhere else. This one loads exactly one
4script, and it comes from here: Datastar, a small library that lets the
5server drive the page. The browser posts what was typed, the server streams
6back HTML, and Datastar swaps it into place. That is the whole client side
7of chapter 2's "the browser holds no state".
8
9`datastar.js` is v1.0.4, upstream's own release build, the same file
10`~/dashboard` serves. The Worker embeds it at build time and serves it at
11`/datastar.js`, so the site's own code comes from the site. Two scripts do
12not: mermaid, on the code pages only, pinned from jsdelivr; and Cloudflare's
13Web Analytics beacon, which Cloudflare adds to every page as it passes
14through (chapter 2, "What Cloudflare keeps").
15
16> **Aside.** Why vendor it instead of a CDN link? Pinned bytes in the
17> repository cannot change under you, cannot be taken down, and cannot be
18> swapped by somebody else's server. When it moves, it moves in a commit.
19
20## For the people who maintain it
21
22To move it, replace the file with a newer release build and check the page's
23`data-*` attributes against that release's syntax.
24
25| File | What |
26| --- | --- |
27| [datastar.js](datastar.js) | Datastar v1.0.4, upstream's build. Not edited here. |
28
29← Previous: [Chapter 14½, eval/src/](../tools/eval/src/) · Up: [lmjtfy](../) · Next: [Chapter 15½, third-party/](../third-party/) →