@vercel/next 4.0.3 → 4.0.5

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/dist/index.js CHANGED
@@ -43302,6 +43302,9 @@ const CORRECT_MIDDLEWARE_ORDER_VERSION = 'v12.1.7-canary.29';
43302
43302
  const NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = 'v12.1.7-canary.33';
43303
43303
  const EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = 'v12.2.0';
43304
43304
  const CORRECTED_MANIFESTS_VERSION = 'v12.2.0';
43305
+ // related PR: https://github.com/vercel/next.js/pull/52997
43306
+ const BUNDLED_SERVER_NEXT_VERSION = '13.4.20-canary.26';
43307
+ const BUNDLED_SERVER_NEXT_PATH = 'next/dist/compiled/next-server/server.runtime.prod.js';
43305
43308
  async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfigManifest, privateOutputs, baseDir, workPath, entryPath, nodeVersion, buildId, escapedBuildId, dynamicPrefix, entryDirectory, outputDirectory, redirects, beforeFilesRewrites, afterFilesRewrites, fallbackRewrites, headers, dataRoutes, hasIsr404Page, hasIsr500Page, imagesManifest, wildcardConfig, routesManifest, staticPages, lambdaPages, localePrefixed404, nextVersion, lambdaAppPaths, canUsePreviewMode, trailingSlash, prerenderManifest, appPathRoutesManifest, omittedPrerenderRoutes, trailingSlashRedirects, isCorrectLocaleAPIRoutes, lambdaCompressedByteLimit, requiredServerFilesManifest, }) {
43306
43309
  lambdaPages = Object.assign({}, lambdaPages, lambdaAppPaths);
43307
43310
  const lambdas = {};
@@ -43403,10 +43406,19 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
43403
43406
  let initialFileReasons;
43404
43407
  let nextServerBuildTrace;
43405
43408
  let instrumentationHookBuildTrace;
43406
- const nextServerFile = (0, resolve_from_1.default)(projectDir, `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
43409
+ const useBundledServer = semver_1.default.gte(nextVersion, BUNDLED_SERVER_NEXT_VERSION) &&
43410
+ process.env.VERCEL_NEXT_BUNDLED_SERVER;
43411
+ if (useBundledServer) {
43412
+ (0, build_utils_1.debug)('Using bundled Next.js server');
43413
+ }
43414
+ const nextServerFile = (0, resolve_from_1.default)(projectDir, useBundledServer
43415
+ ? BUNDLED_SERVER_NEXT_PATH
43416
+ : `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
43407
43417
  try {
43408
43418
  // leverage next-server trace from build if available
43409
- nextServerBuildTrace = JSON.parse(await fs_extra_1.default.readFile(path_1.default.join(entryPath, outputDirectory, 'next-server.js.nft.json'), 'utf8'));
43419
+ nextServerBuildTrace = JSON.parse(await fs_extra_1.default.readFile(path_1.default.join(entryPath, outputDirectory, useBundledServer
43420
+ ? 'next-minimal-server.js.nft.json'
43421
+ : 'next-server.js.nft.json'), 'utf8'));
43410
43422
  }
43411
43423
  catch (_) {
43412
43424
  // if the trace is unavailable we trace inside the runtime
@@ -43460,6 +43472,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
43460
43472
  const apiPages = [];
43461
43473
  const nonApiPages = [];
43462
43474
  const appRouterPages = [];
43475
+ const appRouteHandlers = [];
43463
43476
  lambdaPageKeys.forEach(page => {
43464
43477
  if (internalPages.includes(page) &&
43465
43478
  page !== '404.js' &&
@@ -43475,7 +43488,12 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
43475
43488
  dynamicPages.push(normalizedPathname);
43476
43489
  }
43477
43490
  if (lambdaAppPaths[page]) {
43478
- appRouterPages.push(page);
43491
+ if (lambdaAppPaths[page].fsPath.endsWith('route.js')) {
43492
+ appRouteHandlers.push(page);
43493
+ }
43494
+ else {
43495
+ appRouterPages.push(page);
43496
+ }
43479
43497
  }
43480
43498
  else if (pageMatchesApi(page)) {
43481
43499
  apiPages.push(page);
@@ -43582,7 +43600,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
43582
43600
  distDir: path_1.default.relative(projectDir, path_1.default.join(entryPath, outputDirectory)),
43583
43601
  compress: false,
43584
43602
  })}`)
43585
- .replace('__NEXT_SERVER_PATH__', `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
43603
+ .replace('__NEXT_SERVER_PATH__', useBundledServer
43604
+ ? BUNDLED_SERVER_NEXT_PATH
43605
+ : `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
43586
43606
  const appLauncher = launcher.replace('// pre-next-server-target', `process.env.__NEXT_PRIVATE_PREBUNDLED_REACT = "${requiredServerFilesManifest.config?.experimental?.serverActions
43587
43607
  ? 'experimental'
43588
43608
  : 'next'}"`);
@@ -43600,6 +43620,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
43600
43620
  const mergedPageKeys = [
43601
43621
  ...nonApiPages,
43602
43622
  ...appRouterPages,
43623
+ ...appRouteHandlers,
43603
43624
  ...apiPages,
43604
43625
  ...internalPages,
43605
43626
  ];
@@ -43705,6 +43726,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
43705
43726
  internalPages,
43706
43727
  pageExtensions,
43707
43728
  });
43729
+ for (const group of pageLambdaGroups) {
43730
+ group.isPages = true;
43731
+ }
43708
43732
  const appRouterLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
43709
43733
  entryPath: projectDir,
43710
43734
  config,
@@ -43720,12 +43744,34 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
43720
43744
  internalPages,
43721
43745
  pageExtensions,
43722
43746
  });
