@netlify/plugin-nextjs 4.2.6 → 4.2.7
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/cache.js +26 -5
- package/package.json +3 -3
package/lib/helpers/cache.js
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.saveCache = exports.restoreCache = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
4
5
|
const path_1 = require("path");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
const findDistDir = (publish) => {
|
|
8
|
+
// In normal operation, the dist dir is the same as the publish dir
|
|
9
|
+
if (!(0, utils_1.shouldSkip)()) {
|
|
10
|
+
return publish;
|
|
11
|
+
}
|
|
12
|
+
// In this situation, the user has disabled the plugin, which means that they might be using next export,
|
|
13
|
+
// so we'll look in a few places to find the site root. This allows us to find the .next directory.
|
|
14
|
+
for (const root of [(0, path_1.resolve)(publish, '..'), (0, path_1.resolve)(publish, '..', '..')]) {
|
|
15
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(root, 'next.config.js'))) {
|
|
16
|
+
return (0, path_1.join)(root, '.next');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
};
|
|
5
21
|
const restoreCache = async ({ cache, publish }) => {
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
22
|
+
const distDir = findDistDir(publish);
|
|
23
|
+
if (!distDir) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (await cache.restore((0, path_1.join)(distDir, 'cache'))) {
|
|
8
27
|
console.log('Next.js cache restored.');
|
|
9
28
|
}
|
|
10
29
|
else {
|
|
@@ -13,9 +32,11 @@ const restoreCache = async ({ cache, publish }) => {
|
|
|
13
32
|
};
|
|
14
33
|
exports.restoreCache = restoreCache;
|
|
15
34
|
const saveCache = async ({ cache, publish }) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
35
|
+
const distDir = findDistDir(publish);
|
|
36
|
+
if (!distDir) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (await cache.save((0, path_1.join)(distDir, 'cache'))) {
|
|
19
40
|
console.log('Next.js cache saved.');
|
|
20
41
|
}
|
|
21
42
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/plugin-nextjs",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.7",
|
|
4
4
|
"description": "Run Next.js seamlessly on Netlify",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"homepage": "https://github.com/netlify/netlify-plugin-nextjs#readme",
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@netlify/functions": "^0.
|
|
56
|
+
"@netlify/functions": "^1.0.0",
|
|
57
57
|
"@netlify/ipx": "^0.0.9",
|
|
58
58
|
"@vercel/node-bridge": "^2.1.0",
|
|
59
59
|
"chalk": "^4.1.2",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@babel/core": "^7.15.8",
|
|
76
76
|
"@babel/preset-env": "^7.15.8",
|
|
77
77
|
"@babel/preset-typescript": "^7.16.0",
|
|
78
|
-
"@netlify/build": "^26.3.
|
|
78
|
+
"@netlify/build": "^26.3.3",
|
|
79
79
|
"@netlify/eslint-config-node": "^5.1.4",
|
|
80
80
|
"@reach/dialog": "^0.16.2",
|
|
81
81
|
"@reach/visually-hidden": "^0.16.0",
|