@netlify/plugin-nextjs 4.37.2 → 4.37.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.
@@ -315,7 +315,6 @@ const writeEdgeFunctions = async ({ netlifyConfig, routesManifest, }) => {
315
315
  if (usesEdge) {
316
316
  console.log((0, outdent_1.outdent) `
317
317
  ✨ Deploying middleware and functions to ${(0, chalk_1.greenBright) `Netlify Edge Functions`} ✨
318
- This feature is in beta. Please share your feedback here: https://ntl.fyi/next-netlify-edge
319
318
  `);
320
319
  }
321
320
  await (0, fs_extra_1.writeJson)((0, path_1.join)(edgeFunctionRoot, 'manifest.json'), manifest);
@@ -152,8 +152,13 @@ const setupImageFunction = async ({ constants: { INTERNAL_FUNCTIONS_SRC, FUNCTIO
152
152
  };
153
153
  exports.setupImageFunction = setupImageFunction;
154
154
  const traceRequiredServerFiles = async (publish) => {
155
- const { files, relativeAppDir, config: { experimental: { outputFileTracingRoot }, }, } = await (0, config_1.getRequiredServerFiles)(publish);
156
- const appDirRoot = (0, pathe_1.join)(outputFileTracingRoot, relativeAppDir);
155
+ var _a, _b, _c;
156
+ const requiredServerFiles = await (0, config_1.getRequiredServerFiles)(publish);
157
+ let appDirRoot = (_a = requiredServerFiles.appDir) !== null && _a !== void 0 ? _a : (0, pathe_1.join)(publish, '..');
158
+ if (requiredServerFiles.relativeAppDir && ((_b = requiredServerFiles.config) === null || _b === void 0 ? void 0 : _b.experimental.outputFileTracingRoot)) {
159
+ appDirRoot = (0, pathe_1.join)(requiredServerFiles.config.experimental.outputFileTracingRoot, requiredServerFiles.relativeAppDir);
160
+ }
161
+ const files = (_c = requiredServerFiles.files) !== null && _c !== void 0 ? _c : [];
157
162
  const absoluteFiles = files.map((file) => (0, pathe_1.join)(appDirRoot, file));
158
163
  absoluteFiles.push((0, pathe_1.join)(publish, 'required-server-files.json'));
159
164
  return absoluteFiles;
@@ -87,6 +87,15 @@ const makeHandler = ({ conf, app, pageRoot, NextServer, staticManifest = [], mod
87
87
  // Next expects to be able to parse the query from the URL
88
88
  const query = new URLSearchParams(event.queryStringParameters).toString();
89
89
  event.path = query ? `${event.path}?${query}` : event.path;
90
+ if (event.headers['accept-language'] && (mode === 'odb' || event.headers['x-next-just-first-accept-language'])) {
91
+ // keep just first language to match Netlify redirect limitation:
92
+ // https://docs.netlify.com/routing/redirects/redirect-options/#redirect-by-country-or-language
93
+ // > Language-based redirects always match against the first language reported by the browser in the Accept-Language header regardless of quality value weighting.
94
+ // If we wouldn't keep just first language, it's possible for `next-server` to generate locale redirect that could be cached by ODB
95
+ // because it matches on every language listed: https://github.com/vercel/next.js/blob/5d9597879c46b383d595d6f7b37fd373325b7544/test/unit/accept-headers.test.ts
96
+ // 'x-next-just-first-accept-language' header is escape hatch to be able to hit this code for tests (both automated and manual)
97
+ event.headers['accept-language'] = event.headers['accept-language'].replace(/\s*,.*$/, '');
98
+ }
90
99
  const { headers, ...result } = await getBridge(event, context).launcher(event, context);
91
100
  // Convert all headers to multiValueHeaders
92
101
  const multiValueHeaders = getMultiValueHeaders(headers);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "4.37.2",
3
+ "version": "4.37.4",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@delucis/if-env": "^1.1.2",
40
- "@netlify/build": "^29.11.5",
40
+ "@netlify/build": "^29.11.6",
41
41
  "@types/fs-extra": "^9.0.13",
42
42
  "@types/jest": "^27.4.1",
43
43
  "@types/merge-stream": "^1.1.2",