@johnhenry/sitefile 0.0.2 → 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.
- package/CHANGELOG.md +467 -0
- package/README.md +55 -6
- package/lib/src/archive-writers.d.ts +12 -2
- package/lib/src/archive-writers.js +53 -10
- package/lib/src/canonical.d.ts +16 -0
- package/lib/src/canonical.js +46 -0
- package/lib/src/car.d.ts +34 -0
- package/lib/src/car.js +203 -0
- package/lib/src/checklinks.js +8 -2
- package/lib/src/cli/bake.js +4 -3
- package/lib/src/cli/build-image.d.ts +1 -0
- package/lib/src/cli/build-image.js +1 -0
- package/lib/src/cli/common.js +4 -1
- package/lib/src/cli/hosts.d.ts +5 -0
- package/lib/src/cli/hosts.js +78 -0
- package/lib/src/cli/images.js +23 -5
- package/lib/src/cli/import-config.d.ts +2 -0
- package/lib/src/cli/import-config.js +56 -0
- package/lib/src/cli/index.d.ts +3 -1
- package/lib/src/cli/index.js +31 -2
- package/lib/src/cli/integrity.d.ts +2 -0
- package/lib/src/cli/integrity.js +77 -0
- package/lib/src/cli/network.d.ts +7 -0
- package/lib/src/cli/network.js +14 -3
- package/lib/src/cli/serve-keys.d.ts +39 -0
- package/lib/src/cli/serve-keys.js +106 -0
- package/lib/src/cli/serve-worker.js +46 -8
- package/lib/src/cli/servers.d.ts +124 -1
- package/lib/src/cli/servers.js +705 -62
- package/lib/src/cli/up.d.ts +2 -0
- package/lib/src/cli/up.js +193 -0
- package/lib/src/cli/watch.d.ts +14 -1
- package/lib/src/cli/watch.js +20 -3
- package/lib/src/cli.js +138 -18
- package/lib/src/csp.d.ts +17 -0
- package/lib/src/csp.js +52 -0
- package/lib/src/dictionary.d.ts +16 -0
- package/lib/src/dictionary.js +89 -0
- package/lib/src/epub.d.ts +5 -0
- package/lib/src/epub.js +113 -0
- package/lib/src/errors.d.ts +22 -9
- package/lib/src/errors.js +20 -1
- package/lib/src/executor.d.ts +31 -1
- package/lib/src/executor.js +192 -22
- package/lib/src/explain.js +33 -3
- package/lib/src/export-for.d.ts +42 -0
- package/lib/src/export-for.js +466 -0
- package/lib/src/export-formats.d.ts +2 -2
- package/lib/src/export-formats.js +52 -2
- package/lib/src/fingerprint.d.ts +3 -1
- package/lib/src/fingerprint.js +32 -5
- package/lib/src/host-config.d.ts +34 -0
- package/lib/src/host-config.js +645 -0
- package/lib/src/hosts.d.ts +47 -0
- package/lib/src/hosts.js +106 -0
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/integrity.d.ts +115 -0
- package/lib/src/integrity.js +273 -0
- package/lib/src/language/ast.d.ts +116 -3
- package/lib/src/language/ast.js +7 -1
- package/lib/src/language/parser.js +176 -7
- package/lib/src/language/validate.js +21 -0
- package/lib/src/links.d.ts +33 -0
- package/lib/src/links.js +271 -3
- package/lib/src/lint.d.ts +1 -1
- package/lib/src/lint.js +26 -1
- package/lib/src/mime-data.d.ts +2 -0
- package/lib/src/mime-data.js +92 -0
- package/lib/src/oci.d.ts +20 -2
- package/lib/src/oci.js +70 -28
- package/lib/src/outdated.d.ts +3 -0
- package/lib/src/outdated.js +4 -4
- package/lib/src/planner.d.ts +69 -2
- package/lib/src/planner.js +150 -8
- package/lib/src/plugins/cache.d.ts +11 -0
- package/lib/src/plugins/cache.js +29 -0
- package/lib/src/plugins/host.d.ts +51 -2
- package/lib/src/plugins/host.js +141 -16
- package/lib/src/plugins/wasm.js +1 -3
- package/lib/src/portable.d.ts +8 -0
- package/lib/src/portable.js +47 -0
- package/lib/src/precache.d.ts +33 -0
- package/lib/src/precache.js +75 -0
- package/lib/src/precompress.d.ts +19 -0
- package/lib/src/precompress.js +35 -0
- package/lib/src/qr.d.ts +18 -0
- package/lib/src/qr.js +372 -0
- package/lib/src/registry-ops.js +4 -2
- package/lib/src/reload-client.d.ts +2 -0
- package/lib/src/reload-client.js +304 -0
- package/lib/src/resources/archive.d.ts +36 -0
- package/lib/src/resources/archive.js +338 -67
- package/lib/src/resources/convert.js +3 -1
- package/lib/src/resources/https.d.ts +9 -1
- package/lib/src/resources/https.js +36 -0
- package/lib/src/resources/network.d.ts +25 -3
- package/lib/src/resources/network.js +77 -6
- package/lib/src/secrets.d.ts +12 -3
- package/lib/src/secrets.js +18 -5
- package/lib/src/serve-auth.d.ts +32 -0
- package/lib/src/serve-auth.js +112 -0
- package/lib/src/serve-rules.d.ts +83 -7
- package/lib/src/serve-rules.js +264 -53
- package/lib/src/server.d.ts +437 -10
- package/lib/src/server.js +1236 -52
- package/lib/src/servers-file.d.ts +36 -0
- package/lib/src/servers-file.js +101 -0
- package/lib/src/servers.d.ts +109 -7
- package/lib/src/servers.js +151 -29
- package/lib/src/single-file.d.ts +12 -0
- package/lib/src/single-file.js +147 -0
- package/lib/src/site.d.ts +54 -0
- package/lib/src/site.js +204 -6
- package/lib/src/store.js +9 -5
- package/lib/src/swbn.d.ts +10 -0
- package/lib/src/swbn.js +86 -0
- package/lib/src/toml.d.ts +17 -0
- package/lib/src/toml.js +323 -0
- package/lib/src/wacz.d.ts +6 -0
- package/lib/src/wacz.js +96 -0
- package/lib/src/warc.d.ts +28 -0
- package/lib/src/warc.js +252 -0
- package/lib/src/watch.d.ts +12 -1
- package/lib/src/watch.js +67 -1
- package/lib/src/wbn.d.ts +9 -1
- package/lib/src/wbn.js +23 -33
- package/lib/src/zstd.d.ts +4 -0
- package/lib/src/zstd.js +328 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,472 @@
|
|
|
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
|
+
|
|
3
470
|
## 0.0.2 (2026-11-08)
|
|
4
471
|
|
|
5
472
|
- **Plugin console output keeps its order** (johnhenry/sitefile#164): a
|
package/README.md
CHANGED
|
@@ -82,12 +82,18 @@ no runtime dependencies.
|
|
|
82
82
|
| `PLUGIN name FROM ./plugins/x.mjs\|x.wasm [INTEGRITY sha256:…]` | yes; a custom renderer: a sandboxed JS module (runs only with `--allow-plugin name`) or an import-free WebAssembly module (no flag needed; see [docs/PLUGINS.md](docs/PLUGINS.md), `examples/wasm/`) |
|
|
83
83
|
| `TRANSFORM [--include/--exclude=<pattern>] [<source>] WITH name TO <dest> [OPTIONS k=v …] [FOR item IN list]` | yes; e.g. text → animated SVG (`examples/motion/`), responsive images (`examples/image/`); a directory source runs once per file (`TO /img/thumbs/*.png`) |
|
|
84
84
|
| `TOOL name` + `TRANSFORM … WITH name TO <dest> [OPTIONS …] [FOR …] ARGS …` | yes; run an external program (e.g. `ffmpeg`) you allow with `--allow-exec name`: argv only, no shell, temp files, scrubbed environment (see [docs/PLUGINS.md](docs/PLUGINS.md)) |
|
|
85
|
-
| `SITEMAP BASE <url> [TO <dest>]` | yes; a sitemaps.org `/sitemap.xml` of the `.html` pages so far |
|
|
85
|
+
| `SITEMAP BASE <url> [TO <dest>]` | yes; a sitemaps.org `/sitemap.xml` of the `.html` pages so far (a sitemap index and parts above 50,000 URLs or 50 MiB) |
|
|
86
|
+
| `CANONICAL BASE <url> [PRETTY]` | yes; a `<link rel="canonical">` in every page that has none |
|
|
86
87
|
| `FEED <import> BASE <url> LINK <path> [TO <dest>] [TITLE <text>]` | yes; an Atom `/feed.xml` from Markdown posts (`title` and `date` required) |
|
|
88
|
+
| `ROBOTS [ALLOW\|DISALLOW <path>]… [SITEMAP] [TO <dest>]`, `SECURITY_TXT CONTACT <uri>… EXPIRES <date> [ENCRYPTION <uri>]… [POLICY <uri>]…` | yes; `/robots.txt` (with the SITEMAP URLs) and an RFC 9116 `/.well-known/security.txt` (Expires required; warns when near) |
|
|
87
89
|
| `REDIRECT <from> <to> [STATUS 301\|302\|303\|307\|308]`, `HEADER <pattern> <Name>: <value>` | yes; `/_redirects` and `/_headers` for Netlify / Cloudflare Pages (and `sitefile serve`); a `wbn` export also bakes HEADER values into each response and exact-path REDIRECTs into 3xx responses (splats stay in `/_redirects`) |
|
|
90
|
+
| `CSP [POLICY <policy>] [META]` | yes; a strict Content-Security-Policy per page in `/_headers` (or a `<meta>`), with the SHA-256 of each inline script and style instead of `'unsafe-inline'` |
|
|
91
|
+
| `MIME <.ext> <type/subtype>` | yes; a custom Content-Type (`.usdz`, `.ts` as MPEG-TS) as a `/_headers` rule, which also types the files in a Web Bundle export |
|
|
88
92
|
| `CHECKLINKS [--warn] [--external]` | yes; fails (or warns) on links to files that do not exist, with file and line; `--external` requests http(s) links under the network policy |
|
|
89
|
-
| `FINGERPRINT [--overwrite] <pattern>… [MANIFEST <dest>]` | yes; renames assets to `name.<hash>.ext` and rewrites the HTML and CSS that reference them, plus a JSON manifest |
|
|
90
|
-
| `
|
|
93
|
+
| `FINGERPRINT [--overwrite] [--no-cache-headers] <pattern>… [MANIFEST <dest>] [INTEGRITY]` | yes; renames assets to `name.<hash>.ext` and rewrites the HTML and CSS that reference them, plus a JSON manifest, `Cache-Control` lines in `/_headers` and (INTEGRITY) SRI attributes |
|
|
94
|
+
| `PRECOMPRESS [--overwrite] [gzip] <pattern>… [MIN <bytes>]` | yes; deterministic `.gz` sidecars of text files for hosts that serve them in place of the file (nginx `gzip_static`, Caddy `precompressed`); `br` and `zstd` are not supported yet |
|
|
95
|
+
| `PRECACHE [--overwrite] <pattern>… [TO <dest>] [INTO <service-worker>]` | yes; a Workbox-style `[{url, revision}]` precache manifest (fingerprinted files get `revision: null`), or injected at `self.__WB_MANIFEST` |
|
|
96
|
+
| `EXPORT <path> [AS directory\|zip\|tar\|tgz\|wbn\|oci\|car\|html\|mhtml\|warc\|swbn\|wacz\|epub] [BASE <https-url>] [AT <root>] [COMPRESSION gzip\|none] [KEY <secret-id>] [FOR <host>]` | yes; `FOR netlify\|cloudflare\|vercel\|firebase\|azure\|github-pages\|s3` writes REDIRECT and HEADER as that host reads them (a rule it cannot express is an error, a warning with `--lossy`); archives are deterministic, `wbn` is an unsigned Web Bundle (needs `BASE` or `--base-url`; `COMPRESSION gzip` gzips it, default `none`), `oci` is a single-layer OCI image of the files (under `AT`, default `/srv/www`; `COMPRESSION` sets its layer, default `gzip`), `car` is an IPFS CARv1 file whose root CID matches kubo's `ipfs add -r --cid-version=1`, `html` is `index.html` with its assets inlined as `data:` URIs, `mhtml` the same page and assets as one MHTML file, `warc` a WARC/1.1 web archive of every file at `BASE` (also imported and served), `swbn` a Signed Web Bundle for an Isolated Web App, signed with the Ed25519 key in `--secret` `KEY`, `wacz` that WARC as a WACZ package for ReplayWeb.page, `epub` an EPUB 3 book of the XHTML pages |
|
|
91
97
|
|
|
92
98
|
Templates can also live in the Sitefile itself (see `examples/inline/`):
|
|
93
99
|
|
|
@@ -174,6 +180,8 @@ sitefile graph [context] [--json | --dot] # dependency graph of imports, st
|
|
|
174
180
|
sitefile why <path> [context] [--json] # which instructions wrote an exported file, and what overwrote it
|
|
175
181
|
sitefile vendor [context] [--vendor-dir vendor/sitefile] # download remote inputs for offline builds
|
|
176
182
|
sitefile outdated [context] [--json] # compare remote imports and BASE images with their pins (read-only)
|
|
183
|
+
sitefile import-config netlify.toml # a host's config (Netlify, Vercel, Firebase, Azure, wrangler, .htaccess) as _redirects/_headers
|
|
184
|
+
sitefile hosts [context] [--json] # the hosts a build would contact and whether they are allowed (no fetch)
|
|
177
185
|
sitefile bake [targets...] [-f sitefile.bake.yaml] [--print [--json]] [-j n] # build several variants
|
|
178
186
|
|
|
179
187
|
# images and servers (see below and docs/CLI.md)
|
|
@@ -184,6 +192,7 @@ sitefile cache du # cache sizes; SITEFILE_
|
|
|
184
192
|
sitefile serve [-d] [--name n] [-p [host:]port] [--spa] <image|./dir|site.zip>
|
|
185
193
|
sitefile serve --watch [-p [host:]port] [--spa] [context] # build in memory, serve, live reload
|
|
186
194
|
sitefile servers [-a] | server stop|rm [-f]|restart|logs [-f] <name>
|
|
195
|
+
sitefile up | down | ps [-f sitefile.servers.yaml] # several servers from one file, like docker compose
|
|
187
196
|
```
|
|
188
197
|
|
|
189
198
|
`--target <stage>` (like `docker build --target`) stops after a named stage and exports that stage's whole
|
|
@@ -395,6 +404,14 @@ tools are code, and run only when you name them on the command line.
|
|
|
395
404
|
checks the target itself before handing it to the proxy. `--allow-hosts` and
|
|
396
405
|
`--deny-hosts` narrow it further, on every hop
|
|
397
406
|
([docs/CLI.md](docs/CLI.md#network-proxy-host-rules-and-timeouts)).
|
|
407
|
+
- **Strict network mode is opt-in.** With `--network strict` (or
|
|
408
|
+
`SITEFILE_NETWORK=strict`) a build contacts only hosts you list with
|
|
409
|
+
`--allow-hosts`, none when you list none. A refused host fails with
|
|
410
|
+
`E_HOST_BLOCKED` naming the flag to add, also as `needs` in the library
|
|
411
|
+
error and in `--json` output, so a tool can ask before allowing it.
|
|
412
|
+
`sitefile hosts` lists the hosts a build needs before any is contacted. A
|
|
413
|
+
vendored build with pinned, stored images contacts nothing
|
|
414
|
+
([docs/CLI.md](docs/CLI.md#strict-network-mode)).
|
|
398
415
|
- **Pins are enforced.** Unpinned URLs are recorded in `Sitefile.lock` and must
|
|
399
416
|
match on later builds; `--strict-pins` refuses any remote import or BASE image
|
|
400
417
|
that is not pinned (`INTEGRITY`, `@sha256:` or a lockfile entry).
|
|
@@ -405,15 +422,35 @@ tools are code, and run only when you name them on the command line.
|
|
|
405
422
|
- **Secrets go only where they are sent.** `--secret id=token,env=API_TOKEN` with
|
|
406
423
|
`IMPORT … SECRET token AS BEARER` (or `AS HEADER X-Api-Key`) sends the secret
|
|
407
424
|
only to that import's own origin, and never into the output, caches,
|
|
408
|
-
`Sitefile.lock`, vendor files, provenance, traces or messages.
|
|
425
|
+
`Sitefile.lock`, vendor files, provenance, traces or messages. In strict mode a
|
|
426
|
+
secret is sent only to a host that `--allow-secret-host <id>=<host>` names.
|
|
409
427
|
- **Nothing executes unless you allow it by name.** A JavaScript `PLUGIN` runs
|
|
410
428
|
only with `--allow-plugin <name>`, in its own Node process under Node's
|
|
411
429
|
permission model (read access to its own folder only, no writes, network,
|
|
412
|
-
processes or environment)
|
|
430
|
+
processes or environment) with a heap limit (`--plugin-memory`, default
|
|
431
|
+
1 GiB), on a Node you can name with `--node` (checked to be at least Node 26
|
|
432
|
+
and printed); a `TOOL` runs only with `--allow-exec <name>`, argv
|
|
413
433
|
only, no shell, scrubbed environment. The Sitefile cannot allow itself. A
|
|
414
|
-
|
|
434
|
+
JavaScript plugin's `INTEGRITY` pins its whole folder (everything it can
|
|
435
|
+
read), a wasm plugin's its module. A WebAssembly plugin must import nothing (checked before the build starts) and
|
|
415
436
|
runs with a time and memory limit, so it needs no flag
|
|
416
437
|
([docs/PLUGINS.md](docs/PLUGINS.md#trust-model---allow-plugin)).
|
|
438
|
+
- **`serve` answers only local names.** A request whose `Host` is not
|
|
439
|
+
`localhost`, `*.localhost` or an IP address is refused (`403`), so a web page
|
|
440
|
+
that DNS-rebinds its name to `127.0.0.1` cannot read a local server;
|
|
441
|
+
`--allowed-host` adds names ([docs/CLI.md](docs/CLI.md#site-servers)).
|
|
442
|
+
- **Caches are trusted.** A TRANSFORM cache hit (local, or from
|
|
443
|
+
`--cache-from <registry>`) is used as if the plugin had returned it, and the
|
|
444
|
+
Rust build loads compiled wasm modules from `$SITEFILE_HOME/cache/wasm` as
|
|
445
|
+
native code (kept `0700`/`0600`). Only pull caches from registries you
|
|
446
|
+
trust; `--no-cache` skips them
|
|
447
|
+
([docs/PLUGINS.md](docs/PLUGINS.md#what-sitefile-trusts-as-is)). JavaScript
|
|
448
|
+
plugins say whether they are deterministic with `export const cache =
|
|
449
|
+
true|false`; one that says neither is cached with a warning.
|
|
450
|
+
- **Sharing a server with `--auth`** keeps people who lack the password out
|
|
451
|
+
(basic authentication on every request, passwords stored only as PBKDF2
|
|
452
|
+
verifiers). It does not hide the traffic: over plain HTTP on a LAN the
|
|
453
|
+
password and the pages travel in the clear, so use it on networks you trust.
|
|
417
454
|
- **No silent overwrites.** Writing different content to an existing path fails
|
|
418
455
|
unless `--overwrite` is given. Two output paths that differ only in case
|
|
419
456
|
(`/A.html`, `/a.html`) always fail (`E_PATH_COLLISION`), and every path is
|
|
@@ -431,6 +468,11 @@ tools are code, and run only when you name them on the command line.
|
|
|
431
468
|
([docs/LANGUAGE.md](docs/LANGUAGE.md#vendoring-sitefile-vendor)).
|
|
432
469
|
- **`sitefile serve` listens on `127.0.0.1`**, GET/HEAD only, no directory
|
|
433
470
|
listings, unless `-p` names another address.
|
|
471
|
+
- **`serve` proxies only where you allow it.** A `_redirects` proxy rule (200
|
|
472
|
+
to a URL) in a site you serve reaches only hosts in `--allow-hosts`; others
|
|
473
|
+
get a `502` naming the flag. `--proxy /api=url` is allowed by being written.
|
|
474
|
+
Both follow the build fetch policy above and never forward cookies or
|
|
475
|
+
`Authorization` ([docs/CLI.md](docs/CLI.md#site-servers)).
|
|
434
476
|
|
|
435
477
|
**What is still yours:**
|
|
436
478
|
|
|
@@ -448,6 +490,13 @@ tools are code, and run only when you name them on the command line.
|
|
|
448
490
|
reproducible.
|
|
449
491
|
- **Web Bundles are unsigned.** `EXPORT … AS wbn` writes an unsigned b2 bundle;
|
|
450
492
|
signing (for example for an Isolated Web App) happens outside sitefile.
|
|
493
|
+
- **Which hosts an open build contacts.** The default network mode is `open`:
|
|
494
|
+
a Sitefile you did not write may make the build contact any public HTTPS
|
|
495
|
+
host its author chose (telling it your IP address and when you build),
|
|
496
|
+
clone Git repositories and pull registry images, and send a `--secret` you
|
|
497
|
+
supplied to the host its `IMPORT … SECRET` names. Use `--network strict`
|
|
498
|
+
with `--allow-hosts` (and `--allow-secret-host`) for builds you did not
|
|
499
|
+
write.
|
|
451
500
|
- **Widening flags are yours to justify.** `--allow-http`,
|
|
452
501
|
`--allow-private-network`, `--allow-hardlinks`, `--force` and `serve -p
|
|
453
502
|
0.0.0.0:…` each turn off one of the guarantees above for that build.
|
|
@@ -21,8 +21,18 @@ export interface WriterOptions {
|
|
|
21
21
|
/** Read `SOURCE_DATE_EPOCH`; undefined if unset, E_USAGE if malformed. */
|
|
22
22
|
export declare function sourceDateEpoch(env?: NodeJS.ProcessEnv): number | undefined;
|
|
23
23
|
export { crc32 };
|
|
24
|
-
/**
|
|
25
|
-
export declare
|
|
24
|
+
/** File extensions (ASCII, lowercase) whose content is already compressed; zip stores them without deflating. */
|
|
25
|
+
export declare const COMPRESSED_MEDIA: string[];
|
|
26
|
+
/** Whether a zip entry name ends in an already-compressed media extension ({@link COMPRESSED_MEDIA}), ASCII case-insensitively. */
|
|
27
|
+
export declare function isCompressedMedia(name: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Zip (no zip64). Deflate when it shrinks the data, otherwise stored.
|
|
30
|
+
*
|
|
31
|
+
* `first` (tree paths, e.g. `['/mimetype']` for EPUB): these entries come first, in that order, stored
|
|
32
|
+
* and without an extra field (the EPUB container requires its `mimetype` entry that way); the rest
|
|
33
|
+
* follow in path order as usual.
|
|
34
|
+
*/
|
|
35
|
+
export declare function writeZip(tree: Tree, options?: WriterOptions, first?: readonly string[]): Uint8Array;
|
|
26
36
|
/** POSIX ustar; long names use the prefix field, then a pax `path` extended header. */
|
|
27
37
|
export declare function writeTar(tree: Tree, options?: WriterOptions): Uint8Array;
|
|
28
38
|
/** gzip of the tar, header mtime 0 and no filename, so the stream is reproducible. */
|