@vercel/next 4.21.2 → 4.21.4

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.
@@ -10624,6 +10624,9 @@ var myAdapter = {
10624
10624
  if (process.env.VERCEL_HASH_SALT != null) {
10625
10625
  config.experimental.outputHashSalt = (config.experimental.outputHashSalt ?? "") + process.env.VERCEL_HASH_SALT;
10626
10626
  }
10627
+ if (ctx.phase === import_constants2.PHASE_PRODUCTION_BUILD && process.env.VERCEL_SKEW_PROTECTION_ENABLED === "1" && process.env.VERCEL_DEPLOYMENT_ID && !process.env.NEXT_DEPLOYMENT_ID && config.deploymentId == null) {
10628
+ config.deploymentId = process.env.VERCEL_DEPLOYMENT_ID;
10629
+ }
10627
10630
  if (ctx.phase === import_constants2.PHASE_PRODUCTION_BUILD && process.env.VERCEL_PREVIEW_COMMENTS_ENABLED === "1" && // Only available in newer Next.js versions
10628
10631
  typeof ctx.projectDir !== "undefined") {
10629
10632
  const dir = import_node_path2.default.join(ctx.projectDir, ".vercel/");
@@ -33,7 +33,17 @@ const getHandlerSource = (ctx) => `
33
33
  );
34
34
  loadEnvConfig('.', process.env.NODE_ENV === 'development');
35
35
  }
36
-
36
+
37
+ // Default NEXT_DEPLOYMENT_ID for Skew Protection when the platform did not
38
+ // inject it (e.g. services deployments).
39
+ if (
40
+ process.env.VERCEL_SKEW_PROTECTION_ENABLED === '1' &&
41
+ process.env.VERCEL_DEPLOYMENT_ID &&
42
+ !process.env.NEXT_DEPLOYMENT_ID
43
+ ) {
44
+ process.env.NEXT_DEPLOYMENT_ID = process.env.VERCEL_DEPLOYMENT_ID;
45
+ }
46
+
37
47
  const _n_handler = (${ctx.isMiddleware ? () => {
38
48
  const path = require("path");
39
49
  const relativeDistDir = process.env.__PRIVATE_RELATIVE_DIST_DIR;
@@ -276,15 +286,15 @@ const getHandlerSource = (ctx) => `
276
286
  }
277
287
  };
278
288
  }).toString()})()
279
-
289
+
280
290
  module.exports = _n_handler
281
-
291
+
282
292
  ${ctx.isMiddleware ? "" : `
283
293
  module.exports.getRequestHandlerWithMetadata = (metadata) => {
284
294
  return (req, res) => _n_handler(req, res, metadata)
285
295
  }
286
296
  `}
287
-
297
+
288
298
  `.replaceAll(
289
299
  "process.env.__PRIVATE_RELATIVE_DIST_DIR",
290
300
  `"${ctx.projectRelativeDistDir}"`
package/dist/index.js CHANGED
@@ -11340,6 +11340,12 @@ function isLargeFunctionsEnabled() {
11340
11340
  function getGroupMaxUncompressedLambdaSize(runtime, isLargeFunctions) {
11341
11341
  return isLargeFunctions ? DEFAULT_MAX_UNCOMPRESSED_LARGE_LAMBDA_SIZE : getMaxUncompressedLambdaSize(runtime);
11342
11342
  }
11343
+ function getDefaultNextDeploymentId(env) {
11344
+ if (env.VERCEL_SKEW_PROTECTION_ENABLED === "1" && env.VERCEL_DEPLOYMENT_ID && !env.NEXT_DEPLOYMENT_ID) {
11345
+ return env.VERCEL_DEPLOYMENT_ID;
11346
+ }
11347
+ return void 0;
11348
+ }
11343
11349
  var skipDefaultLocaleRewrite = Boolean(
11344
11350
  process.env.NEXT_EXPERIMENTAL_DEFER_DEFAULT_LOCALE_REWRITE
11345
11351
  );
@@ -16960,12 +16966,18 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
16960
16966
  if (isServerMode) {
16961
16967
  env.NODE_ENV = "production";
16962
16968
  }
16963
- if (
16969
+ const isAdapterEnabled = (
16964
16970
  // integration tests expect outputs object
16965
16971
  !process.env.NEXT_BUILDER_INTEGRATION && process.env.NEXT_ENABLE_ADAPTER === "1" && import_semver5.default.gte(nextVersion, MINIMUM_NEXT_ADAPTER_VERSION)
16966
- ) {
16972
+ );
16973
+ if (isAdapterEnabled) {
16967
16974
  env.NEXT_ADAPTER_PATH = import_path6.default.join(__dirname, "adapter/index.js");
16968
16975
  env.NEXT_ADAPTER_VERCEL_CONFIG = JSON.stringify(config);
16976
+ } else {
16977
+ const defaultNextDeploymentId = getDefaultNextDeploymentId(env);
16978
+ if (defaultNextDeploymentId) {
16979
+ env.NEXT_DEPLOYMENT_ID = defaultNextDeploymentId;
16980
+ }
16969
16981
  }
16970
16982
  const shouldRunCompileStep = Boolean(buildCommand) || Boolean(buildScriptName);
16971
16983
  builderSpan.setAttributes({
@@ -42,6 +42,9 @@ if (process.env.NODE_ENV !== "production" && region !== "dev1") {
42
42
  );
43
43
  process.env.NODE_ENV = "production";
44
44
  }
45
+ if (process.env.VERCEL_SKEW_PROTECTION_ENABLED === "1" && process.env.VERCEL_DEPLOYMENT_ID && !process.env.NEXT_DEPLOYMENT_ID) {
46
+ process.env.NEXT_DEPLOYMENT_ID = process.env.VERCEL_DEPLOYMENT_ID;
47
+ }
45
48
  // @preserve pre-next-server-target
46
49
  var NextServer = require("__NEXT_SERVER_PATH__").default;
47
50
  // @preserve next-server-preload-target
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.21.2",
3
+ "version": "4.21.4",
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.24",
19
+ "@next-community/adapter-vercel": "0.0.1-beta.26",
20
20
  "@types/aws-lambda": "8.10.19",
21
21
  "@types/buffer-crc32": "0.2.0",
22
22
  "@types/bytes": "3.1.1",
@@ -51,10 +51,11 @@
51
51
  "source-map": "0.7.4",
52
52
  "test-listen": "1.1.0",
53
53
  "text-table": "0.2.0",
54
- "vitest": "2.0.3",
54
+ "vite": "6.4.3",
55
+ "vitest": "4.1.10",
55
56
  "webpack-sources": "3.2.3",
56
- "@vercel/routing-utils": "6.4.1",
57
- "@vercel/build-utils": "14.0.3"
57
+ "@vercel/build-utils": "14.1.0",
58
+ "@vercel/routing-utils": "6.5.0"
58
59
  },
59
60
  "scripts": {
60
61
  "build": "node build.mjs",