@netlify/plugin-nextjs 4.29.2-alpha-isr-404.1 → 4.29.2
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.
package/lib/helpers/files.js
CHANGED
|
@@ -298,9 +298,12 @@ const getDependenciesOfFile = async (file) => {
|
|
|
298
298
|
exports.getDependenciesOfFile = getDependenciesOfFile;
|
|
299
299
|
const baseServerReplacements = [
|
|
300
300
|
// force manual revalidate during cache fetches
|
|
301
|
-
[
|
|
301
|
+
[
|
|
302
|
+
`checkIsManualRevalidate(req, this.renderOpts.previewProps)`,
|
|
303
|
+
`checkIsManualRevalidate(process.env._REVALIDATE_SSG ? { headers: { 'x-prerender-revalidate': this.renderOpts.previewProps.previewModeId } } : req, this.renderOpts.previewProps)`,
|
|
304
|
+
],
|
|
302
305
|
// ensure ISR 404 pages send the correct SWR cache headers
|
|
303
|
-
[`private: isPreviewMode || is404Page`, `private: isPreviewMode
|
|
306
|
+
[`private: isPreviewMode || is404Page && cachedData`, `private: isPreviewMode && cachedData`],
|
|
304
307
|
];
|
|
305
308
|
const nextServerReplacements = [
|
|
306
309
|
[
|
|
@@ -33,7 +33,7 @@ const makeHandler = (conf, app, pageRoot, staticManifest = [], mode = 'ssr') =>
|
|
|
33
33
|
conf.experimental.isrFlushToDisk = false;
|
|
34
34
|
// This is our flag that we use when patching the source
|
|
35
35
|
// eslint-disable-next-line no-underscore-dangle
|
|
36
|
-
process.env.
|
|
36
|
+
process.env._REVALIDATE_SSG = 'true';
|
|
37
37
|
for (const [key, value] of Object.entries(conf.env)) {
|
|
38
38
|
process.env[key] = String(value);
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/plugin-nextjs",
|
|
3
|
-
"version": "4.29.2
|
|
3
|
+
"version": "4.29.2",
|
|
4
4
|
"description": "Run Next.js seamlessly on Netlify",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@delucis/if-env": "^1.1.2",
|
|
39
|
-
"@netlify/build": "^28.
|
|
39
|
+
"@netlify/build": "^28.2.2",
|
|
40
40
|
"@types/fs-extra": "^9.0.13",
|
|
41
41
|
"@types/jest": "^27.4.1",
|
|
42
42
|
"@types/merge-stream": "^1.1.2",
|
|
@@ -43,11 +43,14 @@ const handler = async (req, context) => {
|
|
|
43
43
|
return
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
// This is the format expected by Next.js
|
|
46
|
+
// This is the format expected by Next.js along with the timezone which we support.
|
|
47
47
|
const geo = {
|
|
48
48
|
country: context.geo.country?.code,
|
|
49
49
|
region: context.geo.subdivision?.code,
|
|
50
50
|
city: context.geo.city,
|
|
51
|
+
latitude: context.geo.latitude?.toString(),
|
|
52
|
+
longitude: context.geo.longitude?.toString(),
|
|
53
|
+
timezone: context.geo.timezone,
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
// A default request id is fine locally
|
|
@@ -20,6 +20,7 @@ export interface RequestData {
|
|
|
20
20
|
region?: string
|
|
21
21
|
latitude?: string
|
|
22
22
|
longitude?: string
|
|
23
|
+
timezone?: string
|
|
23
24
|
}
|
|
24
25
|
headers: Record<string, string>
|
|
25
26
|
ip?: string
|
|
@@ -63,10 +64,13 @@ const handler = async (req: Request, context: Context) => {
|
|
|
63
64
|
return
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
const geo = {
|
|
67
|
+
const geo: RequestData['geo'] = {
|
|
67
68
|
country: context.geo.country?.code,
|
|
68
69
|
region: context.geo.subdivision?.code,
|
|
69
70
|
city: context.geo.city,
|
|
71
|
+
latitude: context.geo.latitude?.toString(),
|
|
72
|
+
longitude: context.geo.longitude?.toString(),
|
|
73
|
+
timezone: context.geo.timezone,
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
const requestId = req.headers.get('x-nf-request-id')
|