@netlify/plugin-nextjs 5.14.6 → 5.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.
@@ -534,7 +534,7 @@ var copyHandlerDependenciesForNodeMiddleware = async (ctx) => {
534
534
  const parts = [shim];
535
535
  const entry = "server/middleware.js";
536
536
  const nft = `${entry}.nft.json`;
537
- const nftFilesPath = join(process.cwd(), ctx.distDir, nft);
537
+ const nftFilesPath = join(ctx.publishDir, nft);
538
538
  const nftManifest = JSON.parse(await readFile(nftFilesPath, "utf8"));
539
539
  const files = nftManifest.files.map((file) => join("server", file));
540
540
  files.push(entry);
@@ -56,7 +56,8 @@ function shouldEnableSkewProtection(ctx) {
56
56
  enabledOrDisabledReason: "off-default" /* OPT_OUT_DEFAULT */
57
57
  };
58
58
  }
59
- if ((!process.env.DEPLOY_ID || process.env.DEPLOY_ID === "0") && optInOptions.has(enabledOrDisabledReason)) {
59
+ const token = process.env.NETLIFY_SKEW_PROTECTION_TOKEN || process.env.DEPLOY_ID;
60
+ if ((!token || token === "0") && optInOptions.has(enabledOrDisabledReason)) {
60
61
  return {
61
62
  enabled: false,
62
63
  enabledOrDisabledReason: enabledOrDisabledReason === "on-env-var" /* OPT_IN_ENV_VAR */ && ctx.constants.IS_LOCAL ? (
@@ -66,16 +67,18 @@ function shouldEnableSkewProtection(ctx) {
66
67
  // this is silent disablement to avoid spam logs for users opted in via feature flag
67
68
  // that don't explicitly opt in via env var
68
69
  "off-no-valid-deploy-id" /* OPT_OUT_NO_VALID_DEPLOY_ID */
69
- )
70
+ ),
71
+ token
70
72
  };
71
73
  }
72
74
  return {
73
75
  enabled: optInOptions.has(enabledOrDisabledReason),
74
- enabledOrDisabledReason
76
+ enabledOrDisabledReason,
77
+ token
75
78
  };
76
79
  }
77
80
  var setSkewProtection = async (ctx, span) => {
78
- const { enabled, enabledOrDisabledReason } = shouldEnableSkewProtection(ctx);
81
+ const { enabled, enabledOrDisabledReason, token } = shouldEnableSkewProtection(ctx);
79
82
  span.setAttribute("skewProtection", enabledOrDisabledReason);
80
83
  if (!enabled) {
81
84
  if (enabledOrDisabledReason === "off-no-valid-deploy-id-env-var" /* OPT_OUT_NO_VALID_DEPLOY_ID_ENV_VAR */) {
@@ -92,7 +95,7 @@ var setSkewProtection = async (ctx, span) => {
92
95
  } else {
93
96
  console.log("Setting up Next.js Skew Protection.");
94
97
  }
95
- process.env.NEXT_DEPLOYMENT_ID = process.env.DEPLOY_ID;
98
+ process.env.NEXT_DEPLOYMENT_ID = token;
96
99
  await mkdir(dirname(ctx.skewProtectionConfigPath), {
97
100
  recursive: true
98
101
  });
@@ -86,7 +86,7 @@ var pipeline = (0, import_util.promisify)(import_stream.pipeline);
86
86
 
87
87
  // package.json
88
88
  var name = "@netlify/plugin-nextjs";
89
- var version = "5.14.6";
89
+ var version = "5.15.0";
90
90
 
91
91
  // src/run/handlers/tags-handler.cts
92
92
  var import_storage = require("../storage/storage.cjs");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "5.14.6",
3
+ "version": "5.15.0",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",