@netlify/plugin-nextjs 4.11.0 → 4.12.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "4.11.0",
3
+ "version": "4.12.0",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@netlify/functions": "^1.0.0",
13
- "@netlify/ipx": "^1.1.2",
13
+ "@netlify/ipx": "^1.1.3",
14
14
  "@vercel/node-bridge": "^2.1.0",
15
15
  "chalk": "^4.1.2",
16
16
  "fs-extra": "^10.0.0",
@@ -22,13 +22,13 @@
22
22
  "p-limit": "^3.1.0",
23
23
  "pathe": "^0.2.0",
24
24
  "pretty-bytes": "^5.6.0",
25
- "semver": "^7.3.5",
26
25
  "slash": "^3.0.0",
26
+ "semver": "^7.3.5",
27
27
  "tiny-glob": "^0.2.9"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@delucis/if-env": "^1.1.2",
31
- "@netlify/build": "^27.3.1",
31
+ "@netlify/build": "^27.3.3",
32
32
  "@types/fs-extra": "^9.0.13",
33
33
  "@types/jest": "^27.4.1",
34
34
  "@types/node": "^17.0.25",
@@ -1,11 +1,16 @@
1
1
  import { Accepts } from "https://deno.land/x/accepts@2.1.1/mod.ts";
2
2
  import type { Context } from "netlify:edge";
3
+ // Available at build time
3
4
  import imageconfig from "../functions-internal/_ipx/imageconfig.json" assert {
4
5
  type: "json",
5
6
  };
6
7
 
7
8
  const defaultFormat = "webp"
8
9
 
10
+ interface ImageConfig extends Record<string, unknown> {
11
+ formats?: string[];
12
+ }
13
+
9
14
  /**
10
15
  * Implement content negotiation for images
11
16
  */
@@ -14,7 +19,7 @@ const defaultFormat = "webp"
14
19
  const handler = async (req: Request, context: Context) => {
15
20
  const { searchParams } = new URL(req.url);
16
21
  const accept = new Accepts(req.headers);
17
- const { formats = [defaultFormat] } = imageconfig;
22
+ const { formats = [defaultFormat] } = imageconfig as ImageConfig;
18
23
  if (formats.length === 0) {
19
24
  formats.push(defaultFormat);
20
25
  }
@@ -47,7 +47,7 @@ const handler = async (req: Request, context: Context) => {
47
47
  },
48
48
  url: url.toString(),
49
49
  method: req.method,
50
- ip: req.headers.get('x-nf-client-address') ?? undefined,
50
+ ip: context.ip,
51
51
  body: req.body ?? undefined,
52
52
  }
53
53