43747
+ const appRouteHandlersLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
43748
+ entryPath: projectDir,
43749
+ config,
43750
+ functionsConfigManifest,
43751
+ pages: appRouteHandlers,
43752
+ prerenderRoutes,
43753
+ pageTraces,
43754
+ compressedPages,
43755
+ tracedPseudoLayer: tracedPseudoLayer.pseudoLayer,
43756
+ initialPseudoLayer,
43757
+ lambdaCompressedByteLimit,
43758
+ initialPseudoLayerUncompressed: uncompressedInitialSize,
43759
+ internalPages,
43760
+ pageExtensions,
43761
+ });
43723
43762
  for (const group of appRouterLambdaGroups) {
43724
43763
  if (!group.isPrerenders) {
43725
43764
  group.isStreaming = true;
43726
43765
  }
43727
43766
  group.isAppRouter = true;
43728
43767
  }
43768
+ for (const group of appRouteHandlersLambdaGroups) {
43769
+ if (!group.isPrerenders) {
43770
+ group.isStreaming = true;
43771
+ }
43772
+ group.isAppRouter = true;
43773
+ group.isAppRouteHandler = true;
43774
+ }
43729
43775
  const apiLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
43730
43776
  entryPath: projectDir,
43731
43777
  config,
@@ -43763,12 +43809,19 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
43763
43809
  pseudoLayerBytes: group.pseudoLayerBytes,
43764
43810
  uncompressedLayerBytes: group.pseudoLayerUncompressedBytes,
43765
43811
  })),
43812
+ appRouteHandlersLambdaGroups: appRouteHandlersLambdaGroups.map(group => ({
43813
+ pages: group.pages,
43814
+ isPrerender: group.isPrerenders,
43815
+ pseudoLayerBytes: group.pseudoLayerBytes,
43816
+ uncompressedLayerBytes: group.pseudoLayerUncompressedBytes,
43817
+ })),
43766
43818
  nextServerLayerSize: initialPseudoLayer.pseudoLayerBytes,
43767
43819
  }, null, 2));
43768
43820
  const combinedGroups = [
43769
43821
  ...pageLambdaGroups,
43770
43822
  ...appRouterLambdaGroups,
43771
43823
  ...apiLambdaGroups,
43824
+ ...appRouteHandlersLambdaGroups,
43772
43825
  ];
43773
43826
  await (0, utils_1.detectLambdaLimitExceeding)(combinedGroups, lambdaCompressedByteLimit, compressedPages);
