@netlify/plugin-nextjs
Advanced tools
Comparing version 5.3.3 to 5.3.4-canary-not-prerendered-cache-tags-fix.0
@@ -207,32 +207,2 @@ | ||
}; | ||
var writeTagsManifest = async (ctx) => { | ||
const manifest = await ctx.getPrerenderManifest(); | ||
const routes = Object.entries(manifest.routes).map(async ([route, definition]) => { | ||
let tags; | ||
if (definition.dataRoute?.endsWith(".rsc")) { | ||
const path = join(ctx.publishDir, `server/app/${route === "/" ? "/index" : route}.meta`); | ||
try { | ||
const file = await readFile(path, "utf-8"); | ||
const meta = JSON.parse(file); | ||
tags = meta.headers["x-next-cache-tags"]; | ||
} catch { | ||
if (!definition.dataRoute?.endsWith("/default.rsc")) { | ||
console.log(`Unable to read cache tags for: ${path}`); | ||
} | ||
} | ||
} | ||
if (definition.dataRoute?.endsWith(".json")) { | ||
tags = `_N_T_${route}`; | ||
} | ||
if (definition.dataRoute === null) { | ||
tags = definition.initialHeaders?.["x-next-cache-tags"]; | ||
} | ||
return [route, tags]; | ||
}); | ||
await writeFile( | ||
join(ctx.serverHandlerDir, ".netlify/tags-manifest.json"), | ||
JSON.stringify(Object.fromEntries(await Promise.all(routes))), | ||
"utf-8" | ||
); | ||
}; | ||
var replaceMiddlewareManifest = async (sourcePath, destPath) => { | ||
@@ -262,4 +232,3 @@ await mkdir(dirname(destPath), { recursive: true }); | ||
getPatchesToApply, | ||
verifyHandlerDirStructure, | ||
writeTagsManifest | ||
verifyHandlerDirStructure | ||
}; |
@@ -30,4 +30,3 @@ | ||
copyNextServerCode, | ||
verifyHandlerDirStructure, | ||
writeTagsManifest | ||
verifyHandlerDirStructure | ||
} from "../content/server.js"; | ||
@@ -132,3 +131,2 @@ import { SERVER_HANDLER_NAME } from "../plugin-context.js"; | ||
await copyNextDependencies(ctx); | ||
await writeTagsManifest(ctx); | ||
await copyHandlerDependencies(ctx); | ||
@@ -135,0 +133,0 @@ await writeHandlerManifest(ctx); |
@@ -32,9 +32,5 @@ | ||
}; | ||
var getTagsManifest = async () => { | ||
return JSON.parse(await readFile(resolve(PLUGIN_DIR, ".netlify/tags-manifest.json"), "utf-8")); | ||
}; | ||
export { | ||
getRunConfig, | ||
getTagsManifest, | ||
setRunConfig | ||
}; |
@@ -181,10 +181,5 @@ | ||
}; | ||
function getCanonicalPathFromCacheKey(cacheKey) { | ||
return cacheKey === "/index" ? "/" : cacheKey; | ||
} | ||
var setCacheTagsHeaders = (headers, request, manifest, requestContext) => { | ||
const path = getCanonicalPathFromCacheKey(requestContext.responseCacheKey) ?? new URL(request.url).pathname; | ||
const tags = manifest[path]; | ||
if (tags !== void 0) { | ||
headers.set("netlify-cache-tag", tags); | ||
var setCacheTagsHeaders = (headers, requestContext) => { | ||
if (requestContext.responseCacheTags) { | ||
headers.set("netlify-cache-tag", requestContext.responseCacheTags.join(",")); | ||
} | ||
@@ -191,0 +186,0 @@ }; |
@@ -10,2 +10,3 @@ | ||
// src/run/revalidate.ts | ||
import { isPromise } from "node:util/types"; | ||
var nextResponseProxy = (res, requestContext) => { | ||
@@ -19,3 +20,7 @@ return new Proxy(res, { | ||
requestContext.didPagesRouterOnDemandRevalidate = true; | ||
return originalValue?.apply(target, args); | ||
const result = originalValue?.apply(target, args); | ||
if (result && isPromise(result)) { | ||
requestContext.trackBackgroundWork(result); | ||
} | ||
return result; | ||
}; | ||
@@ -22,0 +27,0 @@ } |
{ | ||
"name": "@netlify/plugin-nextjs", | ||
"version": "5.3.3", | ||
"version": "5.3.4-canary-not-prerendered-cache-tags-fix.0", | ||
"description": "Run Next.js seamlessly on Netlify", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5244018
137080
1