@netlify/plugin-nextjs 5.9.2 → 5.9.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.
@@ -8,7 +8,7 @@ import "./chunk-OEQOKJGE.js";
8
8
 
9
9
  // package.json
10
10
  var name = "@netlify/plugin-nextjs";
11
- var version = "5.9.2";
11
+ var version = "5.9.3";
12
12
  var description = "Run Next.js seamlessly on Netlify";
13
13
  var main = "./dist/index.js";
14
14
  var type = "module";
@@ -203,7 +203,7 @@ var import_constants = require("next/dist/lib/constants.js");
203
203
 
204
204
  // package.json
205
205
  var name = "@netlify/plugin-nextjs";
206
- var version = "5.9.2";
206
+ var version = "5.9.3";
207
207
 
208
208
  // src/shared/cache-types.cts
209
209
  var isCachedPageValue = (value) => value.kind === "PAGE" || value.kind === "PAGES";
@@ -68868,7 +68868,7 @@ var import_sdk_trace_node = __toESM(require_src20(), 1);
68868
68868
  var import_semantic_conventions = __toESM(require_src(), 1);
68869
68869
  var {
68870
68870
  default: { version, name }
68871
- } = await import("../../esm-chunks/package-36IBNZ37.js");
68871
+ } = await import("../../esm-chunks/package-MI2MBCHL.js");
68872
68872
  var sdk = new import_sdk_node.NodeSDK({
68873
68873
  resource: new import_resources.Resource({
68874
68874
  [import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: name,
@@ -14,6 +14,8 @@ import {
14
14
  normalizeLocalePath,
15
15
  normalizeTrailingSlash,
16
16
  relativizeURL,
17
+ removeBasePath,
18
+ rewriteDataPath,
17
19
  } from './util.ts'
18
20
 
19
21
  export interface FetchEventResult {
@@ -180,14 +182,16 @@ export const buildResponse = async ({
180
182
  }
181
183
 
182
184
  if (isDataReq) {
183
- // The rewrite target is a data request, but a middleware rewrite target is always for the page route,
184
- // so we need to tell the server this is a data request. Setting the `x-nextjs-data` header is not enough. 🤷
185
- rewriteUrl.searchParams.set('__nextDataReq', '1')
185
+ rewriteUrl.pathname = rewriteDataPath({
186
+ dataUrl: new URL(request.url).pathname,
187
+ newRoute: removeBasePath(rewriteUrl.pathname, nextConfig?.basePath),
188
+ basePath: nextConfig?.basePath,
189
+ })
190
+ } else {
191
+ // respect trailing slash rules to prevent 308s
192
+ rewriteUrl.pathname = normalizeTrailingSlash(rewriteUrl.pathname, nextConfig?.trailingSlash)
186
193
  }
187
194
 
188
- // respect trailing slash rules to prevent 308s
189
- rewriteUrl.pathname = normalizeTrailingSlash(rewriteUrl.pathname, nextConfig?.trailingSlash)
190
-
191
195
  const target = normalizeLocalizedTarget({ target: rewriteUrl.toString(), request, nextConfig })
192
196
  if (target === request.url) {
193
197
  logger.withFields({ rewrite_url: rewrite }).debug('Rewrite url is same as original url')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "5.9.2",
3
+ "version": "5.9.3",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",