43774
43827
  for (const group of combinedGroups) {
@@ -45395,9 +45448,11 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
45395
45448
  const { initialRevalidateSeconds, dataRoute, srcRoute } = manifest.routes[route];
45396
45449
  let initialStatus;
45397
45450
  let initialHeaders;
45451
+ let experimentalBypassFor;
45398
45452
  if (manifest.version === 4) {
45399
45453
  initialStatus = manifest.routes[route].initialStatus;
45400
45454
  initialHeaders = manifest.routes[route].initialHeaders;
45455
+ experimentalBypassFor = manifest.routes[route].experimentalBypassFor;
45401
45456
  }
45402
45457
  ret.staticRoutes[route] = {
45403
45458
  initialRevalidate: initialRevalidateSeconds === false
@@ -45407,12 +45462,19 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
45407
45462
  srcRoute,
45408
45463
  initialStatus,
45409
45464
  initialHeaders,
45465
+ experimentalBypassFor,
45410
45466
  };
45411
45467
  });
45412
45468
  lazyRoutes.forEach(lazyRoute => {
45413
45469
  const { routeRegex, fallback, dataRoute, dataRouteRegex } = manifest.dynamicRoutes[lazyRoute];
45470
+ let experimentalBypassFor;
45471
+ if (manifest.version === 4) {
45472
+ experimentalBypassFor =
45473
+ manifest.dynamicRoutes[lazyRoute].experimentalBypassFor;
45474
+ }
45414
45475
  if (typeof fallback === 'string') {
45415
45476
  ret.fallbackRoutes[lazyRoute] = {
45477
+ experimentalBypassFor,
45416
45478
  routeRegex,
45417
45479
  fallback,
45418
45480
  dataRoute,
@@ -45421,6 +45483,7 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
45421
45483
  }
45422
45484
  else if (fallback === null) {
45423
45485
  ret.blockingFallbackRoutes[lazyRoute] = {
45486
+ experimentalBypassFor,
45424
45487
  routeRegex,
45425
45488
  dataRoute,
45426
45489
  dataRouteRegex,
@@ -45430,6 +45493,7 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
45430
45493
  // Fallback behavior is disabled, all routes would've been provided
45431
45494
  // in the top-level `routes` key (`staticRoutes`).
45432
45495
  ret.omittedRoutes[lazyRoute] = {
45496
+ experimentalBypassFor,
45433
45497
  routeRegex,
45434
45498
  dataRoute,
45435
45499
  dataRouteRegex,
@@ -45864,6 +45928,7 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
45864
45928
  let dataRoute;
45865
45929
  let initialStatus;
45866
45930
  let initialHeaders;
45931
+ let experimentalBypassFor;
45867
45932
  if (isFallback || isBlocking) {
45868
45933
  const pr = isFallback
45869
45934
  ? prerenderManifest.fallbackRoutes[routeKey]
@@ -45879,11 +45944,14 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
45879
45944
  }
45880
45945
  srcRoute = null;
45881
45946
  dataRoute = pr.dataRoute;
45947
+ experimentalBypassFor = pr.experimentalBypassFor;
45882
45948
  }
45883
45949
  else if (isOmitted) {
45884
45950
  initialRevalidate = false;
45885
45951
  srcRoute = routeKey;
45886
45952
  dataRoute = prerenderManifest.omittedRoutes[routeKey].dataRoute;
45953
+ experimentalBypassFor =
45954
+ prerenderManifest.omittedRoutes[routeKey].experimentalBypassFor;
45887
45955
  }
45888
45956
  else {
45889
45957
  const pr = prerenderManifest.staticRoutes[routeKey];
@@ -45893,6 +45961,7 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
45893
45961
  dataRoute,
45894
45962
  initialHeaders,
45895
45963
  initialStatus,
45964
+ experimentalBypassFor,
45896
45965
  } = pr);
45897
45966
  }
45898
45967
  let isAppPathRoute = false;
@@ -46070,6 +46139,7 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
46070
46139
  fallback: htmlFsRef,
46071
46140
  group: prerenderGroup,
46072
46141
  bypassToken: prerenderManifest.bypassToken,
46142
+ experimentalBypassFor,
46073
46143
  initialStatus,
46074
46144
  initialHeaders,
46075
46145
  sourcePath,
@@ -46095,6 +46165,7 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
46095
46165
  fallback: jsonFsRef,
46096
46166
  group: prerenderGroup,
46097
46167
  bypassToken: prerenderManifest.bypassToken,
46168
+ experimentalBypassFor,
46098
46169
  ...(isNotFound
46099
46170
  ? {
46100
46171
  initialStatus: 404,
@@ -21,6 +21,9 @@ const CORRECT_MIDDLEWARE_ORDER_VERSION = 'v12.1.7-canary.29';
21
21
  const NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = 'v12.1.7-canary.33';
22
22
  const EMPTY_ALLOW_QUERY_FOR_PRERENDERED_VERSION = 'v12.2.0';
23
23
  const CORRECTED_MANIFESTS_VERSION = 'v12.2.0';
24
+ // related PR: https://github.com/vercel/next.js/pull/52997
25
+ const BUNDLED_SERVER_NEXT_VERSION = '13.4.20-canary.26';
26
+ const BUNDLED_SERVER_NEXT_PATH = 'next/dist/compiled/next-server/server.runtime.prod.js';
24
27
  async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfigManifest, privateOutputs, baseDir, workPath, entryPath, nodeVersion, buildId, escapedBuildId, dynamicPrefix, entryDirectory, outputDirectory, redirects, beforeFilesRewrites, afterFilesRewrites, fallbackRewrites, headers, dataRoutes, hasIsr404Page, hasIsr500Page, imagesManifest, wildcardConfig, routesManifest, staticPages, lambdaPages, localePrefixed404, nextVersion, lambdaAppPaths, canUsePreviewMode, trailingSlash, prerenderManifest, appPathRoutesManifest, omittedPrerenderRoutes, trailingSlashRedirects, isCorrectLocaleAPIRoutes, lambdaCompressedByteLimit, requiredServerFilesManifest, }) {
25
28
  lambdaPages = Object.assign({}, lambdaPages, lambdaAppPaths);
26
29
  const lambdas = {};
@@ -122,10 +125,19 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
122
125
  let initialFileReasons;
123
126
  let nextServerBuildTrace;
124
127
  let instrumentationHookBuildTrace;
125
- const nextServerFile = (0, resolve_from_1.default)(projectDir, `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
128
+ const useBundledServer = semver_1.default.gte(nextVersion, BUNDLED_SERVER_NEXT_VERSION) &&
129
+ process.env.VERCEL_NEXT_BUNDLED_SERVER;
130
+ if (useBundledServer) {
131
+ (0, build_utils_1.debug)('Using bundled Next.js server');
132
+ }
133
+ const nextServerFile = (0, resolve_from_1.default)(projectDir, useBundledServer
134
+ ? BUNDLED_SERVER_NEXT_PATH
135
+ : `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
126
136
  try {
127
137
  // leverage next-server trace from build if available
128
- nextServerBuildTrace = JSON.parse(await fs_extra_1.default.readFile(path_1.default.join(entryPath, outputDirectory, 'next-server.js.nft.json'), 'utf8'));
138
+ nextServerBuildTrace = JSON.parse(await fs_extra_1.default.readFile(path_1.default.join(entryPath, outputDirectory, useBundledServer
139
+ ? 'next-minimal-server.js.nft.json'
140
+ : 'next-server.js.nft.json'), 'utf8'));
129
141
  }
130
142
  catch (_) {
131
143
  // if the trace is unavailable we trace inside the runtime
@@ -179,6 +191,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
179
191
  const apiPages = [];
180
192
  const nonApiPages = [];
181
193
  const appRouterPages = [];
194
+ const appRouteHandlers = [];
182
195
  lambdaPageKeys.forEach(page => {
183
196
  if (internalPages.includes(page) &&
184
197
  page !== '404.js' &&
@@ -194,7 +207,12 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
194
207
  dynamicPages.push(normalizedPathname);
195
208
  }
196
209
  if (lambdaAppPaths[page]) {
197
- appRouterPages.push(page);
210
+ if (lambdaAppPaths[page].fsPath.endsWith('route.js')) {
211
+ appRouteHandlers.push(page);
212
+ }
213
+ else {
214
+ appRouterPages.push(page);
215
+ }
198
216
  }
199
217
  else if (pageMatchesApi(page)) {
200
218
  apiPages.push(page);
@@ -301,7 +319,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
301
319
  distDir: path_1.default.relative(projectDir, path_1.default.join(entryPath, outputDirectory)),
302
320
  compress: false,
303
321
  })}`)
304
- .replace('__NEXT_SERVER_PATH__', `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
322
+ .replace('__NEXT_SERVER_PATH__', useBundledServer
323
+ ? BUNDLED_SERVER_NEXT_PATH
324
+ : `${(0, utils_1.getNextServerPath)(nextVersion)}/next-server.js`);
305
325
  const appLauncher = launcher.replace('// pre-next-server-target', `process.env.__NEXT_PRIVATE_PREBUNDLED_REACT = "${requiredServerFilesManifest.config?.experimental?.serverActions
306
326
  ? 'experimental'
307
327
  : 'next'}"`);
@@ -319,6 +339,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
319
339
  const mergedPageKeys = [
320
340
  ...nonApiPages,
321
341
  ...appRouterPages,
342
+ ...appRouteHandlers,
322
343
  ...apiPages,
323
344
  ...internalPages,
324
345
  ];
@@ -424,6 +445,9 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
424
445
  internalPages,
425
446
  pageExtensions,
426
447
  });
448
+ for (const group of pageLambdaGroups) {
449
+ group.isPages = true;
450
+ }
427
451
  const appRouterLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
428
452
  entryPath: projectDir,
429
453
  config,
@@ -439,12 +463,34 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
439
463
  internalPages,
440
464
  pageExtensions,
441
465
  });
466
+ const appRouteHandlersLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
467
+ entryPath: projectDir,
468
+ config,
469
+ functionsConfigManifest,
470
+ pages: appRouteHandlers,
471
+ prerenderRoutes,
472
+ pageTraces,
473
+ compressedPages,
474
+ tracedPseudoLayer: tracedPseudoLayer.pseudoLayer,
475
+ initialPseudoLayer,
476
+ lambdaCompressedByteLimit,
477
+ initialPseudoLayerUncompressed: uncompressedInitialSize,
478
+ internalPages,
479
+ pageExtensions,
480
+ });
442
481
  for (const group of appRouterLambdaGroups) {
443
482
  if (!group.isPrerenders) {
444
483
  group.isStreaming = true;
445
484
  }
446
485
  group.isAppRouter = true;
447
486
  }
