@johnhenry/sitefile 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/CHANGELOG.md +516 -0
  2. package/README.md +59 -9
  3. package/lib/src/archive-writers.d.ts +12 -2
  4. package/lib/src/archive-writers.js +53 -10
  5. package/lib/src/bake.d.ts +2 -0
  6. package/lib/src/bake.js +30 -1
  7. package/lib/src/bcrypt.d.ts +25 -0
  8. package/lib/src/bcrypt.js +201 -0
  9. package/lib/src/canonical.d.ts +19 -0
  10. package/lib/src/canonical.js +60 -0
  11. package/lib/src/car.d.ts +34 -0
  12. package/lib/src/car.js +203 -0
  13. package/lib/src/checklinks.js +8 -2
  14. package/lib/src/cli/bake.js +4 -3
  15. package/lib/src/cli/build-image.d.ts +1 -0
  16. package/lib/src/cli/build-image.js +1 -0
  17. package/lib/src/cli/common.js +4 -1
  18. package/lib/src/cli/hosts.d.ts +5 -0
  19. package/lib/src/cli/hosts.js +78 -0
  20. package/lib/src/cli/images.js +23 -5
  21. package/lib/src/cli/import-config.d.ts +2 -0
  22. package/lib/src/cli/import-config.js +56 -0
  23. package/lib/src/cli/index.d.ts +6 -1
  24. package/lib/src/cli/index.js +34 -2
  25. package/lib/src/cli/integrity.d.ts +2 -0
  26. package/lib/src/cli/integrity.js +77 -0
  27. package/lib/src/cli/network.d.ts +7 -0
  28. package/lib/src/cli/network.js +14 -3
  29. package/lib/src/cli/serve-keys.d.ts +39 -0
  30. package/lib/src/cli/serve-keys.js +106 -0
  31. package/lib/src/cli/serve-worker.js +119 -8
  32. package/lib/src/cli/servers.d.ts +130 -1
  33. package/lib/src/cli/servers.js +754 -72
  34. package/lib/src/cli/up.d.ts +2 -0
  35. package/lib/src/cli/up.js +193 -0
  36. package/lib/src/cli/watch.d.ts +14 -1
  37. package/lib/src/cli/watch.js +20 -3
  38. package/lib/src/cli.js +138 -18
  39. package/lib/src/csp.d.ts +17 -0
  40. package/lib/src/csp.js +52 -0
  41. package/lib/src/dictionary.d.ts +16 -0
  42. package/lib/src/dictionary.js +89 -0
  43. package/lib/src/epub.d.ts +5 -0
  44. package/lib/src/epub.js +113 -0
  45. package/lib/src/errors.d.ts +22 -9
  46. package/lib/src/errors.js +20 -1
  47. package/lib/src/executor.d.ts +31 -1
  48. package/lib/src/executor.js +231 -24
  49. package/lib/src/explain.js +33 -3
  50. package/lib/src/export-for.d.ts +42 -0
  51. package/lib/src/export-for.js +466 -0
  52. package/lib/src/export-formats.d.ts +2 -2
  53. package/lib/src/export-formats.js +52 -2
  54. package/lib/src/fingerprint.d.ts +3 -1
  55. package/lib/src/fingerprint.js +32 -5
  56. package/lib/src/host-config.d.ts +34 -0
  57. package/lib/src/host-config.js +645 -0
  58. package/lib/src/hosts.d.ts +47 -0
  59. package/lib/src/hosts.js +106 -0
  60. package/lib/src/hreflang.d.ts +25 -0
  61. package/lib/src/hreflang.js +72 -0
  62. package/lib/src/index.d.ts +1 -1
  63. package/lib/src/index.js +1 -1
  64. package/lib/src/integrity.d.ts +115 -0
  65. package/lib/src/integrity.js +273 -0
  66. package/lib/src/language/ast.d.ts +126 -3
  67. package/lib/src/language/ast.js +7 -1
  68. package/lib/src/language/parser.js +189 -7
  69. package/lib/src/language/validate.js +24 -0
  70. package/lib/src/links.d.ts +47 -0
  71. package/lib/src/links.js +289 -3
  72. package/lib/src/lint.d.ts +1 -1
  73. package/lib/src/lint.js +26 -1
  74. package/lib/src/mime-data.d.ts +2 -0
  75. package/lib/src/mime-data.js +92 -0
  76. package/lib/src/oci.d.ts +20 -2
  77. package/lib/src/oci.js +70 -28
  78. package/lib/src/outdated.d.ts +3 -0
  79. package/lib/src/outdated.js +4 -4
  80. package/lib/src/planner.d.ts +87 -2
  81. package/lib/src/planner.js +189 -8
  82. package/lib/src/plugins/cache.d.ts +11 -0
  83. package/lib/src/plugins/cache.js +29 -0
  84. package/lib/src/plugins/host.d.ts +51 -2
  85. package/lib/src/plugins/host.js +141 -16
  86. package/lib/src/plugins/wasm.js +1 -3
  87. package/lib/src/portable.d.ts +8 -0
  88. package/lib/src/portable.js +47 -0
  89. package/lib/src/precache.d.ts +33 -0
  90. package/lib/src/precache.js +75 -0
  91. package/lib/src/precompress.d.ts +19 -0
  92. package/lib/src/precompress.js +35 -0
  93. package/lib/src/qr.d.ts +18 -0
  94. package/lib/src/qr.js +372 -0
  95. package/lib/src/registry-ops.js +4 -2
  96. package/lib/src/reload-client.d.ts +2 -0
  97. package/lib/src/reload-client.js +419 -0
  98. package/lib/src/resources/archive.d.ts +37 -1
  99. package/lib/src/resources/archive.js +353 -71
  100. package/lib/src/resources/convert.js +3 -1
  101. package/lib/src/resources/https.d.ts +9 -1
  102. package/lib/src/resources/https.js +36 -0
  103. package/lib/src/resources/network.d.ts +25 -3
  104. package/lib/src/resources/network.js +77 -6
  105. package/lib/src/secrets.d.ts +12 -3
  106. package/lib/src/secrets.js +18 -5
  107. package/lib/src/serve-auth.d.ts +33 -0
  108. package/lib/src/serve-auth.js +120 -0
  109. package/lib/src/serve-rules.d.ts +83 -7
  110. package/lib/src/serve-rules.js +264 -53
  111. package/lib/src/server.d.ts +529 -11
  112. package/lib/src/server.js +1439 -57
  113. package/lib/src/servers-file.d.ts +36 -0
  114. package/lib/src/servers-file.js +101 -0
  115. package/lib/src/servers.d.ts +115 -7
  116. package/lib/src/servers.js +151 -29
  117. package/lib/src/single-file.d.ts +12 -0
  118. package/lib/src/single-file.js +147 -0
  119. package/lib/src/site.d.ts +58 -0
  120. package/lib/src/site.js +216 -5
  121. package/lib/src/store.js +9 -5
  122. package/lib/src/swbn.d.ts +10 -0
  123. package/lib/src/swbn.js +86 -0
  124. package/lib/src/toml.d.ts +17 -0
  125. package/lib/src/toml.js +323 -0
  126. package/lib/src/wacz.d.ts +6 -0
  127. package/lib/src/wacz.js +96 -0
  128. package/lib/src/warc.d.ts +28 -0
  129. package/lib/src/warc.js +252 -0
  130. package/lib/src/watch.d.ts +12 -1
  131. package/lib/src/watch.js +67 -1
  132. package/lib/src/wbn.d.ts +9 -1
  133. package/lib/src/wbn.js +23 -33
  134. package/lib/src/zstd.d.ts +4 -0
  135. package/lib/src/zstd.js +328 -0
  136. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,521 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.4 (2026-11-09)
