@vercel/next 4.14.1 → 4.15.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 +41 -20
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -10924,6 +10924,7 @@ var KIB = 1024;
10924
10924
  var MIB = 1024 * KIB;
10925
10925
  var EDGE_FUNCTION_SIZE_LIMIT = 4 * MIB;
10926
10926
  var DEFAULT_MAX_UNCOMPRESSED_LAMBDA_SIZE = 250 * MIB;
10927
+ var DEFAULT_MAX_UNCOMPRESSED_LAMBDA_SIZE_BUN = 150 * MIB;
10927
10928
  var LAMBDA_RESERVED_UNCOMPRESSED_SIZE = 25 * MIB;
10928
10929
  var INTERNAL_PAGES = ["_app.js", "_error.js", "_document.js"];
10929
10930
 
@@ -11115,9 +11116,12 @@ function getAppRouterPathnameFilesMap(files) {
11115
11116
  var require_ = (0, import_module.createRequire)(__filename);
11116
11117
  var RSC_CONTENT_TYPE = "x-component";
11117
11118
  var RSC_PREFETCH_SUFFIX = ".prefetch.rsc";
11118
- var MAX_UNCOMPRESSED_LAMBDA_SIZE = !isNaN(
11119
- Number(process.env.MAX_UNCOMPRESSED_LAMBDA_SIZE)
11120
- ) ? Number(process.env.MAX_UNCOMPRESSED_LAMBDA_SIZE) : DEFAULT_MAX_UNCOMPRESSED_LAMBDA_SIZE;
11119
+ function getMaxUncompressedLambdaSize(runtime) {
11120
+ if (!isNaN(Number(process.env.MAX_UNCOMPRESSED_LAMBDA_SIZE))) {
11121
+ return Number(process.env.MAX_UNCOMPRESSED_LAMBDA_SIZE);
11122
+ }
11123
+ return runtime.startsWith("bun") ? DEFAULT_MAX_UNCOMPRESSED_LAMBDA_SIZE_BUN : DEFAULT_MAX_UNCOMPRESSED_LAMBDA_SIZE;
11124
+ }
11121
11125
  var skipDefaultLocaleRewrite = Boolean(
11122
11126
  process.env.NEXT_EXPERIMENTAL_DEFER_DEFAULT_LOCALE_REWRITE
11123
11127
  );
@@ -12075,7 +12079,8 @@ async function getPageLambdaGroups({
12075
12079
  pageExtensions,
12076
12080
  inversedAppPathManifest,
12077
12081
  experimentalAllowBundling,
12078
- isRouteHandlers
12082
+ isRouteHandlers,
12083
+ nodeVersion
12079
12084
  }) {
12080
12085
  const groups = [];
12081
12086
  for (const page of pages) {
@@ -12140,7 +12145,10 @@ async function getPageLambdaGroups({
12140
12145
  });
12141
12146
  newTracedFilesUncompressedSize += compressedPages[newPage].uncompressedSize;
12142
12147
  }
12143
- const underUncompressedLimit = newTracedFilesUncompressedSize < MAX_UNCOMPRESSED_LAMBDA_SIZE - LAMBDA_RESERVED_UNCOMPRESSED_SIZE;
12148
+ const maxLambdaSize = getMaxUncompressedLambdaSize(
12149
+ nodeVersion.runtime
12150
+ );
12151
+ const underUncompressedLimit = newTracedFilesUncompressedSize < maxLambdaSize - LAMBDA_RESERVED_UNCOMPRESSED_SIZE;
12144
12152
  return underUncompressedLimit;
12145
12153
  }
12146
12154
  return false;
@@ -12259,13 +12267,14 @@ var outputFunctionFileSizeInfo = (pages, pseudoLayer, pseudoLayerUncompressedByt
12259
12267
  })
12260
12268
  );
12261
12269
  };
