@netlify/plugin-nextjs 4.23.2 → 4.23.3

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.
@@ -5,6 +5,7 @@ exports.enableEdgeInNextConfig = exports.writeEdgeFunctions = exports.writeDevEd
5
5
  const fs_1 = require("fs");
6
6
  const path_1 = require("path");
7
7
  const fs_extra_1 = require("fs-extra");
8
+ const config_1 = require("./config");
8
9
  const loadMiddlewareManifest = (netlifyConfig) => {
9
10
  const middlewarePath = (0, path_1.resolve)(netlifyConfig.build.publish, 'server', 'middleware-manifest.json');
10
11
  if (!(0, fs_1.existsSync)(middlewarePath)) {
@@ -107,6 +108,10 @@ const writeEdgeFunctions = async (netlifyConfig) => {
107
108
  const edgeFunctionRoot = (0, path_1.resolve)('.netlify', 'edge-functions');
108
109
  await (0, fs_extra_1.emptyDir)(edgeFunctionRoot);
109
110
  await (0, fs_extra_1.copy)(getEdgeTemplatePath('../edge-shared'), (0, path_1.join)(edgeFunctionRoot, 'edge-shared'));
111
+ const { publish } = netlifyConfig.build;
112
+ const nextConfigFile = await (0, config_1.getRequiredServerFiles)(publish);
113
+ const nextConfig = nextConfigFile.config;
114
+ await (0, fs_extra_1.writeJSON)((0, path_1.join)(edgeFunctionRoot, 'edge-shared', 'nextConfig.json'), nextConfig);
110
115
  if (!process.env.NEXT_DISABLE_EDGE_IMAGES) {
111
116
  console.log('Using Netlify Edge Functions for image format detection. Set env var "NEXT_DISABLE_EDGE_IMAGES=true" to disable.');
112
117
  const edgeFunctionDir = (0, path_1.join)(edgeFunctionRoot, 'ipx');
@@ -103,13 +103,13 @@ const makeHandler = (conf, app, pageRoot, staticManifest = [], mode = 'ssr') =>
103
103
  // Long-expiry TTL is basically no TTL, so we'll skip it
104
104
  if (ttl > 0 && ttl < ONE_YEAR_IN_SECONDS) {
105
105
  result.ttl = ttl;
106
- requestMode = 'isr';
106
+ requestMode = `odb ttl=${ttl}`;
107
107
  }
108
108
  }
109
109
  multiValueHeaders['cache-control'] = ['public, max-age=0, must-revalidate'];
110
110
  }
111
- multiValueHeaders['x-render-mode'] = [requestMode];
112
- console.log(`[${event.httpMethod}] ${event.path} (${requestMode === null || requestMode === void 0 ? void 0 : requestMode.toUpperCase()}${result.ttl > 0 ? ` ${result.ttl}s` : ''})`);
111
+ multiValueHeaders['x-nf-render-mode'] = [requestMode];
112
+ console.log(`[${event.httpMethod}] ${event.path} (${requestMode === null || requestMode === void 0 ? void 0 : requestMode.toUpperCase()})`);
113
113
  return {
114
114
  ...result,
115
115
  multiValueHeaders,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "4.23.2",
3
+ "version": "4.23.3",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -1,6 +1,7 @@
1
1
  import type { Context } from 'https://edge.netlify.com'
2
2
  // Available at build time
3
3
  import matchers from './matchers.json' assert { type: 'json' }
4
+ import nextConfig from '../edge-shared/nextConfig.json' assert { type: 'json' }
4
5
  import edgeFunction from './bundle.js'
5
6
  import { buildResponse } from '../edge-shared/utils.ts'
6
7
  import { getMiddlewareRouteMatcher, MiddlewareRouteMatch, searchParamsToUrlQuery } from '../edge-shared/next-utils.ts'
@@ -32,7 +33,7 @@ export interface RequestData {
32
33
  name?: string
33
34
  params?: { [key: string]: string }
34
35
  }
35
- url: string
36
+ url: URL
36
37
  body?: ReadableStream<Uint8Array>
37
38
  }
38
39
 
@@ -81,10 +82,11 @@ const handler = async (req: Request, context: Context) => {
81
82
  const request: RequestData = {
82
83
  headers: Object.fromEntries(req.headers.entries()),
83
84
  geo,
84
- url: url.toString(),
85
+ url,
85
86
  method: req.method,
86
87
  ip: context.ip,
87
88
  body: req.body ?? undefined,
89
+ nextConfig,
88
90
  }
89
91
 
90
92
  try {
File without changes