@netlify/plugin-nextjs 4.12.2 → 4.13.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.
@@ -66,9 +66,19 @@ const checkForOldFunctions = async ({ functions }) => {
66
66
  exports.checkForOldFunctions = checkForOldFunctions;
67
67
  const checkNextSiteHasBuilt = ({ publish, failBuild, }) => {
68
68
  if (!(0, fs_1.existsSync)(path_1.default.join(publish, 'BUILD_ID'))) {
69
- const outWarning = path_1.default.basename(publish) === 'out'
70
- ? `Your publish directory is set to "out", but in most cases it should be ".next".`
71
- : `In most cases it should be set to ".next", unless you have chosen a custom "distDir" in your Next config.`;
69
+ let outWarning;
70
+ if (path_1.default.basename(publish) === 'out') {
71
+ outWarning = `Your publish directory is set to "out", but in most cases it should be ".next".`;
72
+ }
73
+ else if (path_1.default.basename(publish) !== '.next' && (0, fs_1.existsSync)(path_1.default.join('.next', 'BUILD_ID'))) {
74
+ outWarning = (0, outdent_1.outdent) `
75
+ However, a '.next' directory was found with a production build.
76
+ Consider changing your 'publish' directory to '.next'
77
+ `;
78
+ }
79
+ else {
80
+ outWarning = `In most cases it should be set to ".next", unless you have chosen a custom "distDir" in your Next config.`;
81
+ }
72
82
  return failBuild((0, outdent_1.outdent) `
73
83
  The directory "${publish}" does not contain a Next.js production build. Perhaps the build command was not run, or you specified the wrong publish directory.
74
84
  ${outWarning}
@@ -76,7 +86,7 @@ const checkNextSiteHasBuilt = ({ publish, failBuild, }) => {
76
86
  `);
77
87
  }
78
88
  if ((0, fs_1.existsSync)(path_1.default.join(publish, 'export-detail.json'))) {
79
- failBuild((0, outdent_1.outdent) `
89
+ return failBuild((0, outdent_1.outdent) `
80
90
  Detected that "next export" was run, but site is incorrectly publishing the ".next" directory.
81
91
  The publish directory should be set to "out", and you should set the environment variable NETLIFY_NEXT_PLUGIN_SKIP to "true".
82
92
  `);
@@ -102,7 +102,7 @@ const makeHandler = (conf, app, pageRoot, staticManifest = [], mode = 'ssr') =>
102
102
  multiValueHeaders['cache-control'] = ['public, max-age=0, must-revalidate'];
103
103
  }
104
104
  multiValueHeaders['x-render-mode'] = [requestMode];
105
- console.log(`[${event.httpMethod}] ${event.path} (${requestMode === null || requestMode === void 0 ? void 0 : requestMode.toUpperCase()})`);
105
+ console.log(`[${event.httpMethod}] ${event.path} (${requestMode === null || requestMode === void 0 ? void 0 : requestMode.toUpperCase()}${result.ttl > 0 ? ` ${result.ttl}s` : ''})`);
106
106
  return {
107
107
  ...result,
108
108
  multiValueHeaders,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "4.12.2",
3
+ "version": "4.13.0",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@delucis/if-env": "^1.1.2",
31
- "@netlify/build": "^27.3.3",
31
+ "@netlify/build": "^27.4.2",
32
32
  "@types/fs-extra": "^9.0.13",
33
33
  "@types/jest": "^27.4.1",
34
34
  "@types/node": "^17.0.25",