@netlify/plugin-nextjs 4.18.1 → 4.21.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.
package/lib/helpers/dev.js
CHANGED
|
@@ -21,17 +21,17 @@ const onPreDev = async ({ constants, netlifyConfig }) => {
|
|
|
21
21
|
});
|
|
22
22
|
await (0, edge_1.writeDevEdgeFunction)(constants);
|
|
23
23
|
if (!(0, fs_extra_1.existsSync)((0, path_1.resolve)(base, 'middleware.ts')) && !(0, fs_extra_1.existsSync)((0, path_1.resolve)(base, 'middleware.js'))) {
|
|
24
|
-
console.log("No middleware found.
|
|
24
|
+
console.log("No middleware found. If you did intend to use middleware, create a 'middleware.ts' or 'middleware.js' file in your project root to add custom middleware.");
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
27
|
console.log('Watching for changes in Next.js middleware...');
|
|
28
|
+
// Eventually we might want to do this via esbuild's API, but for now the CLI works fine
|
|
29
|
+
const common = [`--bundle`, `--outdir=${(0, path_1.resolve)('.netlify')}`, `--format=esm`, `--target=esnext`, '--watch'];
|
|
30
|
+
// TypeScript
|
|
31
|
+
(0, execa_1.default)(`esbuild`, [...common, (0, path_1.resolve)(base, 'middleware.ts')], { all: true }).all.pipe(process.stdout);
|
|
32
|
+
// JavaScript
|
|
33
|
+
(0, execa_1.default)(`esbuild`, [...common, (0, path_1.resolve)(base, 'middleware.js')], { all: true }).all.pipe(process.stdout);
|
|
34
|
+
// Don't return the promise because we don't want to wait for the child process to finish
|
|
28
35
|
}
|
|
29
|
-
// Eventually we might want to do this via esbuild's API, but for now the CLI works fine
|
|
30
|
-
const common = [`--bundle`, `--outdir=${(0, path_1.resolve)('.netlify')}`, `--format=esm`, `--target=esnext`, '--watch'];
|
|
31
|
-
// TypeScript
|
|
32
|
-
(0, execa_1.default)(`esbuild`, [...common, (0, path_1.resolve)(base, 'middleware.ts')], { all: true }).all.pipe(process.stdout);
|
|
33
|
-
// JavaScript
|
|
34
|
-
(0, execa_1.default)(`esbuild`, [...common, (0, path_1.resolve)(base, 'middleware.js')], { all: true }).all.pipe(process.stdout);
|
|
35
|
-
// Don't return the promise because we don't want to wait for the child process to finish
|
|
36
36
|
};
|
|
37
37
|
exports.onPreDev = onPreDev;
|
package/lib/helpers/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getCustomImageResponseHeaders = exports.isNextAuthInstalled = exports.findModuleFromBase = exports.shouldSkip = exports.getPreviewRewrites = exports.getApiRewrites = exports.redirectsForNextRouteWithData = exports.redirectsForNextRoute = exports.isApiRoute = exports.routeToDataRoute = exports.netlifyRoutesForNextRouteWithData = exports.toNetlifyRoute = void 0;
|
|
6
|
+
exports.isBundleSizeCheckDisabled = exports.getCustomImageResponseHeaders = exports.isNextAuthInstalled = exports.findModuleFromBase = exports.shouldSkip = exports.getPreviewRewrites = exports.getApiRewrites = exports.redirectsForNextRouteWithData = exports.redirectsForNextRoute = exports.isApiRoute = exports.routeToDataRoute = exports.netlifyRoutesForNextRouteWithData = exports.toNetlifyRoute = void 0;
|
|
7
7
|
const globby_1 = __importDefault(require("globby"));
|
|
8
8
|
const pathe_1 = require("pathe");
|
|
9
9
|
const constants_1 = require("../constants");
|
|
@@ -154,4 +154,6 @@ const getCustomImageResponseHeaders = (headers) => {
|
|
|
154
154
|
return null;
|
|
155
155
|
};
|
|
156
156
|
exports.getCustomImageResponseHeaders = getCustomImageResponseHeaders;
|
|
157
|
+
const isBundleSizeCheckDisabled = () => process.env.DISABLE_BUNDLE_ZIP_SIZE_CHECK === '1' || process.env.DISABLE_BUNDLE_ZIP_SIZE_CHECK === 'true';
|
|
158
|
+
exports.isBundleSizeCheckDisabled = isBundleSizeCheckDisabled;
|
|
157
159
|
/* eslint-enable max-lines */
|
|
@@ -36,6 +36,7 @@ const outdent_1 = require("outdent");
|
|
|
36
36
|
const pretty_bytes_1 = __importDefault(require("pretty-bytes"));
|
|
37
37
|
const semver_1 = require("semver");
|
|
38
38
|
const constants_1 = require("../constants");
|
|
39
|
+
const utils_1 = require("./utils");
|
|
39
40
|
// This is when nft support was added
|
|
40
41
|
const REQUIRED_BUILD_VERSION = '>=18.16.0';
|
|
41
42
|
const verifyNetlifyBuildVersion = ({ IS_LOCAL, NETLIFY_BUILD_VERSION, failBuild, }) => {
|
|
@@ -103,6 +104,12 @@ const checkForRootPublish = ({ publish, failBuild, }) => {
|
|
|
103
104
|
};
|
|
104
105
|
exports.checkForRootPublish = checkForRootPublish;
|
|
105
106
|
const checkZipSize = async (file, maxSize = constants_1.LAMBDA_MAX_SIZE) => {
|
|
107
|
+
// Requires contacting the Netlify Support team to fully enable.
|
|
108
|
+
// Enabling this without contacting them can result in failed deploys.
|
|
109
|
+
if ((0, utils_1.isBundleSizeCheckDisabled)()) {
|
|
110
|
+
console.warn('Function bundle size check was DISABLED with the DISABLE_BUNDLE_ZIP_SIZE_CHECK environment variable. Your deployment will break if it exceeds the maximum supported size of function zip files in your account.');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
106
113
|
if (!(0, fs_1.existsSync)(file)) {
|
|
107
114
|
console.warn(`Could not check zip size because ${file} does not exist`);
|
|
108
115
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/plugin-nextjs",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.21.1",
|
|
4
4
|
"description": "Run Next.js seamlessly on Netlify",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@delucis/if-env": "^1.1.2",
|
|
33
|
-
"@netlify/build": "^27.
|
|
33
|
+
"@netlify/build": "^27.16.1",
|
|
34
34
|
"@types/fs-extra": "^9.0.13",
|
|
35
35
|
"@types/jest": "^27.4.1",
|
|
36
36
|
"@types/node": "^17.0.25",
|
|
@@ -48,9 +48,6 @@
|
|
|
48
48
|
"watch": "tsc --watch",
|
|
49
49
|
"prepare": "npm run build"
|
|
50
50
|
},
|
|
51
|
-
"peerDependencies": {
|
|
52
|
-
"next": "*"
|
|
53
|
-
},
|
|
54
51
|
"repository": {
|
|
55
52
|
"type": "git",
|
|
56
53
|
"url": "git+https://github.com/netlify/next-runtime.git"
|
|
@@ -22,11 +22,10 @@ const exists = async (relativePath) => {
|
|
|
22
22
|
let idx = 0
|
|
23
23
|
|
|
24
24
|
const handler = async (req, context) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// }
|
|
25
|
+
if (!Deno.env.get('NETLIFY_DEV')) {
|
|
26
|
+
// Only run in dev
|
|
27
|
+
return
|
|
28
|
+
}
|
|
30
29
|
|
|
31
30
|
let middleware
|
|
32
31
|
// Dynamic imports and FS operations aren't allowed when deployed,
|