@takazudo/zfb-adapter-cloudflare 0.1.0-next.53 → 0.1.0-next.55

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.
@@ -31,8 +31,7 @@ export const WORKER_WRAPPER_SOURCE = `// AUTO-GENERATED by @takazudo/zfb-adapter
31
31
  // islands-…">). If we let the inner Hono router handle them first,
32
32
  // it would dynamic-SSR the page WITHOUT the prod head injection
33
33
  // (which is a build-time post-process, not a runtime concern), and
34
- // islands would never hydrate. See zfb#XXX (filed by Wave 10 of
35
- // the zudo-doc#1355 zfb-pipeline-gaps epic).
34
+ // islands would never hydrate.
36
35
  // - On 404 from ASSETS, fall through to the inner zfb worker. This is
37
36
  // where genuinely dynamic routes (\`prerender = false\`, e.g.
38
37
  // \`pages/api/*.tsx\`) are served.
@@ -68,6 +67,16 @@ function isAssetProbeMethod(method) {
68
67
  export default {
69
68
  async fetch(request, env, ctx) {
70
69
  if (isAssetProbeMethod(request.method) && canDelegateToAssets(env)) {
70
+ // Trade-off: every GET/HEAD request that matches a prerendered route pays
71
+ // the cost of one env.ASSETS.fetch() round-trip before the inner worker
72
+ // sees it. The upside is that CF Pages' asset server handles trailing-
73
+ // slash canonicalisation (e.g. /docs/foo → 308 → /docs/foo/) and serves
74
+ // the build-time head-injected HTML with the hashed <link>/<script> tags.
75
+ // If we skipped this probe, prerendered routes would be dynamic-SSR'd by
76
+ // the inner Hono router without the prod head injection, and islands would
77
+ // never hydrate. For purely dynamic apps (prerender=false everywhere) the
78
+ // extra round-trip is pure overhead; splitting the wrapper into two
79
+ // variants is the accepted future escape hatch for that case.
71
80
  const assetResponse = await env.ASSETS.fetch(request);
72
81
  if (assetResponse.status !== 404) {
73
82
  return assetResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takazudo/zfb-adapter-cloudflare",
3
- "version": "0.1.0-next.53",
3
+ "version": "0.1.0-next.55",
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 Pages adapter.",
@@ -31,8 +31,7 @@ export const WORKER_WRAPPER_SOURCE = `// AUTO-GENERATED by @takazudo/zfb-adapter
31
31
  // islands-…">). If we let the inner Hono router handle them first,
32
32
  // it would dynamic-SSR the page WITHOUT the prod head injection
33
33
  // (which is a build-time post-process, not a runtime concern), and
34
- // islands would never hydrate. See zfb#XXX (filed by Wave 10 of
35
- // the zudo-doc#1355 zfb-pipeline-gaps epic).
34
+ // islands would never hydrate.
36
35
  // - On 404 from ASSETS, fall through to the inner zfb worker. This is
37
36
  // where genuinely dynamic routes (\`prerender = false\`, e.g.
38
37
  // \`pages/api/*.tsx\`) are served.
@@ -68,6 +67,16 @@ function isAssetProbeMethod(method) {
68
67
  export default {
69
68
  async fetch(request, env, ctx) {
70
69
  if (isAssetProbeMethod(request.method) && canDelegateToAssets(env)) {
70
+ // Trade-off: every GET/HEAD request that matches a prerendered route pays
71
+ // the cost of one env.ASSETS.fetch() round-trip before the inner worker
72
+ // sees it. The upside is that CF Pages' asset server handles trailing-
73
+ // slash canonicalisation (e.g. /docs/foo → 308 → /docs/foo/) and serves
74
+ // the build-time head-injected HTML with the hashed <link>/<script> tags.
75
+ // If we skipped this probe, prerendered routes would be dynamic-SSR'd by
76
+ // the inner Hono router without the prod head injection, and islands would
77
+ // never hydrate. For purely dynamic apps (prerender=false everywhere) the
78
+ // extra round-trip is pure overhead; splitting the wrapper into two
79
+ // variants is the accepted future escape hatch for that case.
71
80
  const assetResponse = await env.ASSETS.fetch(request);
72
81
  if (assetResponse.status !== 404) {
73
82
  return assetResponse;