@netlify/plugin-nextjs 4.39.4 → 4.40.0
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/edge.js
CHANGED
|
@@ -196,7 +196,7 @@ exports.getEdgeFunctionPatternForPage = getEdgeFunctionPatternForPage;
|
|
|
196
196
|
* Writes Edge Functions for the Next middleware
|
|
197
197
|
*/
|
|
198
198
|
// eslint-disable-next-line max-lines-per-function
|
|
199
|
-
const writeEdgeFunctions = async ({ netlifyConfig, routesManifest, }) => {
|
|
199
|
+
const writeEdgeFunctions = async ({ netlifyConfig, routesManifest, constants: { PACKAGE_PATH = '' }, }) => {
|
|
200
200
|
var _a;
|
|
201
201
|
const generator = await (0, functionsMetaData_1.getPluginVersion)();
|
|
202
202
|
const manifest = {
|
|
@@ -204,7 +204,7 @@ const writeEdgeFunctions = async ({ netlifyConfig, routesManifest, }) => {
|
|
|
204
204
|
layers: [],
|
|
205
205
|
version: 1,
|
|
206
206
|
};
|
|
207
|
-
const edgeFunctionRoot = (0, path_1.resolve)('.netlify', 'edge-functions');
|
|
207
|
+
const edgeFunctionRoot = (0, path_1.resolve)(PACKAGE_PATH, '.netlify', 'edge-functions');
|
|
208
208
|
await (0, fs_extra_1.emptyDir)(edgeFunctionRoot);
|
|
209
209
|
const { publish } = netlifyConfig.build;
|
|
210
210
|
const nextConfigFile = await (0, config_1.getRequiredServerFiles)(publish);
|
package/lib/helpers/functions.js
CHANGED
|
@@ -21,7 +21,7 @@ const files_1 = require("./files");
|
|
|
21
21
|
const functionsMetaData_1 = require("./functionsMetaData");
|
|
22
22
|
const pack_1 = require("./pack");
|
|
23
23
|
const utils_1 = require("./utils");
|
|
24
|
-
const generateFunctions = async ({ FUNCTIONS_SRC = constants_1.DEFAULT_FUNCTIONS_SRC,
|
|
24
|
+
const generateFunctions = async ({ INTERNAL_FUNCTIONS_SRC, PUBLISH_DIR, PACKAGE_PATH = '', FUNCTIONS_SRC = (0, pathe_1.join)(PACKAGE_PATH, constants_1.DEFAULT_FUNCTIONS_SRC), }, appDir, apiLambdas, ssrLambdas) => {
|
|
25
25
|
const publish = (0, pathe_1.resolve)(PUBLISH_DIR);
|
|
26
26
|
const functionsDir = (0, pathe_1.resolve)(INTERNAL_FUNCTIONS_SRC || FUNCTIONS_SRC);
|
|
27
27
|
const functionDir = (0, pathe_1.join)(functionsDir, constants_1.HANDLER_FUNCTION_NAME);
|
|
@@ -95,15 +95,15 @@ exports.generateFunctions = generateFunctions;
|
|
|
95
95
|
* Writes a file in each function directory that contains references to every page entrypoint.
|
|
96
96
|
* This is just so that the nft bundler knows about them. We'll eventually do this better.
|
|
97
97
|
*/
|
|
98
|
-
const generatePagesResolver = async ({ INTERNAL_FUNCTIONS_SRC, FUNCTIONS_SRC = constants_1.DEFAULT_FUNCTIONS_SRC,
|
|
98
|
+
const generatePagesResolver = async ({ INTERNAL_FUNCTIONS_SRC, PUBLISH_DIR, PACKAGE_PATH = '', FUNCTIONS_SRC = (0, pathe_1.join)(PACKAGE_PATH, constants_1.DEFAULT_FUNCTIONS_SRC), }) => {
|
|
99
99
|
const functionsPath = INTERNAL_FUNCTIONS_SRC || FUNCTIONS_SRC;
|
|
100
|
-
const jsSource = await (0, getPageResolver_1.getResolverForPages)(PUBLISH_DIR);
|
|
100
|
+
const jsSource = await (0, getPageResolver_1.getResolverForPages)(PUBLISH_DIR, PACKAGE_PATH);
|
|
101
101
|
await (0, fs_extra_1.writeFile)((0, pathe_1.join)(functionsPath, constants_1.ODB_FUNCTION_NAME, 'pages.js'), jsSource);
|
|
102
102
|
await (0, fs_extra_1.writeFile)((0, pathe_1.join)(functionsPath, constants_1.HANDLER_FUNCTION_NAME, 'pages.js'), jsSource);
|
|
103
103
|
};
|
|
104
104
|
exports.generatePagesResolver = generatePagesResolver;
|
|
105
105
|
// Move our next/image function into the correct functions directory
|
|
106
|
-
const setupImageFunction = async ({ constants: { INTERNAL_FUNCTIONS_SRC, FUNCTIONS_SRC = constants_1.DEFAULT_FUNCTIONS_SRC,
|
|
106
|
+
const setupImageFunction = async ({ constants: { IS_LOCAL, INTERNAL_FUNCTIONS_SRC, PACKAGE_PATH = '', FUNCTIONS_SRC = (0, pathe_1.join)(PACKAGE_PATH, constants_1.DEFAULT_FUNCTIONS_SRC), }, imageconfig = {}, netlifyConfig, basePath, remotePatterns, responseHeaders, }) => {
|
|
107
107
|
const imagePath = imageconfig.path || '/_next/image';
|
|
108
108
|
if ((0, destr_1.default)(process.env.DISABLE_IPX)) {
|
|
109
109
|
// If no image loader is specified, need to redirect to a 404 page since there's no
|
package/lib/index.js
CHANGED
|
@@ -128,7 +128,7 @@ const plugin = {
|
|
|
128
128
|
buildId,
|
|
129
129
|
apiLambdas,
|
|
130
130
|
});
|
|
131
|
-
await (0, edge_1.writeEdgeFunctions)({ netlifyConfig, routesManifest });
|
|
131
|
+
await (0, edge_1.writeEdgeFunctions)({ constants, netlifyConfig, routesManifest });
|
|
132
132
|
},
|
|
133
133
|
async onPostBuild({ netlifyConfig: { build: { publish }, redirects, headers, }, utils: { status, cache, functions, build: { failBuild }, }, constants: { FUNCTIONS_DIST }, }) {
|
|
134
134
|
await (0, cache_1.saveCache)({ cache, publish });
|
|
@@ -39,8 +39,8 @@ const getResolverForDependencies = ({ dependencies, functionDir, }) => {
|
|
|
39
39
|
`;
|
|
40
40
|
};
|
|
41
41
|
exports.getResolverForDependencies = getResolverForDependencies;
|
|
42
|
-
const getResolverForPages = async (publish) => {
|
|
43
|
-
const functionDir = (0, pathe_1.resolve)('.netlify', 'functions', constants_1.HANDLER_FUNCTION_NAME);
|
|
42
|
+
const getResolverForPages = async (publish, packagePath) => {
|
|
43
|
+
const functionDir = (0, pathe_1.resolve)(packagePath, '.netlify', 'functions', constants_1.HANDLER_FUNCTION_NAME);
|
|
44
44
|
const dependencies = await (0, exports.getAllPageDependencies)(publish);
|
|
45
45
|
return (0, exports.getResolverForDependencies)({ dependencies, functionDir });
|
|
46
46
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/plugin-nextjs",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.40.0",
|
|
4
4
|
"description": "Run Next.js seamlessly on Netlify",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@delucis/if-env": "^1.1.2",
|
|
40
|
-
"@netlify/build": "^29.20.
|
|
40
|
+
"@netlify/build": "^29.20.4",
|
|
41
41
|
"@types/fs-extra": "^9.0.13",
|
|
42
42
|
"@types/jest": "^27.4.1",
|
|
43
43
|
"@types/merge-stream": "^1.1.2",
|