@vercel/next 4.11.2 → 4.12.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.
Files changed (2) hide show
  1. package/dist/index.js +188 -80
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -11144,7 +11144,9 @@ async function getDynamicRoutes({
11144
11144
  isServerMode,
11145
11145
  dynamicMiddlewareRouteMap,
11146
11146
  isAppPPREnabled,
11147
- isAppClientSegmentCacheEnabled
11147
+ isAppClientSegmentCacheEnabled,
11148
+ isAppClientParamParsingEnabled,
11149
+ prerenderManifest
11148
11150
  }) {
11149
11151
  if (routesManifest) {
11150
11152
  switch (routesManifest.version) {
@@ -11197,6 +11199,8 @@ async function getDynamicRoutes({
11197
11199
  src: namedRegex || regex,
11198
11200
  dest: `${!isDev ? import_path2.default.posix.join("/", entryDirectory, page) : page}${routeKeys ? `?${Object.keys(routeKeys).map((key) => `${routeKeys[key]}=$${key}`).join("&")}` : ""}`
11199
11201
  };
11202
+ const { renderingMode, prefetchDataRoute } = prerenderManifest.fallbackRoutes[page] ?? prerenderManifest.blockingFallbackRoutes[page] ?? prerenderManifest.omittedRoutes[page] ?? {};
11203
+ const isRoutePPREnabled = renderingMode === "PARTIALLY_STATIC" /* PARTIALLY_STATIC */;
11200
11204
  if (!isServerMode) {
11201
11205
  route.check = true;
11202
11206
  }
@@ -11233,14 +11237,15 @@ async function getDynamicRoutes({
11233
11237
  }
11234
11238
  }
11235
11239
  if (isAppPPREnabled || isAppClientSegmentCacheEnabled) {
11240
+ const shouldSkipSuffixes = hasFallbackRootParams || isRoutePPREnabled && isAppClientParamParsingEnabled && !prefetchDataRoute;
11236
11241
  routes2.push({
11237
11242
  src: route.src.replace(
11238
11243
  new RegExp((0, import_escape_string_regexp.default)("(?:/)?$")),
11239
- hasFallbackRootParams ? "\\.rsc(?:/)?$" : "(?<rscSuffix>\\.rsc|\\.prefetch\\.rsc|\\.segments/.+\\.segment\\.rsc)(?:/)?$"
11244
+ shouldSkipSuffixes ? "\\.rsc(?:/)?$" : "(?<rscSuffix>\\.rsc|\\.prefetch\\.rsc|\\.segments/.+\\.segment\\.rsc)(?:/)?$"
11240
11245
  ),
11241
11246
  dest: route.dest?.replace(
11242
11247
  /($|\?)/,
11243
- hasFallbackRootParams ? ".rsc$1" : "$rscSuffix$1"
11248
+ shouldSkipSuffixes ? ".rsc$1" : "$rscSuffix$1"
11244
11249
  ),
11245
11250
  check: true,
11246
11251
  override: true
@@ -11883,6 +11888,9 @@ async function getSourceFilePathFromPage({
11883
11888
  if (page === "/_not-found/page") {
11884
11889
  return "";
11885
11890
  }
11891
+ if (page === "/_global-error/page") {
11892
+ return "";
11893
+ }
11886
11894
  if (!INTERNAL_PAGES.includes(page)) {
11887
11895
  console.log(
11888
11896
  `WARNING: Unable to find source file for page ${page} with extensions: ${extensionsToTry.join(
@@ -12222,7 +12230,8 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12222
12230
  isCorrectNotFoundRoutes,
12223
12231
  isEmptyAllowQueryForPrendered,
12224
12232
  isAppPPREnabled,
12225
- isAppClientSegmentCacheEnabled
12233
+ isAppClientSegmentCacheEnabled,
12234
+ isAppClientParamParsingEnabled
12226
12235
  } = prerenderRouteArgs;
12227
12236
  if (isBlocking && isFallback) {
12228
12237
  throw new import_build_utils.NowBuildError({
@@ -12335,7 +12344,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12335
12344
  isAppPathRoute = true;
12336
12345
  }
12337
12346
  const isOmittedOrNotFound = isOmitted || isNotFound;
12338
- let htmlFsRef = null;
12347
+ let htmlFallbackFsRef = null;
12339
12348
  let postponedPrerender;
12340
12349
  let postponedState = null;
12341
12350
  let didPostpone = false;
@@ -12355,34 +12364,27 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12355
12364
  didPostpone = false;
12356
12365
  }
12357
12366
  }
12358
- if (!dataRoute?.endsWith(".rsc")) {
12359
- throw new Error(
12360
- `Invariant: unexpected output path for ${dataRoute} and PPR`
12361
- );
12362
- }
12363
- if (!prefetchDataRoute?.endsWith(".prefetch.rsc")) {
12364
- throw new Error(
12365
- `Invariant: unexpected output path for ${prefetchDataRoute} and PPR`
12366
- );
12367
- }
12368
12367
  }
12369
12368
  if (postponedPrerender) {
12370
12369
  const contentType = initialHeaders?.["content-type"];
12371
12370
  if (!contentType) {
12372
12371
  throw new Error("Invariant: contentType can't be undefined");
12373
12372
  }
12374
- htmlFsRef = new import_build_utils.FileBlob({ contentType, data: postponedPrerender });
12373
+ htmlFallbackFsRef = new import_build_utils.FileBlob({
12374
+ contentType,
12375
+ data: postponedPrerender
12376
+ });
12375
12377
  } else if (appDir && !dataRoute && !prefetchDataRoute && isAppPathRoute && !(isBlocking || isFallback)) {
12376
12378
  const contentType = initialHeaders?.["content-type"];
12377
12379
  const fsPath = import_path2.default.join(appDir, `${routeFileNoExt}.body`);
12378
12380
  if (import_fs_extra3.default.existsSync(fsPath)) {
12379
- htmlFsRef = new import_build_utils.FileFsRef({
12381
+ htmlFallbackFsRef = new import_build_utils.FileFsRef({
12380
12382
  fsPath,
12381
12383
  contentType: contentType || "text/html;charset=utf-8"
12382
12384
  });
12383
12385
  }
12384
12386
  } else {
12385
- htmlFsRef = isBlocking || isNotFound && !static404Page ? (
12387
+ htmlFallbackFsRef = isBlocking || isNotFound && !static404Page ? (
12386
12388
  // Blocking pages do not have an HTML fallback
12387
12389
  null
12388
12390
  ) : new import_build_utils.FileFsRef({
@@ -12403,11 +12405,12 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12403
12405
  )
12404
12406
  });
12405
12407
  }
12406
- const jsonFsRef = (
12407
- // JSON data does not exist for fallback or blocking pages
12408
- isFallback || isBlocking || isNotFound && !static404Page || !dataRoute ? null : new import_build_utils.FileFsRef({
12408
+ let dataFallbackFsRef = null;
12409
+ if (!isFallback && !isBlocking && (!isNotFound || static404Page) && dataRoute && (!isAppClientParamParsingEnabled || prefetchDataRoute)) {
12410
+ const basePath = isAppPathRoute && !isOmittedOrNotFound && appDir ? appDir : pagesDir;
12411
+ dataFallbackFsRef = new import_build_utils.FileFsRef({
12409
12412
  fsPath: import_path2.default.join(
12410
- isAppPathRoute && !isOmittedOrNotFound && appDir ? appDir : pagesDir,
12413
+ basePath,
12411
12414
  `${isOmittedOrNotFound ? localePrefixed404 ? addLocaleOrDefault("/404.html", routesManifest, locale) : "/404.html" : isAppPathRoute ? (
12412
12415
  // When experimental PPR is enabled, we expect that the data
12413
12416
  // that should be served as a part of the prerender should
@@ -12417,8 +12420,8 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12417
12420
  renderingMode === "PARTIALLY_STATIC" /* PARTIALLY_STATIC */ ? prefetchDataRoute : dataRoute
12418
12421
  ) : routeFileNoExt + ".json"}`
12419
12422
  )
12420
- })
12421
- );
12423
+ });
12424
+ }
12422
12425
  if (isOmittedOrNotFound) {
12423
12426
  initialStatus = 404;
12424
12427
  }
@@ -12456,7 +12459,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12456
12459
  );
12457
12460
  }
12458
12461
  outputPathPrefetchData = normalizeDataRoute(prefetchDataRoute);
12459
- } else if (renderingMode === "PARTIALLY_STATIC" /* PARTIALLY_STATIC */) {
12462
+ } else if (renderingMode === "PARTIALLY_STATIC" /* PARTIALLY_STATIC */ && !isAppClientParamParsingEnabled) {
12460
12463
  throw new Error("Invariant: expected to find prefetch data route PPR");
12461
12464
  }
12462
12465
  if (isSharedLambdas) {
@@ -12486,20 +12489,20 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12486
12489
  lambda = lambdas[outputSrcPathPage];
12487
12490
  }
12488
12491
  if (!isAppPathRoute && !isNotFound && initialRevalidate === false) {
12489
- if (htmlFsRef == null || jsonFsRef == null) {
12492
+ if (htmlFallbackFsRef == null || dataFallbackFsRef == null) {
12490
12493
  throw new import_build_utils.NowBuildError({
12491
12494
  code: "NEXT_HTMLFSREF_JSONFSREF",
12492
12495
  message: `invariant: htmlFsRef != null && jsonFsRef != null ${routeFileNoExt}`
12493
12496
  });
12494
12497
  }
12495
12498
  if (!canUsePreviewMode || routeKey === "/404" && !lambdas[outputPathPage]) {
12496
- htmlFsRef.contentType = htmlContentType;
12497
- prerenders[outputPathPage] = htmlFsRef;
12499
+ htmlFallbackFsRef.contentType = htmlContentType;
12500
+ prerenders[outputPathPage] = htmlFallbackFsRef;
12498
12501
  if (outputPathPrefetchData) {
12499
- prerenders[outputPathPrefetchData] = jsonFsRef;
12502
+ prerenders[outputPathPrefetchData] = dataFallbackFsRef;
12500
12503
  }
12501
12504
  if (outputPathData && renderingMode !== "PARTIALLY_STATIC" /* PARTIALLY_STATIC */) {
12502
- prerenders[outputPathData] = jsonFsRef;
12505
+ prerenders[outputPathData] = dataFallbackFsRef;
12503
12506
  }
12504
12507
  }
12505
12508
  }
@@ -12570,7 +12573,11 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12570
12573
  let htmlAllowQuery = allowQuery;
12571
12574
  if (renderingMode === "PARTIALLY_STATIC" /* PARTIALLY_STATIC */ && (isFallback || isBlocking)) {
12572
12575
  const { fallbackRootParams, fallback } = isFallback ? prerenderManifest.fallbackRoutes[routeKey] : prerenderManifest.blockingFallbackRoutes[routeKey];
12573
- if (fallback && typeof fallback === "string" && fallbackRootParams && fallbackRootParams.length > 0) {
12576
+ if (
12577
+ // We only want to vary on the shell contents if there is a fallback
12578
+ // present and able to be served.
12579
+ fallback && typeof fallback === "string" && fallbackRootParams && fallbackRootParams.length > 0
12580
+ ) {
12574
12581
  htmlAllowQuery = fallbackRootParams;
12575
12582
  } else if (postponedPrerender) {
12576
12583
  htmlAllowQuery = [];
@@ -12581,7 +12588,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12581
12588
  staleExpiration: initialExpire,
12582
12589
  lambda,
12583
12590
  allowQuery: htmlAllowQuery,
12584
- fallback: htmlFsRef,
12591
+ fallback: htmlFallbackFsRef,
12585
12592
  group: prerenderGroup,
12586
12593
  bypassToken: prerenderManifest.bypassToken,
12587
12594
  experimentalBypassFor,
@@ -12617,7 +12624,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12617
12624
  staleExpiration: initialExpire,
12618
12625
  lambda,
12619
12626
  allowQuery,
12620
- fallback: jsonFsRef,
12627
+ fallback: dataFallbackFsRef,
12621
12628
  group: prerenderGroup,
12622
12629
  bypassToken: prerenderManifest.bypassToken,
12623
12630
  experimentalBypassFor,
@@ -12690,13 +12697,17 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12690
12697
  appDir,
12691
12698
  routeFileNoExt + prefetchSegmentDirSuffix
12692
12699
  );
12700
+ let segmentAllowQuery = allowQuery;
12701
+ if (isAppClientParamParsingEnabled && (isFallback || isBlocking)) {
12702
+ segmentAllowQuery = [];
12703
+ }
12693
12704
  for (const segmentPath of meta.segmentPaths) {
12694
12705
  const outputSegmentPath = import_path2.default.join(
12695
12706
  outputPathPage + prefetchSegmentDirSuffix,
12696
12707
  segmentPath
12697
12708
  ) + prefetchSegmentSuffix;
12698
12709
  let fallback = null;
12699
- if (!isFallback) {
12710
+ if (segmentAllowQuery && segmentAllowQuery.length === 0) {
12700
12711
  const fsPath = import_path2.default.join(
12701
12712
  segmentsDir,
12702
12713
  segmentPath + prefetchSegmentSuffix
@@ -12707,7 +12718,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12707
12718
  expiration: initialRevalidate,
12708
12719
  staleExpiration: initialExpire,
12709
12720
  lambda,
12710
- allowQuery,
12721
+ allowQuery: segmentAllowQuery,
12711
12722
  fallback,
12712
12723
  // Use the same prerender group as the JSON/data prerender.
12713
12724
  group: prerenderGroup,
@@ -13472,6 +13483,55 @@ function getHTMLPostponedState({
13472
13483
  }
13473
13484
  return meta.postponed;
13474
13485
  }
13486
+ async function getServerActionMetaRoutes(distDir) {
13487
+ const manifestPath = import_path2.default.join(
13488
+ distDir,
13489
+ "server",
13490
+ "server-reference-manifest.json"
13491
+ );
13492
+ try {
13493
+ const manifestContent = await import_fs_extra3.default.readFile(manifestPath, "utf8");
13494
+ const manifest = JSON.parse(manifestContent);
13495
+ const routes = [];
13496
+ for (const runtimeType of ["node", "edge"]) {
13497
+ const runtime = manifest[runtimeType];
13498
+ if (!runtime)
13499
+ continue;
13500
+ for (const [id, entry] of Object.entries(runtime)) {
13501
+ if (!entry.filename || !entry.exportedName)
13502
+ continue;
13503
+ let exportedName = entry.exportedName;
13504
+ if (exportedName === "$$RSC_SERVER_ACTION_0") {
13505
+ exportedName = "anonymous_fn";
13506
+ }
13507
+ const route = {
13508
+ src: "/(.*)",
13509
+ has: [
13510
+ {
13511
+ type: "header",
13512
+ key: "next-action",
13513
+ value: id
13514
+ }
13515
+ ],
13516
+ transforms: [
13517
+ {
13518
+ type: "request.headers",
13519
+ op: "append",
13520
+ target: {
13521
+ key: "x-server-action-name"
13522
+ },
13523
+ args: `${entry.filename}#${exportedName}`
13524
+ }
13525
+ ]
13526
+ };
13527
+ routes.push(route);
13528
+ }
13529
+ }
13530
+ return routes;
13531
+ } catch (error) {
13532
+ return [];
13533
+ }
13534
+ }
13475
13535
 
13476
13536
  // src/create-serverless-config.ts
13477
13537
  function getCustomData(importName, target) {
@@ -13966,7 +14026,10 @@ async function serverBuild({
13966
14026
  variantsManifest,
13967
14027
  experimentalPPRRoutes,
13968
14028
  isAppPPREnabled,
13969
- isAppClientSegmentCacheEnabled
14029
+ isAppFullPPREnabled,
14030
+ isAppClientSegmentCacheEnabled,
14031
+ isAppClientParamParsingEnabled,
14032
+ clientParamParsingOrigins
13970
14033
  }) {
13971
14034
  if (isAppPPREnabled) {
13972
14035
  (0, import_build_utils2.debug)(
@@ -13975,6 +14038,7 @@ async function serverBuild({
13975
14038
  );
13976
14039
  }
13977
14040
  lambdaPages = Object.assign({}, lambdaPages, lambdaAppPaths);
14041
+ const shouldSkipPrefetchRSCHandling = isAppFullPPREnabled && isAppClientParamParsingEnabled && isAppClientSegmentCacheEnabled;
13978
14042
  const experimentalAllowBundling = Boolean(
13979
14043
  process.env.NEXT_EXPERIMENTAL_FUNCTION_BUNDLING
13980
14044
  );
@@ -13984,7 +14048,6 @@ async function serverBuild({
13984
14048
  const lambdas = {};
13985
14049
  const prerenders = {};
13986
14050
  const lambdaPageKeys = Object.keys(lambdaPages);
13987
- const internalPages = [...INTERNAL_PAGES];
13988
14051
  const pageBuildTraces = await (0, import_build_utils2.glob)("**/*.js.nft.json", pagesDir);
13989
14052
  const isEmptyAllowQueryForPrendered = import_semver3.default.gte(
13990
14053
  nextVersion,
@@ -14023,6 +14086,23 @@ async function serverBuild({
14023
14086
  } else if (rewrite.dest.startsWith("https://")) {
14024
14087
  protocol = "https://";
14025
14088
  }
14089
+ let origin = null;
14090
+ if (protocol) {
14091
+ const urlWithoutProtocol = rewrite.dest.substring(protocol.length);
14092
+ const delimiters = ["/", "?", "#"];
14093
+ let endIndex = -1;
14094
+ for (const delimiter of delimiters) {
14095
+ const index = urlWithoutProtocol.indexOf(delimiter);
14096
+ if (index !== -1) {
14097
+ endIndex = endIndex === -1 ? index : Math.min(endIndex, index);
14098
+ }
14099
+ }
14100
+ if (endIndex === -1) {
14101
+ origin = rewrite.dest;
14102
+ } else {
14103
+ origin = protocol + urlWithoutProtocol.substring(0, endIndex);
14104
+ }
14105
+ }
14026
14106
  let pathname = null;
14027
14107
  let query = null;
14028
14108
  if (!protocol) {
@@ -14065,7 +14145,10 @@ async function serverBuild({
14065
14145
  const { rewriteHeaders } = routesManifest;
14066
14146
  if (!rewriteHeaders)
14067
14147
  continue;
14068
- if (protocol || !pathname && !query)
14148
+ const isAllowedOrigin = origin && clientParamParsingOrigins ? clientParamParsingOrigins.some(
14149
+ (allowedOrigin) => new RegExp(allowedOrigin).test(origin)
14150
+ ) : false;
14151
+ if (origin && !isAllowedOrigin)
14069
14152
  continue;
14070
14153
  rewrite.headers = {
14071
14154
  ...rewrite.headers,
@@ -14116,6 +14199,9 @@ async function serverBuild({
14116
14199
  const lstatResults = {};
14117
14200
  const nonLambdaSsgPages = /* @__PURE__ */ new Set();
14118
14201
  const static404Pages = new Set(static404Page ? [static404Page] : []);
14202
+ const internalPages = [...INTERNAL_PAGES].filter((page) => {
14203
+ return lambdaPages[page];
14204
+ });
14119
14205
  Object.keys(prerenderManifest.staticRoutes).forEach((route) => {
14120
14206
  const result = onPrerenderRouteInitial(
14121
14207
  prerenderManifest,
@@ -14472,7 +14558,7 @@ ${JSON.stringify(
14472
14558
  for (const page of mergedPageKeys) {
14473
14559
  const originalPagePath = getOriginalPagePath(page);
14474
14560
  const pageBuildTrace = getBuildTraceFile(originalPagePath);
14475
- let fileList;
14561
+ let fileList = [];
14476
14562
  let reasons;
14477
14563
  if (pageBuildTrace) {
14478
14564
  const { files } = JSON.parse(
@@ -14510,16 +14596,10 @@ ${JSON.stringify(
14510
14596
  });
14511
14597
  reasons = /* @__PURE__ */ new Map();
14512
14598
  } else {
14599
+ const lambdaPage = lambdaPages[page];
14513
14600
  fileList = Array.from(
14514
- parentFilesMap?.get(
14515
- import_path4.default.relative(baseDir, lambdaPages[page].fsPath)
14516
- ) || []
14601
+ parentFilesMap?.get(import_path4.default.relative(baseDir, lambdaPage.fsPath)) || []
14517
14602
  );
14518
- if (!fileList) {
14519
- throw new Error(
14520
- `Invariant: Failed to trace ${page}, missing fileList`
14521
- );
14522
- }
14523
14603
  reasons = traceResult?.reasons || /* @__PURE__ */ new Map();
14524
14604
  }
14525
14605
  const tracedFiles = Object.fromEntries(
@@ -14986,7 +15066,8 @@ ${JSON.stringify(
14986
15066
  isCorrectNotFoundRoutes,
14987
15067
  isEmptyAllowQueryForPrendered,
14988
15068
  isAppPPREnabled,
14989
- isAppClientSegmentCacheEnabled
15069
+ isAppClientSegmentCacheEnabled,
15070
+ isAppClientParamParsingEnabled
14990
15071
  });
14991
15072
  await Promise.all(
14992
15073
  Object.keys(prerenderManifest.staticRoutes).map(
@@ -15042,7 +15123,9 @@ ${JSON.stringify(
15042
15123
  isServerMode: true,
15043
15124
  dynamicMiddlewareRouteMap: middleware.dynamicRouteMap,
15044
15125
  isAppPPREnabled,
15045
- isAppClientSegmentCacheEnabled
15126
+ isAppClientSegmentCacheEnabled,
15127
+ isAppClientParamParsingEnabled,
15128
+ prerenderManifest
15046
15129
  }).then(
15047
15130
  (arr) => localizeDynamicRoutes(
15048
15131
  arr,
@@ -15216,7 +15299,13 @@ ${JSON.stringify(
15216
15299
  }
15217
15300
  }
15218
15301
  const shouldHandleSegmentToRsc = Boolean(
15219
- isAppClientSegmentCacheEnabled && rscPrefetchHeader && prefetchSegmentHeader && prefetchSegmentDirSuffix && prefetchSegmentSuffix
15302
+ isAppClientSegmentCacheEnabled && rscPrefetchHeader && prefetchSegmentHeader && prefetchSegmentDirSuffix && prefetchSegmentSuffix && // When the entire application has PPR enabled (all the routes) and both
15303
+ // client param parsing and client segment cache are enabled we do not
15304
+ // need the .prefetch.rsc rewrite.
15305
+ !shouldSkipPrefetchRSCHandling
15306
+ );
15307
+ const serverActionMetaRoutes = await getServerActionMetaRoutes(
15308
+ import_path4.default.join(entryPath, outputDirectory)
15220
15309
  );
15221
15310
  return {
15222
15311
  wildcard: wildcardConfig,
@@ -15374,6 +15463,7 @@ ${JSON.stringify(
15374
15463
  ] : [],
15375
15464
  ...headers,
15376
15465
  ...redirects,
15466
+ ...serverActionMetaRoutes,
15377
15467
  // middleware comes directly after redirects but before
15378
15468
  // beforeFiles rewrites as middleware is not a "file" route
15379
15469
  ...routesManifest?.skipMiddlewareUrlNormalize ? denormalizeNextDataRoute(true) : [],
@@ -15491,9 +15581,7 @@ ${JSON.stringify(
15491
15581
  override: true
15492
15582
  }
15493
15583
  ] : [],
15494
- ...rscPrefetchHeader && isAppPPREnabled && // when client segment cache is enabled we do not need
15495
- // the .prefetch.rsc routing
15496
- !isAppClientSegmentCacheEnabled ? [
15584
+ ...rscPrefetchHeader && isAppPPREnabled && !shouldSkipPrefetchRSCHandling ? [
15497
15585
  {
15498
15586
  src: `^${import_path4.default.posix.join("/", entryDirectory, "/")}$`,
15499
15587
  has: [
@@ -15609,28 +15697,34 @@ ${JSON.stringify(
15609
15697
  ...afterFilesRewrites,
15610
15698
  // ensure non-normalized /.rsc from rewrites is handled
15611
15699
  ...appPathRoutesManifest ? [
15612
- {
15613
- src: import_path4.default.posix.join("/", entryDirectory, "/\\.prefetch\\.rsc$"),
15614
- dest: import_path4.default.posix.join(
15615
- "/",
15616
- entryDirectory,
15617
- `/__index${RSC_PREFETCH_SUFFIX}`
15618
- ),
15619
- check: true
15620
- },
15621
- {
15622
- src: import_path4.default.posix.join(
15623
- "/",
15624
- entryDirectory,
15625
- "(.+)/\\.prefetch\\.rsc$"
15626
- ),
15627
- dest: import_path4.default.posix.join(
15628
- "/",
15629
- entryDirectory,
15630
- `$1${RSC_PREFETCH_SUFFIX}`
15631
- ),
15632
- check: true
15633
- },
15700
+ ...shouldSkipPrefetchRSCHandling ? [] : [
15701
+ {
15702
+ src: import_path4.default.posix.join(
15703
+ "/",
15704
+ entryDirectory,
15705
+ "/\\.prefetch\\.rsc$"
15706
+ ),
15707
+ dest: import_path4.default.posix.join(
15708
+ "/",
15709
+ entryDirectory,
15710
+ `/__index${RSC_PREFETCH_SUFFIX}`
15711
+ ),
15712
+ check: true
15713
+ },
15714
+ {
15715
+ src: import_path4.default.posix.join(
15716
+ "/",
15717
+ entryDirectory,
15718
+ "(.+)/\\.prefetch\\.rsc$"
15719
+ ),
15720
+ dest: import_path4.default.posix.join(
15721
+ "/",
15722
+ entryDirectory,
15723
+ `$1${RSC_PREFETCH_SUFFIX}`
15724
+ ),
15725
+ check: true
15726
+ }
15727
+ ],
15634
15728
  {
15635
15729
  src: import_path4.default.posix.join("/", entryDirectory, "/\\.rsc$"),
15636
15730
  dest: import_path4.default.posix.join("/", entryDirectory, `/index.rsc`),
@@ -15714,7 +15808,7 @@ ${JSON.stringify(
15714
15808
  ] : [],
15715
15809
  // If it didn't match any of the static routes or dynamic ones, then we
15716
15810
  // should fallback to either prefetch or normal RSC request
15717
- ...shouldHandleSegmentToRsc && prefetchSegmentDirSuffix && prefetchSegmentSuffix ? [
15811
+ ...shouldHandleSegmentToRsc ? [
15718
15812
  {
15719
15813
  src: "^/(?<path>.+)(?<rscSuffix>\\.segments/.+\\.segment\\.rsc)(?:/)?$",
15720
15814
  dest: `/$path${isAppPPREnabled ? ".prefetch.rsc" : ".rsc"}`,
@@ -16928,7 +17022,10 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
16928
17022
  experimentalPPRRoutes.add(route);
16929
17023
  }
16930
17024
  const isAppPPREnabled = requiredServerFilesManifest ? requiredServerFilesManifest.config.experimental?.ppr === true || requiredServerFilesManifest.config.experimental?.ppr === "incremental" || requiredServerFilesManifest.config.experimental?.cacheComponents === true : false;
17025
+ const isAppFullPPREnabled = requiredServerFilesManifest ? requiredServerFilesManifest?.config.experimental?.ppr === true || requiredServerFilesManifest.config.experimental?.cacheComponents === true : false;
16931
17026
  const isAppClientSegmentCacheEnabled = requiredServerFilesManifest ? requiredServerFilesManifest.config.experimental?.clientSegmentCache === true : false;
17027
+ const isAppClientParamParsingEnabled = routesManifest?.rsc?.clientParamParsing ?? false;
17028
+ const clientParamParsingOrigins = requiredServerFilesManifest ? requiredServerFilesManifest.config.experimental?.clientParamParsingOrigins : void 0;
16932
17029
  if (requiredServerFilesManifest) {
16933
17030
  if (!routesManifest) {
16934
17031
  throw new Error(
@@ -16978,7 +17075,10 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
16978
17075
  variantsManifest,
16979
17076
  experimentalPPRRoutes,
16980
17077
  isAppPPREnabled,
16981
- isAppClientSegmentCacheEnabled
17078
+ isAppFullPPREnabled,
17079
+ isAppClientSegmentCacheEnabled,
17080
+ isAppClientParamParsingEnabled,
17081
+ clientParamParsingOrigins
16982
17082
  });
16983
17083
  }
16984
17084
  const pageKeys = Object.keys(pages);
@@ -17369,7 +17469,10 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17369
17469
  canUsePreviewMode,
17370
17470
  bypassToken: prerenderManifest.bypassToken || "",
17371
17471
  isServerMode,
17372
- isAppPPREnabled: false
17472
+ isAppPPREnabled: false,
17473
+ isAppClientParamParsingEnabled,
17474
+ isAppClientSegmentCacheEnabled,
17475
+ prerenderManifest
17373
17476
  }).then(
17374
17477
  (arr) => localizeDynamicRoutes(
17375
17478
  arr,
@@ -17395,7 +17498,10 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17395
17498
  canUsePreviewMode,
17396
17499
  bypassToken: prerenderManifest.bypassToken || "",
17397
17500
  isServerMode,
17398
- isAppPPREnabled: false
17501
+ isAppPPREnabled: false,
17502
+ isAppClientParamParsingEnabled: false,
17503
+ isAppClientSegmentCacheEnabled: false,
17504
+ prerenderManifest
17399
17505
  }).then(
17400
17506
  (arr) => arr.map((route) => {
17401
17507
  route.src = route.src.replace("^", `^${dynamicPrefix}`);
@@ -17574,8 +17680,10 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17574
17680
  appPathRoutesManifest,
17575
17681
  isSharedLambdas,
17576
17682
  canUsePreviewMode,
17683
+ // The following flags are not supported in this version of the builder.
17577
17684
  isAppPPREnabled: false,
17578
- isAppClientSegmentCacheEnabled: false
17685
+ isAppClientSegmentCacheEnabled: false,
17686
+ isAppClientParamParsingEnabled: false
17579
17687
  });
17580
17688
  await Promise.all(
17581
17689
  Object.keys(prerenderManifest.staticRoutes).map(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.11.2",
3
+ "version": "4.12.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -30,7 +30,7 @@
30
30
  "@types/semver": "6.0.0",
31
31
  "@types/text-table": "0.2.1",
32
32
  "@types/webpack-sources": "3.2.0",
33
- "@vercel/build-utils": "11.0.1",
33
+ "@vercel/build-utils": "11.0.2",
34
34
  "@vercel/routing-utils": "5.1.1",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",