@netlify/plugin-nextjs 4.9.3 → 4.10.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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateConfig = exports.writeEdgeFunctions = void 0;
3
+ exports.updateConfig = exports.writeEdgeFunctions = exports.loadMiddlewareManifest = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const path_1 = require("path");
6
6
  const fs_extra_1 = require("fs-extra");
@@ -11,6 +11,7 @@ const loadMiddlewareManifest = (netlifyConfig) => {
11
11
  }
12
12
  return (0, fs_extra_1.readJson)(middlewarePath);
13
13
  };
14
+ exports.loadMiddlewareManifest = loadMiddlewareManifest;
14
15
  /**
15
16
  * Convert the Next middleware name into a valid Edge Function name
16
17
  */
@@ -69,7 +70,7 @@ const writeEdgeFunction = async ({ edgeFunctionDefinition, edgeFunctionRoot, net
69
70
  * Writes Edge Functions for the Next middleware
70
71
  */
71
72
  const writeEdgeFunctions = async (netlifyConfig) => {
72
- const middlewareManifest = await loadMiddlewareManifest(netlifyConfig);
73
+ const middlewareManifest = await (0, exports.loadMiddlewareManifest)(netlifyConfig);
73
74
  if (!middlewareManifest) {
74
75
  console.error("Couldn't find the middleware manifest");
75
76
  return;
package/lib/index.js CHANGED
@@ -93,6 +93,14 @@ const plugin = {
93
93
  await (0, edge_1.writeEdgeFunctions)(netlifyConfig);
94
94
  await (0, edge_1.updateConfig)(publish);
95
95
  }
96
+ const middlewareManifest = await (0, edge_1.loadMiddlewareManifest)(netlifyConfig);
97
+ if (!process.env.NEXT_USE_NETLIFY_EDGE && middlewareManifest.sortedMiddleware.length !== 0) {
98
+ console.log((0, chalk_1.yellowBright)((0, outdent_1.outdent) `
99
+ You are using Next.js Middleware without Netlify Edge Functions.
100
+ This will soon be deprecated because it negatively affects performance and will disable ISR and static rendering.
101
+ To get the best performance and use Netlify Edge Functions, set the env var ${(0, chalk_1.bold) `NEXT_USE_NETLIFY_EDGE=true`}.
102
+ `));
103
+ }
96
104
  },
97
105
  async onPostBuild({ netlifyConfig: { build: { publish }, redirects, headers, }, utils: { status, cache, functions, build: { failBuild }, }, constants: { FUNCTIONS_DIST }, }) {
98
106
  await (0, cache_1.saveCache)({ cache, publish });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "4.9.3",
3
+ "version": "4.10.0",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -28,11 +28,11 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@delucis/if-env": "^1.1.2",
31
- "@netlify/build": "^27.2.0",
31
+ "@netlify/build": "^27.3.1",
32
32
  "@types/fs-extra": "^9.0.13",
33
33
  "@types/jest": "^27.4.1",
34
34
  "@types/node": "^17.0.25",
35
- "next": "^12.1.7-canary.33",
35
+ "next": "^12.2.0",
36
36
  "npm-run-all": "^4.1.5",
37
37
  "typescript": "^4.6.3"
38
38
  },