@johnhenry/sitefile 0.0.1 → 0.0.3

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