487
+ for (const group of appRouteHandlersLambdaGroups) {
488
+ if (!group.isPrerenders) {
489
+ group.isStreaming = true;
490
+ }
491
+ group.isAppRouter = true;
492
+ group.isAppRouteHandler = true;
493
+ }
448
494
  const apiLambdaGroups = await (0, utils_1.getPageLambdaGroups)({
449
495
  entryPath: projectDir,
450
496
  config,
@@ -482,12 +528,19 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, functionsConfi
482
528
  pseudoLayerBytes: group.pseudoLayerBytes,
483
529
  uncompressedLayerBytes: group.pseudoLayerUncompressedBytes,
484
530
  })),
531
+ appRouteHandlersLambdaGroups: appRouteHandlersLambdaGroups.map(group => ({
532
+ pages: group.pages,
533
+ isPrerender: group.isPrerenders,
534
+ pseudoLayerBytes: group.pseudoLayerBytes,
535
+ uncompressedLayerBytes: group.pseudoLayerUncompressedBytes,
536
+ })),
485
537
  nextServerLayerSize: initialPseudoLayer.pseudoLayerBytes,
486
538
  }, null, 2));
487
539
  const combinedGroups = [
488
540
  ...pageLambdaGroups,
489
541
  ...appRouterLambdaGroups,
490
542
  ...apiLambdaGroups,
543
+ ...appRouteHandlersLambdaGroups,
491
544
  ];