4
+
5
+ - **`.tar.zst` / `.tzst` archives** (johnhenry/sitefile#221): `IMPORT … AS tree`, `serve`, `verify` and
6
+ `diff` read Zstandard-compressed tars (detected by magic bytes, like gzip), with the same entry,
7
+ size and ratio limits. TypeScript uses node:zlib's `zstdDecompress`; Rust uses the `ruzstd` crate
8
+ (pure Rust, decode only; new dependency approved by the owner, rationale in rust/Cargo.toml).
9
+ Both read what libzstd reads: several frames, skippable frames, checksums; a window over 128 MiB is
10
+ refused. The E_TYPE message no longer calls zstd unsupported.
11
+ - **hreflang alternates: `LANGUAGES <code>… [DEFAULT <code>]`** (johnhenry/sitefile#303):
12
+ names the site's language folders, so `/en/about.html` and `/fr/about.html` are the same page
13
+ (pages outside the folders are the DEFAULT language's); documents with frontmatter `lang` and
14
+ a shared `translationKey` (rendered by an earlier `RENDER … FOR`) are paired by key instead,
15
+ for different slugs per language. CANONICAL then adds `<link rel="alternate" hreflang="…">`
16
+ for every translation (plus `x-default` for the DEFAULT language's page), and SITEMAP adds
17
+ `xhtml:link` alternates, also in a split sitemap. Unknown language codes and two pages of one
18
+ language in a group are `E_VALIDATION`. Both implementations, with conformance cases, LSP
19
+ hover and completion, grammars; example `examples/hreflang`.
20
+ - **bcrypt entries in `serve --auth-file`** (johnhenry/sitefile#278): `$2y$` (what `htpasswd -B` writes),
21
+ `$2a$` and `$2b$` hashes at cost 4 to 31 are accepted next to `{SHA}`. Keys are the password's UTF-8 bytes
22
+ up to a NUL, at most 72 bytes; digests are compared in constant time. TypeScript has its own
23
+ EksBlowfish (src/bcrypt.ts, no npm dependency); Rust uses the `bcrypt` crate's raw function (new
24
+ dependency approved by the owner, rationale in rust/Cargo.toml). Tested with OpenBSD's and
25
+ htpasswd's vectors in both, and in the `serve-auth` conformance case.
26
+ - **Synced browsing: `serve --watch --sync[=scroll]`** (johnhenry/sitefile#309): opt-in, for
27
+ `serve --watch` and `serve -d --watch` (the record keeps it). Each open page reports its path,
28
+ fragment and title (and with `=scroll` its scroll position) to `POST /__sitefile/client`
29
+ (same origin only, size- and rate-limited, no query strings, form contents, keys or cookies);
30
+ a navigation in one page is sent to the others as `{"type":"navigate"}` (and scrolling as
31
+ `{"type":"scroll"}`), which follow unless a form field has focus. Connected pages are listed
32
+ at `GET /__sitefile/clients` (loopback, non-browser clients only) and logged as `client`
33
+ lines (`{"type":"client",…}` with `--log-format json`), for Sitefile Desktop. Without
34
+ `--sync` nothing changes. Both implementations, with conformance cases.
35
+ - **`serve -d --watch ./dir`, and pages reload after a server restart** (johnhenry/sitefile#304):
36
+ a detached server can watch a plain directory (no Sitefile): it re-reads it on change and
37
+ live-reloads open pages, CSS swaps included; `--poll`/`--poll-interval` apply. The record keeps
38
+ `watch` and `pollMs`, so `server restart` watches again. Every live-reload stream now starts with
39
+ `id: <instance>`, and a page that reconnects with another instance's `Last-Event-ID` (the server
40
+ restarted) is told to reload. Both implementations, with conformance cases.
41
+ - **`IMPORT … AS tree` reads gzip-wrapped Web Bundles** (johnhenry/sitefile#141): after
42
+ gunzip, a Web Bundle is unpacked like a plain `.wbn` instead of failing with `gzip
43
+ content is not a tar archive`, so bundles written by `@johnhenry/fileable`
44
+ (`encode="wbn"`), `@johnhenry/packfile`'s `toArchive()` and `EXPORT … AS wbn COMPRESSION
45
+ gzip` import. Checked-in fixtures from both tools (`test/fixtures/gzip-wbn`) are read
46
+ by both implementations and a conformance case.
47
+ - **`bake` names a gzip Web Bundle target's default output like `build`** (johnhenry/sitefile#151):
48
+ a target with `format: wbn` (or `warc`) and no `output`, whose Sitefile exports in that format
49
+ with `COMPRESSION gzip`, now writes `dist/<target>.wbn.gz` (`.warc.gz`) instead of
50
+ `dist/<target>.wbn`. Both implementations, with a conformance case.
51
+
52
+ ## 0.0.3 (2026-11-09)
53
+
54
+ - **`serve` keys under `--tls-cert`, and `u`'s network URLs** (johnhenry/sitefile#300): `o` and `u`
55
+ use `https://` for an HTTPS server, and `u` lists every interface address (the start line's
56
+ `Network:` list) instead of only the default route's. Both implementations.
57
+ - **`serve --mime ext=type` and `--mime-file mime.types`** (the CLI half of
58
+ johnhenry/sitefile#220): custom content types before the built-in table,
59
+ kept in the server record. Both servers.
60
+ - **`serve --throttle 3g|slow-3g|<kbit>[/<ms>]`** (johnhenry/sitefile#227):
61
+ per-response latency and bandwidth limits, shown in the start message and kept
62
+ in the server record. Both servers.
63
+ - **`serve` compression** (johnhenry/sitefile#167): precompressed `<path>.br`
64
+ / `<path>.gz` variants by `Accept-Encoding` (br first), `--compress` for gzip
65
+ on the fly (byte-identical in both servers), `Vary: Accept-Encoding`, an ETag
66
+ per encoding; ranges stay identity.
67
+ - **`serve --tls-cert/--tls-key`** (johnhenry/sitefile#170): HTTPS with your
68
+ certificate (mkcert works), `https://` URLs, paths kept in the server record,
69
+ liveness probe over TLS. No CA is created. HTTP/1.1 only. Both servers (Rust
70
+ through rustls, already in its build).
71
+ - **Sharing safety for `serve`** (johnhenry/sitefile#191): `--random-route`
72
+ (a secret path prefix), `--allow-ip`/`--deny-ip` CIDR blocks, `--stop-after`
73
+ (with `expires` in the record), `X-Robots-Tag: noindex` on non-loopback
74
+ binds, and client address and device on access-log lines of non-loopback
75
+ clients. Both servers.
76
+ - **`serve --max-connections-per-ip <n>`** (johnhenry/sitefile#178): a
77
+ non-loopback client over the cap gets `503` with `Retry-After: 1`; kept in the
78
+ server record. Both servers.
79
+ - **`serve --auth user:password`, `--auth-file`, `SITEFILE_SERVE_AUTH`**
80
+ (johnhenry/sitefile#177): HTTP basic authentication on every request (401
81
+ with `WWW-Authenticate` otherwise), constant-time checks, only PBKDF2
82
+ verifiers in the server record, `auth: true` in `servers --json`, a warning on
83
+ non-loopback binds. htpasswd `{SHA}` entries; bcrypt is a follow-up. Both
84
+ servers.
85
+ - **`serve` prints network URLs on `0.0.0.0` / `::`** (johnhenry/sitefile#169):
86
+ a `Network:` line per non-loopback interface address (IPv4 first, IPv6 in
87
+ brackets), and `servers --json` gains `networkUrls`. Both implementations
88
+ (Rust reads the interfaces with `getifaddrs`, no new dependency).
89
+ - **`serve --log-format json`, `--log-ip`, `--quiet`** (johnhenry/sitefile#173):
90
+ one JSON object per log line (request, started, stopped, warning, error,
91
+ message), a stable contract in docs/CLI.md, identical in both servers; kept in
92
+ the server record. `server logs --json` converts text logs of older servers.
93
+ - **`serve --max-age`, `--immutable`, `--max-age-html`** (johnhenry/sitefile#175):
94
+ preview production `Cache-Control` on files (HTML keeps `no-cache` unless
95
+ `--max-age-html`); `_headers` still wins; kept in the server record. Both
96
+ servers.
97
+ - **Portable paths** (johnhenry/sitefile#222): EXPORT warns about exported
98
+ paths Windows cannot hold (reserved names such as `aux.html`, `:` and other
99
+ forbidden characters, a trailing dot or space) and about `_` files and
100
+ folders without `/.nojekyll` (GitHub Pages); `build --strict-paths` makes
101
+ them one `E_PATH_PORTABLE` error. A CHECKLINKS broken link whose target
102
+ differs from a file only in case names that file. Both implementations, with
103
+ conformance cases.
104
+ - **MIME: custom content types** (johnhenry/sitefile#220): `MIME <.ext>
105
+ <type/subtype>` adds a `/*.ext` `Content-Type` rule to `/_headers` (in
106
+ source order with HEADER), which `serve`, the hosts and `EXPORT … AS wbn`
107
+ use. Both implementations, with conformance cases. The CLI's `--mime` flag
108
+ is not part of this change.
109
+ - **CSP: Content-Security-Policy from inline hashes** (johnhenry/sitefile#219):
110
+ `CSP [POLICY <policy>] [META]` writes a per-page policy to `/_headers` (or a
111
+ `<meta>` with META) that allows each page's inline scripts and styles by
112
+ their SHA-256 instead of `'unsafe-inline'`. Both implementations, with
113
+ conformance cases; example `examples/csp`.
114
+ - **Development 404s and what-answered log notes** (johnhenry/sitefile#201):
115
+ a foreground or `--watch` server lists near misses on its 404 page
116
+ (letter-case differences, `_redirects` rules that matched the path but not
117
+ their query or conditions), and access-log lines note a clean URL, the SPA
118
+ fallback or the 404.html that answered. Both implementations.
119
+ - **`serve --host-profile` and `--html-handling`** (johnhenry/sitefile#192):
120
+ route like Netlify, Cloudflare Pages, Vercel, GitHub Pages or Firebase
121
+ (canonical page URLs and their redirect status, whether `_redirects` and
122
+ `_headers` are read, which 404 answers, Cloudflare's SPA fallback), or pick
123
+ Cloudflare's `auto`, `force-slash`, `drop-slash` or `none` directly. Kept in
124
+ the server record. Both implementations, with a conformance case per mode.
125
+ - **PRECACHE: a service-worker precache manifest** (johnhenry/sitefile#216):
126
+ `PRECACHE <pattern>… [TO <dest>] [INTO <service-worker>]` writes a
127
+ Workbox-style `[{url, revision}]` list (10 hex digits of the SHA-256;
128
+ `null` for fingerprinted files) to `/sw-manifest.json` and/or injects it at
129
+ `self.__WB_MANIFEST`. Both implementations, with conformance cases; example
130
+ `examples/precache`.
131
+ - **`serve --rewrite-base <url>`** (johnhenry/sitefile#196): the production
132
+ URL in served HTML, CSS and XML becomes the local origin (and `--base`), so
133
+ a preview with absolute self-links stays local. On by default in
134
+ `serve --watch` (from EXPORT, SITEMAP or FEED BASE; `--no-rewrite-base`
135
+ turns it off); never applied to exports. Both implementations.
136
+ - **`serve -d` printed its `Started …` line twice** (a merge of
137
+ johnhenry/sitefile#195): it is printed once, with the `--base` URL.
138
+ - **ROBOTS and SECURITY_TXT** (johnhenry/sitefile#217): `ROBOTS [ALLOW|DISALLOW
139
+ <path>]… [SITEMAP]` writes `/robots.txt` (with a `Sitemap:` line for each
140
+ SITEMAP of the Sitefile); `SECURITY_TXT CONTACT <uri>… EXPIRES <date>
141
+ [ENCRYPTION <uri>]… [POLICY <uri>]…` writes an RFC 9116
142
+ `/.well-known/security.txt`, rejects a missing Contact or Expires and warns
143
+ when Expires is near or past. Both implementations, with conformance cases;
144
+ example `examples/robots`.
145
+ - **`serve --isolate`** (johnhenry/sitefile#197): COOP `same-origin`, COEP
146
+ `require-corp` (or `--coep credentialless`) and CORP `same-origin` on every
147
+ response, for SharedArrayBuffer and wasm threads; `_headers` still wins; kept
148
+ in the server record. Both servers.
149
+ - **`serve --cors`** (johnhenry/sitefile#171): `Access-Control-Allow-Origin: *`
150
+ on every response (`_headers` still wins) and `OPTIONS` preflights answered
151
+ with `204`; kept in the server record. Both servers.
152
+ - **`serve` proxies** (johnhenry/sitefile#172): a `_redirects` rule with status
153
+ 200 and an `http(s)://` target forwards the request there, as on Netlify,
154
+ and `--proxy /api=http://localhost:3000` does the same for a dev backend.
155
+ This is off unless allowed: a `_redirects` proxy rule only reaches hosts in
156
+ `--allow-hosts`, and any other host gets a `502` naming the flag to add. The
157
+ build fetch policy applies (https unless `--allow-http`, public addresses
158
+ unless `--allow-private-network`, timeouts, every hop checked). Only GET and
159
+ HEAD are proxied, without cookies or credentials, and redirects are passed
160
+ on. `import-config` now also translates rewrites to URLs (Vercel,
161
+ Firebase).
162
+
163
+ - **`serve` Host allow-list against DNS rebinding** (johnhenry/sitefile#190):
164
+ both servers answer `403` unless `Host` is `localhost`, `*.localhost` or an
165
+ IP address; `--allowed-host <name>` (repeatable; `.example.test` for
166
+ subdomains, `*` for any) adds names and is kept in the server record.
167
+ - **PRECOMPRESS writes `.gz` sidecars** (johnhenry/sitefile#203):
168
+ `PRECOMPRESS [--overwrite] [gzip] <pattern>… [MIN <bytes>]` writes
169
+ `<file>.gz` next to matching text files of at least MIN bytes (default 1024)
170
+ when smaller, with the shared deterministic deflate encoder, for nginx
171
+ `gzip_static` and Caddy `precompressed`. `br` and `zstd` are rejected as not
172
+ supported yet. Both implementations, with conformance cases; example
173
+ `examples/precompress`.
174
+ - **`serve` in a terminal** (johnhenry/sitefile#224): single keys in a
175
+ foreground `serve` or `serve --watch`:
176
+ - `o` opens the browser;
177
+ - `u` prints the local URL, plus the network URL and its QR code when
178
+ bound to every interface;
179
+ - `r` rebuilds, or re-reads a served directory;
180
+ - `c` clears the screen;
181
+ - `q` quits;
182
+ - `h` lists the keys.
183
+
184
+ `--open[=path]` opens the browser at start (`$BROWSER`, else the system
185
+ default). `--qr` prints a QR code of the network URL. The QR encoder is
186
+ shared by both implementations: they check the same golden fixtures and
187
+ the standard's format and version bits.
188
+ - **WACZ export** (johnhenry/sitefile#206, WACZ part): `EXPORT / AS wacz BASE
189
+ <url>` (or `-o site.wacz`) writes a deterministic WACZ 1.1.1 package that
190
+ ReplayWeb.page opens: the site's WARC as `archive/data.warc.gz` (the same
191
+ bytes as `AS warc COMPRESSION gzip`), a sorted CDXJ index with each record's
192
+ offset and length, `pages/pages.jsonl` with every HTML page and its
193
+ `<title>`, and `datapackage.json` with `datapackage-digest.json`. Both
194
+ implementations; conformance case `ok-wacz`.
195
+ - **`serve --base /repo/`** (johnhenry/sitefile#195): serves the site under
196
+ a path prefix (GitHub Pages project sites): `/` redirects to it, `/repo`
197
+ gets its slash, everything else is 404, and the server's redirects and
198
+ `_redirects` path targets stay under it. `serve --watch` defaults it to the
199
+ path of the EXPORT BASE URL. Kept in the server record and shown in URLs.
200
+ Both implementations.
201
+ - **`import-config` reads what serve now understands** (johnhenry/sitefile#204,
202
+ after #193): `:placeholders` in sources and targets (Netlify, Vercel `:name`
203
+ segments, Firebase `:name` and `:name*`), Netlify `query` and `conditions`
204
+ (`Language`, `Country`, `Cookie`), and statuses 410 and 451 are now
205
+ translated rather than listed as unsupported. A target `:name` that the
206
+ source does not capture is still refused.
207
+ - **`EXPORT … AS epub`** (johnhenry/sitefile#209): an EPUB 3 book of the
208
+ site's XHTML pages (index first), with a generated package document and
209
+ navigation document (or the site's `/nav.xhtml`), deterministic metadata
210
+ and `mimetype` stored first without an extra field. The zip writer takes a
211
+ list of entries to write first that way, in both implementations. Example
212
+ `examples/book`; conformance `example/book:epub-*`, `case/err-epub-no-page`.
213
+
214
+ - **`serve --spa` falls back by navigation** (johnhenry/sitefile#194): the
215
+ app shell answers only page navigations (`Sec-Fetch-Mode`/`Sec-Fetch-Dest`,
216
+ else `Accept: text/html`), never subresources, so `/users/jane.doe` works
217
+ and a missing script stays 404. The shell is the nearest `200.html`
218
+ (Surge) or `index.html` (nested apps such as `/admin/`); `--spa-exclude
219
+ <glob>` skips paths and `--spa-fallback <path>` picks one file. Both
220
+ implementations.
221
+ - **`EXPORT … FOR <host>`** (johnhenry/sitefile#205): writes the REDIRECT
222
+ and HEADER rules (and FINGERPRINT's cache headers) as Netlify, Cloudflare
223
+ Pages, Vercel (Build Output API v3), Firebase Hosting (`firebase.json`),
224
+ Azure Static Web Apps (`staticwebapp.config.json`), GitHub Pages
225
+ (`.nojekyll`, `CNAME` from `BASE`) or S3 (website configuration and
226
+ per-object metadata) read them. A rule the host cannot express as Netlify
227
+ applies it is `E_EXPORT` naming the rule; `build --lossy` leaves it out
228
+ with a warning. This includes a redirect that a file in the export would
229
+ answer first on Netlify, on hosts that apply redirects first. Both
230
+ implementations, with a conformance case per host.
231
+
232
+ - **`_redirects`: placeholders, query matching, conditions, 410/451, nearest
233
+ 404 and warnings** (johnhenry/sitefile#193): `sitefile serve` understands
234
+ `:placeholders` (`/blog/:year/:slug /posts/:slug`), query parameters
235
+ (`/store id=:id /items/:id`), `Language=`, `Cookie=` and `Country=`
236
+ conditions (`--country` sets the country), statuses 410 and 451, and a
237
+ `404.html` in the nearest directory. Every `_redirects`/`_headers` line it
238
+ ignores is a warning with its line and reason (`--strict-site-files` makes
239
+ them an error), `validate` warns about REDIRECT/HEADER lines serve would
240
+ ignore (lint rule `serve-ignored`), and the access log names the rule that
241
+ answered (`→ /new (_redirects:3)`).
242
+ - **CANONICAL links and split sitemaps** (johnhenry/sitefile#218):
243
+ `CANONICAL BASE <url> [PRETTY]` adds `<link rel="canonical">` before
244
+ `</head>` of every page that has none (PRETTY drops `.html`), and SITEMAP
245
+ writes a sitemap index with numbered parts above 50,000 URLs or 50 MiB.
246
+ Both implementations, with conformance cases; example `examples/canonical`.
247
+ hreflang alternates are not done yet.
248
+ - **`--oci-layers <n>`** (johnhenry/sitefile#214): split an oci image's files
249
+ over `n` site layers (1-64, by a hash of each path) so pushing a new version
250
+ uploads only the layers whose files changed; `dev.sitefile.layers` in the
251
+ config marks them, and every reader (store, save, serve, push, pull,
252
+ `FROM image`) merges them. Default unchanged (one layer, same image IDs).
253
+ Both implementations; conformance `example/blog:oci-layers-*`,
254
+ `case/steps-oci-layers`.
255
+ - **Identical `--help` in both CLIs**: the `--node` line now reads "default
256
+ $SITEFILE_NODE, else the default Node, see docs/PLUGINS.md" in both. The
257
+ default itself differs (the TypeScript CLI's own Node, `node` on `PATH` for
258
+ the Rust binary), and that is now listed in docs/RUST.md "Known
259
+ differences". `save --help` in the Rust binary now lists `car`, `html` and
260
+ `mhtml` too. A `help-text` conformance case compares every command's help.
261
+ - **`serve`: `Last-Modified` and `103 Early Hints`** (johnhenry/sitefile#228):
262
+ file responses carry `Last-Modified` (image: when it was stored; directory:
263
+ newest file mtime; archive: its mtime; `--watch`: the build time), and
264
+ `If-Modified-Since` without `If-None-Match` gives `304`. An HTML page whose
265
+ `_headers` `Link` preloads or preconnects is preceded by a `103 Early Hints`
266
+ response with those links (HTTP/1.1 `GET` only). Both servers.
267
+ - **`sitefile import-config`** (johnhenry/sitefile#204): translates
268
+ netlify.toml, vercel.json, firebase.json, staticwebapp.config.json,
269
+ wrangler.toml/.json (`[assets]`) and an `.htaccess` subset into the
270
+ `_redirects` and `_headers` that `sitefile serve` understands today. Every
271
+ rule written is checked against serve's parser. Placeholders, conditions,
272
+ regular expressions, proxies and settings with no `_redirects` form are
273
+ listed as unsupported, never half translated. `--json` lists both. It reads
274
+ the TOML files with a small TOML subset shared by both implementations.
275
+ Fixtures for every format are conformance cases.
276
+ - **`serve` answers byte ranges** (johnhenry/sitefile#166): `Accept-Ranges:
277
+ bytes` on file responses; a single `Range` on `GET` gets `206` with
278
+ `Content-Range`, an unsatisfiable one `416`; `If-Range` (strong ETag match)
279
+ and `HEAD` are handled; multiple ranges are ignored (the whole file). Both
280
+ servers; `_headers` cannot set `accept-ranges` or `content-range`.
281
+ - **`sitefile up`, `down` and `ps`** (johnhenry/sitefile#223): a servers file
282
+ (`sitefile.servers.yaml`, `.yml` or `.json`) names several detached servers
283
+ (`source`, `publish`, `spa`). `up` starts them all, idempotently: it leaves
284
+ running ones alone, restarts exited ones and replaces changed ones. `down`
285
+ stops and removes the ones it started, and `ps` lists them, including those
286
+ not created yet. Sources are relative to the servers file. Server records
287
+ gain an optional `project` field. Both implementations, with conformance
288
+ cases.
289
+ - **`serve x.zip` serves in place** (#213): the zip is checked and indexed at
290
+ start and each entry is read from the file per request, so memory stays
291
+ flat for large zips; responses are unchanged, except that gzip clients get
292
+ deflated entries passed through as `content-encoding: gzip` (no
293
+ re-encoding). Library: `openZipFile`/`openZipArchive`/`loadServedSite` and
294
+ `SiteServerOptions.content` (Rust: `open_zip_file`, `open_zip_archive`,
295
+ `load_served_site`, `SiteServerOptions::content`). Both implementations.
296
+ - **E_TYPE names the format** (#221): an xz, zstd or bzip2 stream, a 7z or a
297
+ RAR archive given to `IMPORT … AS tree` or `serve` is named in the error,
298
+ with what to convert it to. (zstd decoding is not added: the Rust side has
299
+ no zstd decoder without a new dependency; see #221.) Both implementations.
300
+ - **ZIP64 zips are read** (#185): the zip64 end record and locator and the
301
+ 0x0001 extra field (central and local) are read, so zips from Python's
302
+ `force_zip64`, Java, Go and Node `archiver` with `forceZip64` import and
303
+ serve; the archive limits still refuse large ones. Writing ZIP64 stays
304
+ unsupported. Both implementations.
305
+ - **Zip local headers are cross-checked** (#184): a local header whose name,
306
+ compression method or sizes (without a data descriptor) differ from the
307
+ central directory, or entries whose bytes overlap, are `E_ARCHIVE_UNSAFE`,
308
+ so sitefile never extracts different files than `unzip` or a browser would.
309
+ Directory entries' local headers are now checked too. Both implementations.
310
+ - **Zip CRC-32 check** (#183): every extracted zip entry is checked against
311
+ its central-directory CRC-32; a mismatch is `E_ARCHIVE` naming the entry
312
+ (`IMPORT … AS tree`, `serve x.zip`). Both implementations.
313
+ - **Zip names without the UTF-8 flag** (#182): names without general-purpose
314
+ bit 11 are read from the Info-ZIP Unicode Path field (0x7075) when its CRC
315
+ matches, else as UTF-8 when valid, else as CP437 (they used to become
316
+ U+FFFD, and two names could collide). Applies to `IMPORT … AS tree` and
317
+ `serve x.zip`, in both implementations.
318
+ - **Zip export stores already-compressed media** (#203, writer half): png,
319
+ jpg, webp, avif, woff2, mp4, zip, gz and similar extensions are stored
320
+ without running deflate, so exports of media-heavy sites are faster. Zip
321
+ bytes change only for such entries that deflate had shrunk slightly; tar.gz
322
+ and OCI layers (image IDs) are unchanged. Both implementations, with a
323
+ byte-for-byte conformance case (`zip-stored-media`).
324
+ - **Zip export writes the extended timestamp** (#187): every entry carries the
325
+ 0x5455 "UT" extra field (mtime only) in its local and central header, so
326
+ `SOURCE_DATE_EPOCH` survives extraction in any time zone (unzippers read
327
+ the DOS time as local time). **This changes zip export bytes**: every
328
+ `-o x.zip` (and `EXPORT … AS zip`) output differs from 0.0.2's, still
329
+ deterministic and identical across the TypeScript and Rust writers (their
330
+ byte-for-byte fixtures are updated together). Image IDs are not affected.
331
+ - **Compression Dictionary Transport, experimental** (johnhenry/sitefile#215):
332
+ `build --experimental-dictionary <previous>` adds `Use-As-Dictionary`
333
+ headers for scripts, styles, JSON, wasm and HTML, and a `<path>.dcz`
334
+ Zstandard delta against the previous build for each that changed;
335
+ `serve` answers `Available-Dictionary` + `Accept-Encoding: dcz` with it.
336
+ A small deterministic Zstandard encoder shared by both implementations
337
+ (`src/zstd.ts`, `rust/src/zstd.rs`); frames decode with libzstd.
338
+ Conformance cases `steps-dictionary`, `serve-dictionary`.
339
+ - **`EXPORT … AS swbn KEY <secret-id>`** (johnhenry/sitefile#207): a Signed
340
+ Web Bundle for Isolated Web Apps, signed with an Ed25519 PEM key passed as
341
+ `--secret id=<id>,src=key.pem` (never stored). The output is
342
+ byte-identical to `wbn-sign` 0.3.1's; `build` prints the Web Bundle ID.
343
+ The Rust port signs with `ring`'s Ed25519 (already in the build through rustls).
344
+ `--secret` values may now contain line breaks; a value used as an HTTP
345
+ header still may not. Conformance cases `ok-swbn`, `err-swbn-*`.
346
+ - **WARC export, import and serve** (johnhenry/sitefile#206, WARC part):
347
+ `EXPORT / AS warc BASE <url>` writes a deterministic WARC/1.1 file (one
348
+ `response` record per file with its `_headers`, directory indexes at their
349
+ directory URL; `COMPRESSION gzip` or `-o x.warc.gz` gzips each record);
350
+ `IMPORT … AS tree` and `sitefile serve` read `.warc` and `.warc.gz`. Both
351
+ implementations; conformance cases `ok-warc`, `ok-warc-gzip`,
352
+ `ok-warc-import`. WACZ follows once the zip writer work lands.
353
+ - **DOM-morphing reload with scroll restore** (johnhenry/sitefile#200): when a
354
+ rebuild changed only existing HTML files, the reload event carries
355
+ `"morph":true` and pages update in place (scroll, focus and form input
356
+ stay), falling back to a full reload when their scripts changed. Full
357
+ reloads keep the scroll position. `--reload full` turns morphing off.
358
+ - **`serve --watch --navigate-to-changed`** (johnhenry/sitefile#199): after a
359
+ rebuild that changed exactly one page, the reload event carries its URL
360
+ (`{"type":"reload","path":"/posts/hello/"}`) and open pages go there.
361
+ - **Build-error overlay and Rebuilding badge** (johnhenry/sitefile#198): the
362
+ `serve --watch` stream sends `{"type":"building"}` when a rebuild starts,
363
+ `{"type":"error",code,message,file,line,column}` when it fails (also to
364
+ pages that connect while it is broken) and `{"type":"ok"}` for a good
365
+ rebuild with identical output. Pages show a badge while rebuilding and a
366
+ dismissible overlay (in a shadow root) on errors; `--no-overlay` turns
367
+ both off.
368
+ - **Browser console errors in the `serve --watch` log** (johnhenry/sitefile#174):
369
+ the live-reload client forwards uncaught errors, unhandled rejections,
370
+ `console.error` and `console.warn` (`--console`: also `log` and `info`) to
371
+ `POST /__sitefile/console`, and the server prints them as `browser error: ...`
372
+ lines. Same-origin only (`Origin` must match `Host`), 16 KiB per message,
373
+ 50 messages per 10 s.
374
+ - **`serve --watch` for a plain directory, with CSS injection**
375
+ (johnhenry/sitefile#168): `serve --watch ./dir` on a directory without a
376
+ `Sitefile` (and without `-f`, `--target` or `--build-arg*`) serves it as it
377
+ is and re-reads it on change. Events are now JSON:
378
+ `{"type":"reload"}`, or `{"type":"css","paths":[...]}` when only existing
379
+ stylesheets changed, in which case pages swap the `<link>` instead of
380
+ reloading (`--no-css-inject` turns that off). A rebuild with identical
381
+ output sends no event.
382
+ - **`--poll` for watch mode** (johnhenry/sitefile#225): `build --watch` and
383
+ `serve --watch` take `--poll` (stat polling every 1000 ms instead of file
384
+ system events, for network shares, Docker bind mounts and WSL) and
385
+ `--poll-interval <ms>` (implies `--poll`).
386
+ - **Live reload through tunnels and proxies** (johnhenry/sitefile#226): the
387
+ `/__sitefile/reload` stream is sent with `X-Accel-Buffering: no` and
388
+ `Cache-Control: no-cache, no-transform`, and the TypeScript server now sends
389
+ the same `: ping` comment every 15 s as the Rust one, so a buffering or
390
+ idle-cutting proxy passes events through. The client finds the stream
391
+ relative to its own URL and, when an answer is not an event stream (a proxy
392
+ error page), reconnects with backoff (1 s doubling to 30 s).
393
+ - **Live reload gets past caching service workers** (johnhenry/sitefile#229):
394
+ before reloading after a rebuild, the `serve --watch` client unregisters the
395
+ page origin's service workers and empties its Cache Storage, so a site with
396
+ a caching service worker shows the new build. `--keep-service-workers`
397
+ turns it off.
398
+ - **`sitefile hosts`** (johnhenry/sitefile#176): lists the hosts a build would
399
+ contact (remote IMPORTs, FROM image registries, the BASE registry) from the
400
+ plan alone, with what needs each and its status under `--allow-hosts`,
401
+ `--deny-hosts`, `--network strict` and `--allow-secret-host` (`--json` with
402
+ `needs`). Nothing is fetched. Both implementations, with a conformance case.
403
+ - **`serve`: `/about/` no longer 404s when only `about.html` exists**
404
+ (johnhenry/sitefile#188): it redirects (`301`, query kept) to the clean URL
405
+ `/about`, in both servers. `/about.html` still answers 200; which spelling
406
+ is canonical is johnhenry/sitefile#192.
407
+ - **`serve` accepts absolute-form request targets** (johnhenry/sitefile#189):
408
+ `GET http://host/path?q HTTP/1.1` is answered like `GET /path?q` (the
409
+ authority is ignored) instead of `400`, in both servers, as RFC 9112
410
+ requires.
411
+ - **Extensionless well-known files get their type** (johnhenry/sitefile#180):
412
+ `serve` and Web Bundle export send `/.well-known/apple-app-site-association`
413
+ (and `/apple-app-site-association`), `openid-configuration`,
414
+ `oauth-authorization-server` and `nodeinfo` as `application/json`,
415
+ `webfinger` as `application/jrd+json` and `host-meta` as
416
+ `application/xrd+xml`, instead of `application/octet-stream`. Extension
417
+ matching is ASCII case-insensitive in both implementations.
418
+ - **`EXPORT … AS html` and `AS mhtml`** (johnhenry/sitefile#210): a single
419
+ self-contained page. `html` inlines every asset `index.html` references
420
+ (and what its stylesheets reference) as `data:` URIs; `mhtml` writes the
421
+ page and the same assets as one `multipart/related` file under `BASE`
422
+ (default `https://site.invalid/`). A missing asset fails with `E_EXPORT`;
423
+ links, other pages and external URLs stay. Both implementations;
424
+ conformance cases `ok-html`, `ok-mhtml`, `err-html-missing`. The reference
425
+ scanner now records each attribute URL's element (`img src`).
426
+ - **`EXPORT … AS car`** (johnhenry/sitefile#208): an IPFS CARv1 file of the
427
+ tree as a UnixFS DAG (raw leaves, 256 KiB chunks, balanced 174-link file
428
+ nodes, CIDv1), the same DAG and root CID as kubo's `ipfs add -r --hidden
429
+ --cid-version=1` (and the same bytes as its `ipfs dag export`). `-o x.car`
430
+ selects it; `build` and `save` print the root CID. Both implementations;
431
+ conformance cases `example/blog:car-bytes`, `case/ok-car`.
432
+ - **A fuller content-type table** (johnhenry/sitefile#179): `serve` and Web
433
+ Bundle export type 75 extensions (WebVTT, XSLT, feeds, `.cjs`, source maps,
434
+ fonts, more images, audio, video, HLS/DASH, glTF, archives, ...) instead of
435
+ ~24, so files no longer arrive as `application/octet-stream` under
436
+ `nosniff`. One generated table (`tools/gen-mime.mjs`) feeds both
437
+ implementations. A `serve` conformance case kind (`"command": "serve"`)
438
+ compares both servers' answers to raw HTTP requests.
439
+ - **Choose the Node that runs JavaScript plugins** (johnhenry/sitefile#159):
440
+ `--node /abs/path`, `SITEFILE_NODE` or `BuildOptions.node` / `node` names
441
+ the binary (relative paths are a usage error); the default stays the running
442
+ Node (TypeScript) or `node` on PATH (Rust). Before the first plugin starts
443
+ the binary is resolved, its `--version` must be at least 26.0.0 (Node 25
444
+ added network permissions), and `plugins run on node <version> (<path>)` is
445
+ printed. An older binary fails with `E_PLUGIN` at the `PLUGIN` line. `bake`
446
+ passes `--node` through.
447
+ - **`sitefile diff`** (johnhenry/sitefile#212): files added, removed and
448
+ changed (with sizes, digests and modes) between two images, directories or
449
+ archives, plus the `_redirects`/`_headers` rules added and removed;
450
+ `--json` and `--exit-code`. Conformance step case `steps-diff`.
451
+
452
+ - **OS metadata is filtered from archives** (#186): `IMPORT … AS tree` and
453
+ `serve` of a zip, tar or Web Bundle (and `serve ./dir`) drop `__MACOSX/`,
454
+ `._*`, `.DS_Store`, `Icon\r`, `Thumbs.db` and `desktop.ini`, with a warning
455
+ giving the count; `--keep-os-metadata` (`keepOsMetadata`) keeps them. A
456
+ Finder-made zip is now a single top-level folder. Changes the output (and
457
+ image ID) of builds that imported such archives. Both implementations.
458
+ - **File manifests and `sitefile verify`** (johnhenry/sitefile#211):
459
+ `build --manifest <file>` and `save --manifest <file>` write every exported
460
+ file's path, size and SHA-256 with an RFC 6962 Merkle root; `sitefile verify
461
+ <dir|archive|image> --manifest <file> [--json]` reports missing, changed and
462
+ extra files and fails with `E_INTEGRITY`. Same bytes from both
463
+ implementations; conformance step cases `steps-verify*`.
464
+ - **JavaScript plugins get a memory limit** (johnhenry/sitefile#157): the
465
+ plugin process starts with `--max-old-space-size`, set by the new
466
+ `--plugin-memory <MiB>` flag (default 1024, the same as the wasm linear
467
+ memory cap, which the flag now sets too; `bake` passes it through). A plugin
468
+ that passes it fails with `E_PLUGIN: … ran out of memory (more than the N MiB
469
+ limit)` instead of V8's stack trace. Library: `PluginPolicy.maxMemoryMiB` /
470
+ `max_memory_mib`.
471
+ - **Live reload works under a strict CSP and leaves fetch()ed HTML alone**
472
+ (johnhenry/sitefile#181): `serve --watch` injects
473
+ `<script src="/__sitefile/reload.js"></script>` (a same-origin script that
474
+ `script-src 'self'` allows) instead of an inline script, and only into page
475
+ navigations (`Sec-Fetch-Mode: navigate`, else `Sec-Fetch-Dest`, else an
476
+ `Accept` naming `text/html`), so an HTML fragment loaded with `fetch()` is
477
+ served unchanged. A `_headers` CSP that still blocks the script or the event
478
+ stream gets a one-time warning. The client script has one source
479
+ (`src/reload-client.ts`), which the Rust server compiles in. New watch-mode
480
+ conformance cases (`conformance/watch.mjs`) compare both servers' responses
481
+ and events.
482
+ - **FINGERPRINT writes cache headers and SRI** (johnhenry/sitefile#202):
483
+ EXPORT adds `Cache-Control: public, max-age=31536000, immutable` for the
484
+ fingerprinted files (a `/dir/*` rule when a directory holds only them) and
485
+ `no-cache` for the pages to `/_headers`, unless `--no-cache-headers` or a
486
+ HEADER sets `Cache-Control`. `FINGERPRINT … INTEGRITY` adds
487
+ `integrity="sha384-…"` to the `<script src>` and
488
+ `<link rel=stylesheet|modulepreload>` tags that load a renamed file. Both
489
+ implementations, with conformance cases.
490
+ - **Network gating** (johnhenry/sitefile#176): a host refused because it
491
+ matches no `--allow-hosts` rule now says which flag to add (`; add
492
+ --allow-hosts <host>`) and carries `needs` (`kind: 'host'`,
493
+ `NeedsKind::Host`), like a plugin that was not allowed. Opt-in strict mode,
494
+ `--network strict` or `SITEFILE_NETWORK=strict`, allows only listed hosts
495
+ (none when none are listed) and sends an `IMPORT … SECRET` only to a host
496
+ that `--allow-secret-host <id>=<host>` names (`kind: 'secret-host'`). The
497
+ default stays `open`. With `--json`, a failed command also prints
498
+ `{"error": {code, message, span, needs}}` on stdout, and `outdated --json`
499
+ error rows include `needs`. Both implementations, with conformance cases.
500
+ - **JavaScript plugins declare whether they may be cached**
501
+ (johnhenry/sitefile#160): `export const cache = true` says a plugin is
502
+ deterministic; `cache = false` opts out as before; any other value fails
503
+ with `E_PLUGIN`. A JS plugin that exports neither is still cached, with one
504
+ warning per build when results are cached or memoized. The examples' JS
505
+ plugins export `cache = true`. docs/PLUGINS.md now says that module state
506
+ carries over between calls and lists what is trusted as-is (`--cache-from`
507
+ results, the local TRANSFORM cache, the Rust wasm module cache); the README
508
+ security model links it.
509
+ - **`INTEGRITY` on a JavaScript plugin pins its folder** (johnhenry/sitefile#158):
510
+ a JS plugin can read and import every file in its folder, so its
511
+ `INTEGRITY` is now the folder digest (`sha256:` + the digest the TRANSFORM
512
+ cache already uses) instead of the module file's. A changed helper, data
513
+ file or vendored dependency fails with `E_INTEGRITY`, the error gives the
514
+ folder's current digest, and a pinned folder may not contain symlinks.
515
+ **Breaking:** an existing pin on a JS plugin (the module file's digest)
516
+ fails until replaced with the digest from the error. Wasm pins are
517
+ unchanged.
518
+
3
519
  ## 0.0.2 (2026-11-08)
4
520
 
5
521
  - **Plugin console output keeps its order** (johnhenry/sitefile#164): a