@vercel/next 4.15.18 → 4.15.20

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 (2) hide show
  1. package/dist/index.js +44 -37
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12657,7 +12657,9 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12657
12657
  });
12658
12658
  }
12659
12659
  let dataFallbackFsRef = null;
12660
- if (!isFallback && !isBlocking && (!isNotFound || static404Page) && dataRoute && (!isAppClientParamParsingEnabled || prefetchDataRoute)) {
12660
+ if (!isFallback && !isBlocking && (!isNotFound || static404Page) && dataRoute && // When this is an App route, either isAppClientParamParsingEnabled is disabled
12661
+ // or there's a prefetchDataRoute
12662
+ (!isAppPathRoute || !isAppClientParamParsingEnabled || prefetchDataRoute)) {
12661
12663
  const basePath = isAppPathRoute && !isOmittedOrNotFound && appDir ? appDir : pagesDir;
12662
12664
  dataFallbackFsRef = new import_build_utils.FileFsRef({
12663
12665
  fsPath: import_path3.default.join(
@@ -12922,44 +12924,49 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12922
12924
  if (outputPathData && renderingMode !== "PARTIALLY_STATIC" /* PARTIALLY_STATIC */) {
12923
12925
  prerenders[normalizePathData(outputPathData)] = prerender;
12924
12926
  } else if (outputPathData && routesManifest?.rsc?.dynamicRSCPrerender && routesManifest?.ppr?.chain?.headers) {
12925
- let contentType = rscContentTypeHeader;
12926
- if (postponedState) {
12927
- contentType = `application/x-nextjs-pre-render; state-length=${postponedState.length}; origin=${JSON.stringify(
12928
- rscContentTypeHeader
12929
- )}`;
12930
- }
12931
- const rdcRSCAllowQuery = isAppClientParamParsingEnabled ? htmlAllowQuery : allowQuery;
12932
- let fallback = null;
12933
- if (rdcRSCAllowQuery && rdcRSCAllowQuery.length === 0 && postponedState) {
12934
- fallback = new import_build_utils.FileBlob({
12935
- data: postponedState,
12936
- contentType
12927
+ const shouldSkipDynamicRsc = Boolean(prefetchDataRoute) && !postponedState;
12928
+ if (shouldSkipDynamicRsc) {
12929
+ prerenders[normalizePathData(outputPathData)] = prerender;
12930
+ } else {
12931
+ let contentType = rscContentTypeHeader;
12932
+ if (postponedState) {
12933
+ contentType = `application/x-nextjs-pre-render; state-length=${postponedState.length}; origin=${JSON.stringify(
12934
+ rscContentTypeHeader
12935
+ )}`;
12936
+ }
12937
+ const rdcRSCAllowQuery = isAppClientParamParsingEnabled ? htmlAllowQuery : allowQuery;
12938
+ let fallback = null;
12939
+ if (rdcRSCAllowQuery && rdcRSCAllowQuery.length === 0 && postponedState) {
12940
+ fallback = new import_build_utils.FileBlob({
12941
+ data: postponedState,
12942
+ contentType
12943
+ });
12944
+ }
12945
+ prerenders[normalizePathData(outputPathData)] = new import_build_utils.Prerender({
12946
+ expiration: initialRevalidate,
12947
+ staleExpiration: initialExpire,
12948
+ lambda,
12949
+ allowQuery: rdcRSCAllowQuery,
12950
+ fallback,
12951
+ group: prerenderGroup,
12952
+ bypassToken: prerenderManifest.bypassToken,
12953
+ experimentalBypassFor,
12954
+ allowHeader,
12955
+ chain: {
12956
+ outputPath: normalizePathData(outputPathData),
12957
+ headers: routesManifest.ppr.chain.headers
12958
+ },
12959
+ ...isNotFound ? { initialStatus: 404 } : {},
12960
+ initialHeaders: {
12961
+ ...initialHeaders,
12962
+ "content-type": contentType,
12963
+ // Dynamic RSC requests cannot be cached, so we explicity set it
12964
+ // here to ensure that the response is not cached by the browser.
12965
+ "cache-control": "private, no-store, no-cache, max-age=0, must-revalidate",
12966
+ vary: rscVaryHeader
12967
+ }
12937
12968
  });
12938
12969
  }
12939
- prerenders[normalizePathData(outputPathData)] = new import_build_utils.Prerender({
12940
- expiration: initialRevalidate,
12941
- staleExpiration: initialExpire,
12942
- lambda,
12943
- allowQuery: rdcRSCAllowQuery,
12944
- fallback,
12945
- group: prerenderGroup,
12946
- bypassToken: prerenderManifest.bypassToken,
12947
- experimentalBypassFor,
12948
- allowHeader,
12949
- chain: {
12950
- outputPath: normalizePathData(outputPathData),
12951
- headers: routesManifest.ppr.chain.headers
12952
- },
12953
- ...isNotFound ? { initialStatus: 404 } : {},
12954
- initialHeaders: {
12955
- ...initialHeaders,
12956
- "content-type": contentType,
12957
- // Dynamic RSC requests cannot be cached, so we explicity set it
12958
- // here to ensure that the response is not cached by the browser.
12959
- "cache-control": "private, no-store, no-cache, max-age=0, must-revalidate",
12960
- vary: rscVaryHeader
12961
- }
12962
- });
12963
12970
  }
12964
12971
  }
12965
12972
  const prefetchSegmentSuffix = routesManifest?.rsc?.prefetchSegmentSuffix;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.15.18",
3
+ "version": "4.15.20",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",