@void/platform 0.20.2 → 0.21.0

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.
@@ -1 +1 @@
1
- This folder contains the built output assets for the worker "void-runtime-build-dispatch" generated at 2026-09-22T17:31:16.764Z.
1
+ This folder contains the built output assets for the worker "void-runtime-build-dispatch" generated at 2026-09-29T09:51:03.866Z.
@@ -1036,6 +1036,31 @@ function shouldBypassIsr(request) {
1036
1036
  return request.headers.has("Cookie") || request.headers.has("Authorization") || acceptsEventStream(request);
1037
1037
  }
1038
1038
  __name(shouldBypassIsr, "shouldBypassIsr");
1039
+ function isFrameworkDocumentRequest(request) {
1040
+ if (request.method !== "GET" || request.headers.has("X-VoidPages")) {
1041
+ return false;
1042
+ }
1043
+ if (new URL(request.url).pathname.startsWith("/__void/")) {
1044
+ return false;
1045
+ }
1046
+ const acceptsHtml = request.headers.get("accept")?.split(",").some((value) => value.trim().toLowerCase().split(";", 1)[0] === "text/html");
1047
+ if (!acceptsHtml) {
1048
+ return false;
1049
+ }
1050
+ const mode = request.headers.get("sec-fetch-mode")?.toLowerCase();
1051
+ if (mode && mode !== "navigate") {
1052
+ return false;
1053
+ }
1054
+ const destination = request.headers.get("sec-fetch-dest")?.toLowerCase();
1055
+ if (destination && destination !== "document") {
1056
+ return false;
1057
+ }
1058
+ if (request.headers.has("rsc") || request.headers.has("x-nextjs-data")) {
1059
+ return false;
1060
+ }
1061
+ return true;
1062
+ }
1063
+ __name(isFrameworkDocumentRequest, "isFrameworkDocumentRequest");
1039
1064
  function hasSharedCacheOptOut(response) {
1040
1065
  if (response.headers.has("Set-Cookie")) {
1041
1066
  return true;
@@ -1106,11 +1131,15 @@ __name(extractPageDataFromHtml, "extractPageDataFromHtml");
1106
1131
  var MAX_ISR_VARIANTS_PER_PATH = 200;
1107
1132
  async function readIsrCache(env, projectId, deploymentId, host, pathname, originalUrl) {
1108
1133
  const key = isrCacheKey(projectId, deploymentId, host, pathname, originalUrl);
1109
- const { value, metadata } = await env.ISR_CACHE.getWithMetadata(
1110
- key,
1111
- "arrayBuffer"
1112
- );
1113
- return decodeIsrCacheEntry(value, metadata);
1134
+ try {
1135
+ const { value, metadata } = await env.ISR_CACHE.getWithMetadata(
1136
+ key,
1137
+ "arrayBuffer"
1138
+ );
1139
+ return decodeIsrCacheEntry(value, metadata);
1140
+ } catch {
1141
+ return null;
1142
+ }
1114
1143
  }
1115
1144
  __name(readIsrCache, "readIsrCache");
1116
1145
  async function deleteIsrCache(env, projectId, deploymentId, host, pathname, originalUrl) {
@@ -2257,7 +2286,7 @@ var index_default = {
2257
2286
  }
2258
2287
  }
2259
2288
  }
2260
- const isSsrPath = routing.ssr === true && isIsrEligiblePath(pathname, routing.pages, routing.revalidate, routing.pathRevalidate);
2289
+ const isSsrPath = routing.ssr === true && (routing.type !== "framework" || isFrameworkDocumentRequest(request)) && isIsrEligiblePath(pathname, routing.pages, routing.revalidate, routing.pathRevalidate);
2261
2290
  if (isSsrPath && (routing.revalidate || routing.pages?.length)) {
2262
2291
  const isrTtl = resolvePageTtl(
2263
2292
  routing.pages,
@@ -2467,7 +2496,7 @@ var index_default = {
2467
2496
  return meter(workerResponse);
2468
2497
  }
2469
2498
  const ttl = resolveRevalidateTtl(workerResponse, isrTtl);
2470
- if (ttl > 0 && workerResponse.status === 200 && !isApiPath(effectiveMissPathname) && !hasSharedCacheOptOut(workerResponse) && (!missFallbackApplied || isFallbackTargetCacheable(
2499
+ if (ttl > 0 && workerResponse.status === 200 && (routing.type !== "framework" || isHtmlResponse(workerResponse)) && !isApiPath(effectiveMissPathname) && !hasSharedCacheOptOut(workerResponse) && (!missFallbackApplied || isFallbackTargetCacheable(
2471
2500
  routing.pages,
2472
2501
  effectiveMissPathname,
2473
2502
  workerResponse,
@@ -2514,7 +2543,7 @@ var index_default = {
2514
2543
  workerResponseFailureKind ? { failureKind: workerResponseFailureKind } : void 0
2515
2544
  );
2516
2545
  }
2517
- if (workerResponse.status === 200 && !missFallbackApplied && (ttl === 0 || hasSharedCacheOptOut(workerResponse))) {
2546
+ if (workerResponse.status === 200 && !missFallbackApplied && (ttl === 0 || hasSharedCacheOptOut(workerResponse) || routing.type === "framework" && !isHtmlResponse(workerResponse))) {
2518
2547
  ctx.waitUntil(purgePoisonedIsrEntry());
2519
2548
  }
2520
2549
  return meter(
@@ -2760,7 +2789,7 @@ var index_default = {
2760
2789
  routing.pathRevalidate,
2761
2790
  sharedIsrEntry.pathname
2762
2791
  )
2763
- ) === 0 || hasSharedCacheOptOut(response))) {
2792
+ ) === 0 || hasSharedCacheOptOut(response) || routing.type === "framework" && !isHtmlResponse(response))) {
2764
2793
  ctx.waitUntil(deleteSharedIsrEntry(env, sharedIsrEntry));
2765
2794
  }
2766
2795
  if (staticCacheKey && !writebackFallbackApplied && isStaticCacheResponseEligible(response)) {
@@ -2783,7 +2812,7 @@ var index_default = {
2783
2812
  if (dynamicType) {
2784
2813
  requestType = dynamicType;
2785
2814
  }
2786
- if ((routing.revalidate || routing.pages?.length) && !isEventStream && !request.headers.has("X-VoidPages") && request.method === "GET" && !request.headers.has("Range") && !shouldBypassIsr(request)) {
2815
+ if ((routing.revalidate || routing.pages?.length) && !isEventStream && !request.headers.has("X-VoidPages") && request.method === "GET" && !request.headers.has("Range") && (routing.type !== "framework" || isFrameworkDocumentRequest(request)) && !shouldBypassIsr(request)) {
2787
2816
  const configTtl = resolvePageTtl(
2788
2817
  routing.pages,
2789
2818
  routing.revalidate,
@@ -2791,7 +2820,7 @@ var index_default = {
2791
2820
  pathname
2792
2821
  );
2793
2822
  const isrTtl = configTtl > 0 ? resolveRevalidateTtl(response, configTtl) : 0;
2794
- if (isrTtl > 0 && response.status === 200 && requestType === "ssr" && !hasSharedCacheOptOut(response) && (!writebackFallbackApplied || isFallbackTargetCacheable(routing.pages, pathname, response, routing.pathRevalidate))) {
2823
+ if (isrTtl > 0 && response.status === 200 && requestType === "ssr" && (routing.type !== "framework" || isHtmlResponse(response)) && !hasSharedCacheOptOut(response) && (!writebackFallbackApplied || isFallbackTargetCacheable(routing.pages, pathname, response, routing.pathRevalidate))) {
2795
2824
  const isrDeploymentId = routing.version ?? "legacy";
2796
2825
  ctx.waitUntil(
2797
2826
  writeIsrCache(
@@ -3177,7 +3206,7 @@ async function revalidateInBackground(env, routing, request, host, pathname, def
3177
3206
  await cache.delete(jsonCacheKey);
3178
3207
  }, "evictSharedEntry");
3179
3208
  const effectiveBgPathname = fallbackResult.applied ? fallbackResult.pathname : pathname;
3180
- if (ttl > 0 && response.status === 200 && !isApiPath(effectiveBgPathname) && !hasSharedCacheOptOut(response) && (!fallbackResult.applied || isFallbackTargetCacheable(
3209
+ if (ttl > 0 && response.status === 200 && (routing.type !== "framework" || isHtmlResponse(response)) && !isApiPath(effectiveBgPathname) && !hasSharedCacheOptOut(response) && (!fallbackResult.applied || isFallbackTargetCacheable(
3181
3210
  routing.pages,
3182
3211
  effectiveBgPathname,
3183
3212
  response,
@@ -3208,7 +3237,7 @@ async function revalidateInBackground(env, routing, request, host, pathname, def
3208
3237
  );
3209
3238
  await populateJsonEdgeCache(cache, jsonCacheKey, response, ttl, "HIT");
3210
3239
  return true;
3211
- } else if (response.status === 200 && !isApiPath(effectiveBgPathname) && !fallbackResult.applied && (ttl === 0 || hasSharedCacheOptOut(response))) {
3240
+ } else if (response.status === 200 && !isApiPath(effectiveBgPathname) && !fallbackResult.applied && (ttl === 0 || hasSharedCacheOptOut(response) || routing.type === "framework" && !isHtmlResponse(response))) {
3212
3241
  try {
3213
3242
  await evictSharedEntry();
3214
3243
  } catch (error) {