@netlify/plugin-nextjs 4.11.2 → 4.12.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/config.js
CHANGED
|
@@ -56,8 +56,11 @@ const resolveModuleRoot = (moduleName) => {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
const DEFAULT_EXCLUDED_MODULES = ['sharp', 'electron'];
|
|
59
|
-
const configureHandlerFunctions = ({ netlifyConfig, publish, ignore = [] }) => {
|
|
59
|
+
const configureHandlerFunctions = async ({ netlifyConfig, publish, ignore = [] }) => {
|
|
60
60
|
var _a;
|
|
61
|
+
const config = await (0, exports.getRequiredServerFiles)(publish);
|
|
62
|
+
const files = config.files || [];
|
|
63
|
+
const cssFilesToInclude = files.filter((f) => f.startsWith(`${publish}/static/css/`));
|
|
61
64
|
/* eslint-disable no-underscore-dangle */
|
|
62
65
|
(_a = netlifyConfig.functions)._ipx || (_a._ipx = {});
|
|
63
66
|
netlifyConfig.functions._ipx.node_bundler = 'nft';
|
|
@@ -66,7 +69,7 @@ const configureHandlerFunctions = ({ netlifyConfig, publish, ignore = [] }) => {
|
|
|
66
69
|
(_a = netlifyConfig.functions)[functionName] || (_a[functionName] = { included_files: [], external_node_modules: [] });
|
|
67
70
|
netlifyConfig.functions[functionName].node_bundler = 'nft';
|
|
68
71
|
(_b = netlifyConfig.functions[functionName]).included_files || (_b.included_files = []);
|
|
69
|
-
netlifyConfig.functions[functionName].included_files.push('.env', '.env.local', '.env.production', '.env.production.local', './public/locales/**', './next-i18next.config.js', `${publish}/server/**`, `${publish}/serverless/**`, `${publish}/*.json`, `${publish}/BUILD_ID`, `${publish}/static/chunks/webpack-middleware*.js`, `!${publish}/server/**/*.js.nft.json`, ...ignore.map((path) => `!${(0, slash_1.default)(path)}`));
|
|
72
|
+
netlifyConfig.functions[functionName].included_files.push('.env', '.env.local', '.env.production', '.env.production.local', './public/locales/**', './next-i18next.config.js', `${publish}/server/**`, `${publish}/serverless/**`, `${publish}/*.json`, `${publish}/BUILD_ID`, `${publish}/static/chunks/webpack-middleware*.js`, `!${publish}/server/**/*.js.nft.json`, ...cssFilesToInclude, ...ignore.map((path) => `!${(0, slash_1.default)(path)}`));
|
|
70
73
|
const nextRoot = resolveModuleRoot('next');
|
|
71
74
|
if (nextRoot) {
|
|
72
75
|
netlifyConfig.functions[functionName].included_files.push(`!${nextRoot}/dist/server/lib/squoosh/**/*.wasm`, `!${nextRoot}/dist/next-server/server/lib/squoosh/**/*.wasm`, `!${nextRoot}/dist/compiled/webpack/bundle4.js`, `!${nextRoot}/dist/compiled/webpack/bundle5.js`);
|
package/lib/helpers/edge.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateConfig = exports.writeEdgeFunctions = exports.loadMiddlewareManifest = void 0;
|
|
4
|
+
/* eslint-disable max-lines */
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const fs_extra_1 = require("fs-extra");
|
|
@@ -80,7 +81,10 @@ const writeEdgeFunctions = async (netlifyConfig) => {
|
|
|
80
81
|
if (!process.env.NEXT_USE_NETLIFY_EDGE) {
|
|
81
82
|
console.log('Using Netlify Edge Functions for image format detection. Set env var "NEXT_DISABLE_EDGE_IMAGES=true" to disable.');
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
+
const edgeFunctionDir = (0, path_1.join)(edgeFunctionRoot, 'ipx');
|
|
85
|
+
await (0, fs_extra_1.ensureDir)(edgeFunctionDir);
|
|
86
|
+
await copyEdgeSourceFile({ edgeFunctionDir, file: 'ipx.ts', target: 'index.ts' });
|
|
87
|
+
await (0, fs_extra_1.copyFile)((0, path_1.join)('.netlify', 'functions-internal', '_ipx', 'imageconfig.json'), (0, path_1.join)(edgeFunctionDir, 'imageconfig.json'));
|
|
84
88
|
manifest.functions.push({
|
|
85
89
|
function: 'ipx',
|
|
86
90
|
path: '/_next/image*',
|
|
@@ -124,3 +128,4 @@ const updateConfig = async (publish) => {
|
|
|
124
128
|
await (0, fs_extra_1.writeJSON)(configFile, config);
|
|
125
129
|
};
|
|
126
130
|
exports.updateConfig = updateConfig;
|
|
131
|
+
/* eslint-enable max-lines */
|
package/lib/index.js
CHANGED
|
@@ -62,7 +62,7 @@ const plugin = {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
const buildId = (0, fs_extra_1.readFileSync)((0, path_1.join)(publish, 'BUILD_ID'), 'utf8').trim();
|
|
65
|
-
(0, config_1.configureHandlerFunctions)({ netlifyConfig, ignore, publish: (0, path_1.relative)(process.cwd(), publish) });
|
|
65
|
+
await (0, config_1.configureHandlerFunctions)({ netlifyConfig, ignore, publish: (0, path_1.relative)(process.cwd(), publish) });
|
|
66
66
|
await (0, functions_1.generateFunctions)(constants, appDir);
|
|
67
67
|
await (0, functions_1.generatePagesResolver)({ target, constants });
|
|
68
68
|
await (0, files_1.movePublicFiles)({ appDir, outdir, publish });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Accepts } from "https://deno.land/x/accepts@2.1.1/mod.ts";
|
|
2
2
|
import type { Context } from "netlify:edge";
|
|
3
3
|
// Available at build time
|
|
4
|
-
import imageconfig from "
|
|
4
|
+
import imageconfig from "./imageconfig.json" assert {
|
|
5
5
|
type: "json",
|
|
6
6
|
};
|
|
7
7
|
|