@takazudo/zfb-adapter-cloudflare 0.1.0-next.96 → 0.1.0-next.97

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/README.md CHANGED
@@ -70,7 +70,9 @@ lifecycle (`wrangler d1 create`, migrations, preview-vs-prod).
70
70
  `dist/`.
71
71
  2. Hand the SSR bundle to this adapter, which writes `dist/_worker.js`
72
72
  (the wrapper), `dist/_zfb_inner.mjs` (the bundle), copied
73
- `x-<hash>.wasm` modules, and `dist/.assetsignore` (see below) — ready
73
+ `<name>-<hash>.wasm` modules (e.g. `index_bg-a1b2c3d4.wasm` — this is
74
+ esbuild's own `--asset-names=[name]-[hash]` convention, not a
75
+ zfb-specific scheme), and `dist/.assetsignore` (see below) — ready
74
76
  for Workers Static Assets.
75
77
 
76
78
  ## `wrangler.toml`
@@ -48,8 +48,9 @@ export const WORKER_WRAPPER_SOURCE = `// AUTO-GENERATED by @takazudo/zfb-adapter
48
48
  // \`pages/api/*.tsx\`) are served. EXCEPTION: when the asset 404
49
49
  // carries a *styled* 404-page body (\`not_found_handling = "404-page"\`
50
50
  // on Workers Static Assets, or the \`404.html\` convention on Pages —
51
- // detected as an HTML document with a real Content-Length) AND the
52
- // inner ALSO 404s with only the framework default body (Hono's
51
+ // detected as an HTML document by content-type; the assets binding
52
+ // streams every response and never sends a \`content-length\` header)
53
+ // AND the inner ALSO 404s with only the framework default body (Hono's
53
54
  // default not-found, \`text/plain\` "404 Not Found", or a bare 404
54
55
  // with no content-type), the earlier styled asset 404 is preferred
55
56
  // over the inner's plain 404 — otherwise the styled \`404.html\` would
@@ -94,15 +95,17 @@ function assetHasStyled404Body(response) {
94
95
  // True iff an ASSETS 404 carries the site's *styled* 404 page.
95
96
  // Platform fact: \`not_found_handling = "404-page"\` (Workers Static
96
97
  // Assets) and the Pages \`404.html\` convention both serve that page as
97
- // an HTML document — auto-detected \`content-type: text/html\` and a real
98
- // \`Content-Length\` (it is a static file). \`not_found_handling = "none"\`
99
- // and a bare Pages advanced-mode 404 send Cloudflare's default 404 with
100
- // an empty / non-HTML body, so this returns false and the inner wins.
98
+ // an HTML document — auto-detected \`content-type: text/html\`. The
99
+ // Workers Static Assets binding streams every response (chunked
100
+ // locally, HTTP/2 framed in production) and never sends a
101
+ // \`content-length\` header, so content-type alone is the discriminator.
102
+ // \`not_found_handling = "none"\` sends Cloudflare's default 404 with
103
+ // NO headers at all (empty/non-HTML content-type), so this still
104
+ // returns false there and the inner wins.
101
105
  // Header-only (never reads the body) so it holds for HEAD too and leaves
102
106
  // the one-shot asset stream intact for a verbatim return.
103
107
  const contentType = (response.headers.get("content-type") || "").toLowerCase();
104
- const contentLength = Number(response.headers.get("content-length") || "0");
105
- return contentType.includes("text/html") && contentLength > 0;
108
+ return contentType.includes("text/html");
106
109
  }
107
110
 
108
111
  function innerIsFrameworkDefault404(response) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takazudo/zfb-adapter-cloudflare",
3
- "version": "0.1.0-next.96",
3
+ "version": "0.1.0-next.97",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Rust-built static-site engine for Astro and Next.js users — millisecond rebuilds, single binary. Cloudflare adapter: Workers Static Assets (Pages-compatible).",
@@ -48,8 +48,9 @@ export const WORKER_WRAPPER_SOURCE = `// AUTO-GENERATED by @takazudo/zfb-adapter
48
48
  // \`pages/api/*.tsx\`) are served. EXCEPTION: when the asset 404
49
49
  // carries a *styled* 404-page body (\`not_found_handling = "404-page"\`
50
50
  // on Workers Static Assets, or the \`404.html\` convention on Pages —
51
- // detected as an HTML document with a real Content-Length) AND the
52
- // inner ALSO 404s with only the framework default body (Hono's
51
+ // detected as an HTML document by content-type; the assets binding
52
+ // streams every response and never sends a \`content-length\` header)
53
+ // AND the inner ALSO 404s with only the framework default body (Hono's
53
54
  // default not-found, \`text/plain\` "404 Not Found", or a bare 404
54
55
  // with no content-type), the earlier styled asset 404 is preferred
55
56
  // over the inner's plain 404 — otherwise the styled \`404.html\` would
@@ -94,15 +95,17 @@ function assetHasStyled404Body(response) {
94
95
  // True iff an ASSETS 404 carries the site's *styled* 404 page.
95
96
  // Platform fact: \`not_found_handling = "404-page"\` (Workers Static
96
97
  // Assets) and the Pages \`404.html\` convention both serve that page as
97
- // an HTML document — auto-detected \`content-type: text/html\` and a real
98
- // \`Content-Length\` (it is a static file). \`not_found_handling = "none"\`
99
- // and a bare Pages advanced-mode 404 send Cloudflare's default 404 with
100
- // an empty / non-HTML body, so this returns false and the inner wins.
98
+ // an HTML document — auto-detected \`content-type: text/html\`. The
99
+ // Workers Static Assets binding streams every response (chunked
100
+ // locally, HTTP/2 framed in production) and never sends a
101
+ // \`content-length\` header, so content-type alone is the discriminator.
102
+ // \`not_found_handling = "none"\` sends Cloudflare's default 404 with
103
+ // NO headers at all (empty/non-HTML content-type), so this still
104
+ // returns false there and the inner wins.
101
105
  // Header-only (never reads the body) so it holds for HEAD too and leaves
102
106
  // the one-shot asset stream intact for a verbatim return.
103
107
  const contentType = (response.headers.get("content-type") || "").toLowerCase();
104
- const contentLength = Number(response.headers.get("content-length") || "0");
105
- return contentType.includes("text/html") && contentLength > 0;
108
+ return contentType.includes("text/html");
106
109
  }
107
110
 
108
111
  function innerIsFrameworkDefault404(response) {