@vercel/next 4.21.4 → 4.21.7

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.
@@ -9581,6 +9581,11 @@ function sha256(input) {
9581
9581
  function fallbackHasFilePath(fallback) {
9582
9582
  return fallback !== void 0 && "filePath" in fallback && typeof fallback.filePath === "string";
9583
9583
  }
9584
+ function getPostponedStateContentType(postponedState, originContentType) {
9585
+ return `application/x-nextjs-pre-render; state-length=${Buffer.byteLength(
9586
+ postponedState
9587
+ )}; origin=${JSON.stringify(originContentType)}`;
9588
+ }
9584
9589
  var copy = async (src, dest) => {
9585
9590
  await import_fs_extra3.default.remove(dest);
9586
9591
  await import_fs_extra3.default.copy(src, dest);
@@ -10059,13 +10064,19 @@ async function handlePrerenderOutputs(prerenderOutputs, {
10059
10064
  `${output.fallback.postponedState}${fallbackContent}`
10060
10065
  );
10061
10066
  const originContentType = isRscOutput ? rscContentType : "text/html; charset=utf-8";
10062
- initialHeaders["content-type"] = `application/x-nextjs-pre-render; state-length=${output.fallback.postponedState.length}; origin=${JSON.stringify(originContentType)}`;
10067
+ initialHeaders["content-type"] = getPostponedStateContentType(
10068
+ output.fallback.postponedState,
10069
+ originContentType
10070
+ );
10063
10071
  } else if (output.fallback?.postponedState && !fallbackHasFilePath(output.fallback) && prerenderFallbackPath) {
10064
10072
  await writeIfNotExists(
10065
10073
  prerenderFallbackPath,
10066
10074
  output.fallback.postponedState
10067
10075
  );
10068
- initialHeaders["content-type"] = `application/x-nextjs-pre-render; state-length=${output.fallback.postponedState.length}; origin=${JSON.stringify(rscContentType)}`;
10076
+ initialHeaders["content-type"] = getPostponedStateContentType(
10077
+ output.fallback.postponedState,
10078
+ rscContentType
10079
+ );
10069
10080
  }
10070
10081
  await import_promises.default.mkdir(import_node_path.default.dirname(prerenderConfigPath), { recursive: true });
10071
10082
  await writeIfNotExists(
package/dist/index.js CHANGED
@@ -11333,10 +11333,6 @@ function getMaxUncompressedLambdaSize(runtime) {
11333
11333
  }
11334
11334
  return runtime.startsWith("bun") ? DEFAULT_MAX_UNCOMPRESSED_LAMBDA_SIZE_BUN : DEFAULT_MAX_UNCOMPRESSED_LAMBDA_SIZE;
11335
11335
  }
11336
- var LARGE_FUNCTIONS_ENV = "NEXT_EXPERIMENTAL_LARGE_FUNCTIONS";
11337
- function isLargeFunctionsEnabled() {
11338
- return Boolean(process.env[LARGE_FUNCTIONS_ENV]);
11339
- }
11340
11336
  function getGroupMaxUncompressedLambdaSize(runtime, isLargeFunctions) {
11341
11337
  return isLargeFunctions ? DEFAULT_MAX_UNCOMPRESSED_LARGE_LAMBDA_SIZE : getMaxUncompressedLambdaSize(runtime);
11342
11338
  }
@@ -12339,7 +12335,6 @@ async function getPageLambdaGroups({
12339
12335
  nodeVersion
12340
12336
  }) {
12341
12337
  const groups = [];
12342
- const largeFunctionsEnabled = isLargeFunctionsEnabled();
12343
12338
  for (const page of pages) {
12344
12339
  const newPages = [...internalPages, page];
12345
12340
  const routeName = normalizePage(page.replace(/\.js$/, ""));
@@ -12393,7 +12388,7 @@ async function getPageLambdaGroups({
12393
12388
  }
12394
12389
  }
12395
12390
  let isLargeFunction = false;
12396
- if (largeFunctionsEnabled && !experimentalAllowBundling) {
12391
+ if (!experimentalAllowBundling) {
12397
12392
  let standaloneUncompressedSize = initialPseudoLayerUncompressed;
12398
12393
  const countedFiles = new Set(
12399
12394
  Object.keys(initialPseudoLayer.pseudoLayer)
@@ -12796,7 +12791,10 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12796
12791
  const html = import_fs_extra3.default.readFileSync(htmlPath, "utf8");
12797
12792
  initialHeaders ??= {};
12798
12793
  if (postponedState) {
12799
- initialHeaders["content-type"] = `application/x-nextjs-pre-render; state-length=${postponedState.length}; origin="text/html; charset=utf-8"`;
12794
+ initialHeaders["content-type"] = getPostponedStateContentType(
12795
+ postponedState,
12796
+ "text/html; charset=utf-8"
12797
+ );
12800
12798
  postponedPrerender = postponedState + html;
12801
12799
  didPostpone = true;
12802
12800
  } else {
@@ -13128,9 +13126,10 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
13128
13126
  } else {
13129
13127
  let contentType = rscContentTypeHeader;
13130
13128
  if (postponedState) {
13131
- contentType = `application/x-nextjs-pre-render; state-length=${postponedState.length}; origin=${JSON.stringify(
13129
+ contentType = getPostponedStateContentType(
13130
+ postponedState,
13132
13131
  rscContentTypeHeader
13133
- )}`;
13132
+ );
13134
13133
  }
13135
13134
  const rdcRSCAllowQuery = isAppClientParamParsingEnabled ? htmlAllowQuery : allowQuery;
13136
13135
  let fallback = null;
@@ -13985,6 +13984,11 @@ function normalizePrefetches(prefetches) {
13985
13984
  }
13986
13985
  return updatedPrefetches;
13987
13986
  }
13987
+ function getPostponedStateContentType(postponedState, originContentType) {
13988
+ return `application/x-nextjs-pre-render; state-length=${Buffer.byteLength(
13989
+ postponedState
13990
+ )}; origin=${JSON.stringify(originContentType)}`;
13991
+ }
13988
13992
  function getHTMLPostponedState({
13989
13993
  appDir,
13990
13994
  routeFileNoExt
@@ -16807,6 +16811,7 @@ var build = async (buildOptions) => {
16807
16811
  cliType,
16808
16812
  lockfileVersion,
16809
16813
  packageJsonPackageManager,
16814
+ nodeVersion,
16810
16815
  env: process.env,
16811
16816
  turboSupportsCorepackHome,
16812
16817
  projectCreatedAt: config.projectSettings?.createdAt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.21.4",
3
+ "version": "4.21.7",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -16,7 +16,7 @@
16
16
  "@vercel/nft": "1.10.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@next-community/adapter-vercel": "0.0.1-beta.26",
19
+ "@next-community/adapter-vercel": "0.0.1-beta.27",
20
20
  "@types/aws-lambda": "8.10.19",
21
21
  "@types/buffer-crc32": "0.2.0",
22
22
  "@types/bytes": "3.1.1",
@@ -54,8 +54,8 @@
54
54
  "vite": "6.4.3",
55
55
  "vitest": "4.1.10",
56
56
  "webpack-sources": "3.2.3",
57
- "@vercel/build-utils": "14.1.0",
58
- "@vercel/routing-utils": "6.5.0"
57
+ "@vercel/routing-utils": "6.5.0",
58
+ "@vercel/build-utils": "14.2.0"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "node build.mjs",
@@ -65,6 +65,7 @@
65
65
  "test-next-local-legacy": "vitest run --config ../../vitest.config.mts test/integration/legacy/*.test.js",
66
66
  "test-next-local:middleware": "vitest run --config ../../vitest.config.mts test/integration/middleware.test.ts",
67
67
  "test-e2e": "rm -f test/builder-info.json; vitest run --config ../../vitest.config.mts test/fixtures/ --exclude test/fixtures/00-bun-runtime/index.test.ts",
68
+ "test-e2e-builder": "pnpm run test-e2e",
68
69
  "type-check": "tsc --noEmit"
69
70
  }
70
71
  }