@netlify/plugin-nextjs 5.14.7 → 5.15.1
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.
|
@@ -192,7 +192,7 @@ var buildPagesCacheValue = async (path, initialRevalidateSeconds, shouldUseEnumK
|
|
|
192
192
|
});
|
|
193
193
|
var RSC_SEGMENTS_DIR_SUFFIX = ".segments";
|
|
194
194
|
var RSC_SEGMENT_SUFFIX = ".segment.rsc";
|
|
195
|
-
var buildAppCacheValue = async (path, shouldUseAppPageKind) => {
|
|
195
|
+
var buildAppCacheValue = async (path, shouldUseAppPageKind, rscIsRequired = true) => {
|
|
196
196
|
const meta = JSON.parse(await readFile(`${path}.meta`, "utf-8"));
|
|
197
197
|
const html = await readFile(`${path}.html`, "utf-8");
|
|
198
198
|
if (shouldUseAppPageKind) {
|
|
@@ -212,9 +212,12 @@ var buildAppCacheValue = async (path, shouldUseAppPageKind) => {
|
|
|
212
212
|
return {
|
|
213
213
|
kind: "APP_PAGE",
|
|
214
214
|
html,
|
|
215
|
-
rscData: await readFile(`${path}.rsc`, "base64").catch(
|
|
216
|
-
()
|
|
217
|
-
|
|
215
|
+
rscData: await readFile(`${path}.rsc`, "base64").catch(() => readFile(`${path}.prefetch.rsc`, "base64")).catch((error) => {
|
|
216
|
+
if (rscIsRequired) {
|
|
217
|
+
throw error;
|
|
218
|
+
}
|
|
219
|
+
return void 0;
|
|
220
|
+
}),
|
|
218
221
|
segmentData,
|
|
219
222
|
...meta
|
|
220
223
|
};
|
|
@@ -254,6 +257,7 @@ var copyPrerenderedContent = async (ctx) => {
|
|
|
254
257
|
const shouldUseEnumKind = ctx.nextVersion ? (0, import_semver.satisfies)(ctx.nextVersion, ">=15.0.0-canary.114 <15.0.0-d || >15.0.0-rc.0", {
|
|
255
258
|
includePrerelease: true
|
|
256
259
|
}) : false;
|
|
260
|
+
let appRouterNotFoundDefinedInPrerenderManifest = false;
|
|
257
261
|
await Promise.all([
|
|
258
262
|
...Object.entries(manifest.routes).map(
|
|
259
263
|
([route, meta]) => limitConcurrentPrerenderContentHandling(async () => {
|
|
@@ -277,8 +281,12 @@ var copyPrerenderedContent = async (ctx) => {
|
|
|
277
281
|
case meta.dataRoute?.endsWith(".rsc"):
|
|
278
282
|
value = await buildAppCacheValue(
|
|
279
283
|
join(ctx.publishDir, "server/app", key),
|
|
280
|
-
shouldUseAppPageKind
|
|
284
|
+
shouldUseAppPageKind,
|
|
285
|
+
meta.renderingMode !== "PARTIALLY_STATIC"
|
|
281
286
|
);
|
|
287
|
+
if (route === "/_not-found") {
|
|
288
|
+
appRouterNotFoundDefinedInPrerenderManifest = true;
|
|
289
|
+
}
|
|
282
290
|
break;
|
|
283
291
|
case meta.dataRoute === null:
|
|
284
292
|
value = await buildRouteCacheValue(
|
|
@@ -320,7 +328,7 @@ var copyPrerenderedContent = async (ctx) => {
|
|
|
320
328
|
})
|
|
321
329
|
)
|
|
322
330
|
]);
|
|
323
|
-
if (existsSync(join(ctx.publishDir, `server/app/_not-found.html`))) {
|
|
331
|
+
if (!appRouterNotFoundDefinedInPrerenderManifest && existsSync(join(ctx.publishDir, `server/app/_not-found.html`))) {
|
|
324
332
|
const lastModified = Date.now();
|
|
325
333
|
const key = "/404";
|
|
326
334
|
const value = await buildAppCacheValue(
|
|
@@ -56,7 +56,8 @@ function shouldEnableSkewProtection(ctx) {
|
|
|
56
56
|
enabledOrDisabledReason: "off-default" /* OPT_OUT_DEFAULT */
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
const token = process.env.NETLIFY_SKEW_PROTECTION_TOKEN || process.env.DEPLOY_ID;
|
|
60
|
+
if ((!token || token === "0") && optInOptions.has(enabledOrDisabledReason)) {
|
|
60
61
|
return {
|
|
61
62
|
enabled: false,
|
|
62
63
|
enabledOrDisabledReason: enabledOrDisabledReason === "on-env-var" /* OPT_IN_ENV_VAR */ && ctx.constants.IS_LOCAL ? (
|
|
@@ -66,16 +67,18 @@ function shouldEnableSkewProtection(ctx) {
|
|
|
66
67
|
// this is silent disablement to avoid spam logs for users opted in via feature flag
|
|
67
68
|
// that don't explicitly opt in via env var
|
|
68
69
|
"off-no-valid-deploy-id" /* OPT_OUT_NO_VALID_DEPLOY_ID */
|
|
69
|
-
)
|
|
70
|
+
),
|
|
71
|
+
token
|
|
70
72
|
};
|
|
71
73
|
}
|
|
72
74
|
return {
|
|
73
75
|
enabled: optInOptions.has(enabledOrDisabledReason),
|
|
74
|
-
enabledOrDisabledReason
|
|
76
|
+
enabledOrDisabledReason,
|
|
77
|
+
token
|
|
75
78
|
};
|
|
76
79
|
}
|
|
77
80
|
var setSkewProtection = async (ctx, span) => {
|
|
78
|
-
const { enabled, enabledOrDisabledReason } = shouldEnableSkewProtection(ctx);
|
|
81
|
+
const { enabled, enabledOrDisabledReason, token } = shouldEnableSkewProtection(ctx);
|
|
79
82
|
span.setAttribute("skewProtection", enabledOrDisabledReason);
|
|
80
83
|
if (!enabled) {
|
|
81
84
|
if (enabledOrDisabledReason === "off-no-valid-deploy-id-env-var" /* OPT_OUT_NO_VALID_DEPLOY_ID_ENV_VAR */) {
|
|
@@ -92,7 +95,7 @@ var setSkewProtection = async (ctx, span) => {
|
|
|
92
95
|
} else {
|
|
93
96
|
console.log("Setting up Next.js Skew Protection.");
|
|
94
97
|
}
|
|
95
|
-
process.env.NEXT_DEPLOYMENT_ID =
|
|
98
|
+
process.env.NEXT_DEPLOYMENT_ID = token;
|
|
96
99
|
await mkdir(dirname(ctx.skewProtectionConfigPath), {
|
|
97
100
|
recursive: true
|
|
98
101
|
});
|
|
@@ -86,7 +86,7 @@ var pipeline = (0, import_util.promisify)(import_stream.pipeline);
|
|
|
86
86
|
|
|
87
87
|
// package.json
|
|
88
88
|
var name = "@netlify/plugin-nextjs";
|
|
89
|
-
var version = "5.
|
|
89
|
+
var version = "5.15.1";
|
|
90
90
|
|
|
91
91
|
// src/run/handlers/tags-handler.cts
|
|
92
92
|
var import_storage = require("../storage/storage.cjs");
|