492
545
  await (0, utils_1.detectLambdaLimitExceeding)(combinedGroups, lambdaCompressedByteLimit, compressedPages);
493
546
  for (const group of combinedGroups) {
package/dist/utils.js CHANGED
@@ -700,9 +700,11 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
700
700
  const { initialRevalidateSeconds, dataRoute, srcRoute } = manifest.routes[route];
701
701
  let initialStatus;
702
702
  let initialHeaders;
703
+ let experimentalBypassFor;
703
704
  if (manifest.version === 4) {
704
705
  initialStatus = manifest.routes[route].initialStatus;
705
706
  initialHeaders = manifest.routes[route].initialHeaders;
707
+ experimentalBypassFor = manifest.routes[route].experimentalBypassFor;
706
708
  }
707
709
  ret.staticRoutes[route] = {
708
710
  initialRevalidate: initialRevalidateSeconds === false
@@ -712,12 +714,19 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
712
714
  srcRoute,
713
715
  initialStatus,
714
716
  initialHeaders,
717
+ experimentalBypassFor,
715
718
  };
716
719
  });
717
720
  lazyRoutes.forEach(lazyRoute => {
718
721
  const { routeRegex, fallback, dataRoute, dataRouteRegex } = manifest.dynamicRoutes[lazyRoute];
722
+ let experimentalBypassFor;
723
+ if (manifest.version === 4) {
724
+ experimentalBypassFor =
725
+ manifest.dynamicRoutes[lazyRoute].experimentalBypassFor;
726
+ }
719
727
  if (typeof fallback === 'string') {
720
728
  ret.fallbackRoutes[lazyRoute] = {
729
+ experimentalBypassFor,
721
730
  routeRegex,
722
731
  fallback,
723
732
  dataRoute,
@@ -726,6 +735,7 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
726
735
  }
727
736
  else if (fallback === null) {
728
737
  ret.blockingFallbackRoutes[lazyRoute] = {
738
+ experimentalBypassFor,
729
739
  routeRegex,
730
740
  dataRoute,
731
741
  dataRouteRegex,
@@ -735,6 +745,7 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
735
745
  // Fallback behavior is disabled, all routes would've been provided
736
746
  // in the top-level `routes` key (`staticRoutes`).
737
747
  ret.omittedRoutes[lazyRoute] = {
748
+ experimentalBypassFor,
738
749
  routeRegex,
739
750
  dataRoute,
740
751
  dataRouteRegex,
@@ -1169,6 +1180,7 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
1169
1180
  let dataRoute;
1170
1181
  let initialStatus;
1171
1182
  let initialHeaders;
1183
+ let experimentalBypassFor;
1172
1184
  if (isFallback || isBlocking) {
1173
1185
  const pr = isFallback
1174
1186
  ? prerenderManifest.fallbackRoutes[routeKey]
@@ -1184,11 +1196,14 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
1184
1196
  }
1185
1197
  srcRoute = null;
1186
1198
  dataRoute = pr.dataRoute;
1199
+ experimentalBypassFor = pr.experimentalBypassFor;
1187
1200
  }
1188
1201
  else if (isOmitted) {
1189
1202
  initialRevalidate = false;
1190
1203
  srcRoute = routeKey;
1191
1204
  dataRoute = prerenderManifest.omittedRoutes[routeKey].dataRoute;
1205
+ experimentalBypassFor =
1206
+ prerenderManifest.omittedRoutes[routeKey].experimentalBypassFor;
1192
1207
  }
1193
1208
  else {
1194
1209
  const pr = prerenderManifest.staticRoutes[routeKey];
@@ -1198,6 +1213,7 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
1198
1213
  dataRoute,
1199
1214
  initialHeaders,
1200
1215
  initialStatus,
1216
+ experimentalBypassFor,
1201
1217
  } = pr);
1202
1218
  }
1203
1219
  let isAppPathRoute = false;
@@ -1375,6 +1391,7 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
1375
1391
  fallback: htmlFsRef,
1376
1392
  group: prerenderGroup,
1377
1393
  bypassToken: prerenderManifest.bypassToken,
1394
+ experimentalBypassFor,
1378
1395
  initialStatus,
1379
1396
  initialHeaders,
1380
1397
  sourcePath,
@@ -1400,6 +1417,7 @@ const onPrerenderRoute = (prerenderRouteArgs) => (routeKey, { isBlocking, isFall
1400
1417
  fallback: jsonFsRef,
1401
1418
  group: prerenderGroup,
1402
1419
  bypassToken: prerenderManifest.bypassToken,
1420
+ experimentalBypassFor,
1403
1421
  ...(isNotFound
1404
1422
  ? {
1405
1423
  initialStatus: 404,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",