12262
- var detectLambdaLimitExceeding = async (lambdaGroups, compressedPages) => {
12263
- const UNCOMPRESSED_SIZE_LIMIT_CLOSE = MAX_UNCOMPRESSED_LAMBDA_SIZE - 5 * MIB;
12270
+ var detectLambdaLimitExceeding = async (lambdaGroups, compressedPages, runtime) => {
12271
+ const maxLambdaSize = getMaxUncompressedLambdaSize(runtime);
12272
+ const UNCOMPRESSED_SIZE_LIMIT_CLOSE = maxLambdaSize - 5 * MIB;
12264
12273
  let numExceededLimit = 0;
12265
12274
  let numCloseToLimit = 0;
12266
12275
  let loggedHeadInfo = false;
12267
12276
  const filteredGroups = lambdaGroups.filter((group) => {
12268
- const exceededLimit = group.pseudoLayerUncompressedBytes > MAX_UNCOMPRESSED_LAMBDA_SIZE;
12277
+ const exceededLimit = group.pseudoLayerUncompressedBytes > maxLambdaSize;
12269
12278
  const closeToLimit = group.pseudoLayerUncompressedBytes > UNCOMPRESSED_SIZE_LIMIT_CLOSE;
12270
12279
  if (closeToLimit || exceededLimit || (0, import_build_utils.getPlatformEnv)("BUILDER_DEBUG") || process.env.NEXT_DEBUG_FUNCTION_SIZE) {
12271
12280
  if (exceededLimit) {
@@ -12282,7 +12291,7 @@ var detectLambdaLimitExceeding = async (lambdaGroups, compressedPages) => {
12282
12291
  if (numExceededLimit || numCloseToLimit) {
12283
12292
  console.log(
12284
12293
  `Warning: Max serverless function size of ${prettyBytes(
12285
- MAX_UNCOMPRESSED_LAMBDA_SIZE
12294
+ maxLambdaSize
12286
12295
  )} uncompressed${numExceededLimit ? "" : " almost"} reached`
12287
12296
  );
12288
12297
  } else {
@@ -14622,10 +14631,11 @@ async function serverBuild({
14622
14631
  2
14623
14632
  )
14624
14633
  );
14625
- if (uncompressedInitialSize > MAX_UNCOMPRESSED_LAMBDA_SIZE) {
14634
+ const maxLambdaSize = getMaxUncompressedLambdaSize(nodeVersion.runtime);
14635
+ if (uncompressedInitialSize > maxLambdaSize) {
14626
14636
  console.log(
14627
14637
  `Warning: Max serverless function size of ${(0, import_pretty_bytes3.default)(
14628
- MAX_UNCOMPRESSED_LAMBDA_SIZE
14638
+ maxLambdaSize
14629
14639
  )} uncompressed reached`
14630
14640
  );
14631
14641
  outputFunctionFileSizeInfo(
@@ -14635,7 +14645,7 @@ async function serverBuild({
14635
14645
  {}
14636
14646
  );
14637
14647
  throw new import_build_utils2.NowBuildError({
14638
- message: `Required files read using Node.js fs library and node_modules exceed max lambda size of ${MAX_UNCOMPRESSED_LAMBDA_SIZE} bytes`,
14648
+ message: `Required files read using Node.js fs library and node_modules exceed max lambda size of ${maxLambdaSize} bytes`,
14639
14649
  code: "NEXT_REQUIRED_FILES_LIMIT",
14640
14650
  link: "https://vercel.com/docs/platform/limits#serverless-function-size"
14641
14651
  });
@@ -14797,7 +14807,8 @@ ${JSON.stringify(
14797
14807
  initialPseudoLayer,
14798
14808
  initialPseudoLayerUncompressed: uncompressedInitialSize,
14799
14809
  internalPages,
14800
- pageExtensions
14810
+ pageExtensions,
14811
+ nodeVersion
14801
14812
  });
14802
14813
  for (const group of pageLambdaGroups) {
14803
14814
  group.isPages = true;
@@ -14817,7 +14828,8 @@ ${JSON.stringify(
14817
14828
  initialPseudoLayerUncompressed: uncompressedInitialSize,
14818
14829
  internalPages,
14819
14830
  pageExtensions,
14820
- inversedAppPathManifest
14831
+ inversedAppPathManifest,
14832
+ nodeVersion
14821
14833
  });
14822
14834
  const appRouteHandlersLambdaGroups = await getPageLambdaGroups({
14823
14835
  experimentalAllowBundling,
@@ -14835,7 +14847,8 @@ ${JSON.stringify(
14835
14847
  internalPages,
14836
14848
  pageExtensions,
14837
14849
  inversedAppPathManifest,
14838
- isRouteHandlers: true
14850
+ isRouteHandlers: true,
14851
+ nodeVersion
14839
14852
  });
14840
14853
  const appRouterStreamingActionLambdaGroups = [];
14841
14854
  for (const group of appRouterLambdaGroups) {
@@ -14862,7 +14875,8 @@ ${JSON.stringify(
14862
14875
  initialPseudoLayer,
14863
14876
  initialPseudoLayerUncompressed: uncompressedInitialSize,
14864
14877
  internalPages,
14865
- pageExtensions
14878
+ pageExtensions,
14879
+ nodeVersion
14866
14880
  });
14867
14881
  for (const group of apiLambdaGroups) {
14868
14882
  group.isApiLambda = true;
@@ -14925,7 +14939,11 @@ ${JSON.stringify(
14925
14939
  ...apiLambdaGroups,
14926
14940
  ...appRouteHandlersLambdaGroups
14927
14941
  ];
14928
- await detectLambdaLimitExceeding(combinedGroups, compressedPages);
14942
+ await detectLambdaLimitExceeding(
14943
+ combinedGroups,
14944
+ compressedPages,
14945
+ nodeVersion.runtime
14946
+ );
14929
14947
  const appNotFoundTraces = pageTraces["_not-found.js"];
14930
14948
  const appNotFoundPsuedoLayer = appNotFoundTraces && await createPseudoLayer(appNotFoundTraces);
14931
14949
  for (const group of combinedGroups) {
@@ -17428,7 +17446,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17428
17446
  // internal pages are already referenced in traces for serverless
17429
17447
  // like builds
17430
17448
  internalPages: [],
17431
- experimentalPPRRoutes: void 0
17449
+ experimentalPPRRoutes: void 0,
17450
+ nodeVersion
17432
17451
  });
17433
17452
  const initialApiLambdaGroups = await getPageLambdaGroups({
17434
17453
  entryPath,
@@ -17442,7 +17461,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17442
17461
  initialPseudoLayer: { pseudoLayer: {}, pseudoLayerBytes: 0 },
17443
17462
  initialPseudoLayerUncompressed: 0,
17444
17463
  internalPages: [],
17445
- experimentalPPRRoutes: void 0
17464
+ experimentalPPRRoutes: void 0,
17465
+ nodeVersion
17446
17466
  });
17447
17467
  for (const group of initialApiLambdaGroups) {
17448
17468
  group.isApiLambda = true;
@@ -17471,7 +17491,8 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17471
17491
  ];
17472
17492
  await detectLambdaLimitExceeding(
17473
17493
  combinedInitialLambdaGroups,
17474
- compressedPages
17494
+ compressedPages,
17495
+ nodeVersion.runtime
17475
17496
  );
17476
17497
  let apiLambdaGroupIndex = 0;
17477
17498
  let nonApiLambdaGroupIndex = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.14.1",
3
+ "version": "4.15.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": "12.2.0",
33
+ "@vercel/build-utils": "12.2.3",
34
34
  "@vercel/routing-utils": "5.2.1",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",