@netlify/plugin-nextjs 5.1.1 → 5.1.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/dist/build/content/server.js +2 -2
- package/dist/build/content/static.js +1 -1
- package/dist/build/functions/edge.js +2 -2
- package/dist/build/functions/server.js +4 -4
- package/dist/build/plugin-context.js +1 -1
- package/dist/build/verification.js +1 -1
- package/dist/esm-chunks/{chunk-ZKJEJNSJ.js → chunk-4BNHE6TP.js} +1 -1
- package/dist/esm-chunks/{chunk-F5VQRN6L.js → chunk-HESS57SH.js} +2 -2
- package/dist/esm-chunks/{chunk-PH26UF2W.js → chunk-K7BTUM7O.js} +24 -13
- package/dist/esm-chunks/{chunk-3NYX5FXN.js → chunk-L6OM53B6.js} +52 -2
- package/dist/esm-chunks/{chunk-OBKVBMAL.js → chunk-UTQSBE5O.js} +1 -1
- package/dist/esm-chunks/{chunk-74THQNRG.js → chunk-V2T6NUOM.js} +4 -1
- package/dist/esm-chunks/{package-YB7ERSH4.js → package-RVJOBSMH.js} +2 -2
- package/dist/index.js +6 -6
- package/dist/run/handlers/tracing.js +1 -1
- package/package.json +1 -1
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
getPatchesToApply,
|
|
11
11
|
verifyHandlerDirStructure,
|
|
12
12
|
writeTagsManifest
|
|
13
|
-
} from "../../esm-chunks/chunk-
|
|
13
|
+
} from "../../esm-chunks/chunk-4BNHE6TP.js";
|
|
14
14
|
import "../../esm-chunks/chunk-PDPDW32D.js";
|
|
15
15
|
import "../../esm-chunks/chunk-Y3K5Q6FP.js";
|
|
16
16
|
import "../../esm-chunks/chunk-VZNKO4OO.js";
|
|
17
|
-
import "../../esm-chunks/chunk-
|
|
17
|
+
import "../../esm-chunks/chunk-K7BTUM7O.js";
|
|
18
18
|
import "../../esm-chunks/chunk-PJG75HGC.js";
|
|
19
19
|
import "../../esm-chunks/chunk-BG455SFE.js";
|
|
20
20
|
import "../../esm-chunks/chunk-UYKENJEU.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
copyStaticExport,
|
|
11
11
|
publishStaticDir,
|
|
12
12
|
unpublishStaticDir
|
|
13
|
-
} from "../../esm-chunks/chunk-
|
|
13
|
+
} from "../../esm-chunks/chunk-V2T6NUOM.js";
|
|
14
14
|
import "../../esm-chunks/chunk-TYCYFZ22.js";
|
|
15
15
|
import "../../esm-chunks/chunk-PDPDW32D.js";
|
|
16
16
|
import "../../esm-chunks/chunk-Y3K5Q6FP.js";
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
createEdgeHandlers
|
|
9
|
-
} from "../../esm-chunks/chunk-
|
|
9
|
+
} from "../../esm-chunks/chunk-UTQSBE5O.js";
|
|
10
10
|
import "../../esm-chunks/chunk-VZNKO4OO.js";
|
|
11
|
-
import "../../esm-chunks/chunk-
|
|
11
|
+
import "../../esm-chunks/chunk-L6OM53B6.js";
|
|
12
12
|
import "../../esm-chunks/chunk-5JVNISGM.js";
|
|
13
13
|
export {
|
|
14
14
|
createEdgeHandlers
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
createServerHandler
|
|
9
|
-
} from "../../esm-chunks/chunk-
|
|
10
|
-
import "../../esm-chunks/chunk-
|
|
9
|
+
} from "../../esm-chunks/chunk-HESS57SH.js";
|
|
10
|
+
import "../../esm-chunks/chunk-4BNHE6TP.js";
|
|
11
11
|
import "../../esm-chunks/chunk-PDPDW32D.js";
|
|
12
12
|
import "../../esm-chunks/chunk-Y3K5Q6FP.js";
|
|
13
13
|
import "../../esm-chunks/chunk-VZNKO4OO.js";
|
|
14
|
-
import "../../esm-chunks/chunk-
|
|
15
|
-
import "../../esm-chunks/chunk-
|
|
14
|
+
import "../../esm-chunks/chunk-L6OM53B6.js";
|
|
15
|
+
import "../../esm-chunks/chunk-K7BTUM7O.js";
|
|
16
16
|
import "../../esm-chunks/chunk-PJG75HGC.js";
|
|
17
17
|
import "../../esm-chunks/chunk-BG455SFE.js";
|
|
18
18
|
import "../../esm-chunks/chunk-UYKENJEU.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
verifyNextVersion,
|
|
10
10
|
verifyNoAdvancedAPIRoutes,
|
|
11
11
|
verifyPublishDir
|
|
12
|
-
} from "../esm-chunks/chunk-
|
|
12
|
+
} from "../esm-chunks/chunk-K7BTUM7O.js";
|
|
13
13
|
import "../esm-chunks/chunk-PJG75HGC.js";
|
|
14
14
|
import "../esm-chunks/chunk-BG455SFE.js";
|
|
15
15
|
import "../esm-chunks/chunk-5JVNISGM.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
copyNextServerCode,
|
|
10
10
|
verifyHandlerDirStructure,
|
|
11
11
|
writeTagsManifest
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4BNHE6TP.js";
|
|
13
13
|
import {
|
|
14
14
|
wrapTracer
|
|
15
15
|
} from "./chunk-PDPDW32D.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-VZNKO4OO.js";
|
|
23
23
|
import {
|
|
24
24
|
SERVER_HANDLER_NAME
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-L6OM53B6.js";
|
|
26
26
|
import {
|
|
27
27
|
__toESM
|
|
28
28
|
} from "./chunk-5JVNISGM.js";
|
|
@@ -17,36 +17,47 @@ import {
|
|
|
17
17
|
// src/build/verification.ts
|
|
18
18
|
var import_semver = __toESM(require_semver(), 1);
|
|
19
19
|
import { existsSync } from "node:fs";
|
|
20
|
+
import { join } from "node:path";
|
|
20
21
|
var SUPPORTED_NEXT_VERSIONS = ">=13.5.0";
|
|
21
22
|
function verifyPublishDir(ctx) {
|
|
22
23
|
if (!existsSync(ctx.publishDir)) {
|
|
23
24
|
ctx.failBuild(
|
|
24
|
-
`Your publish directory was not found at: ${ctx.publishDir}
|
|
25
|
+
`Your publish directory was not found at: ${ctx.publishDir}. Please check your build settings`
|
|
25
26
|
);
|
|
26
27
|
}
|
|
27
28
|
if (ctx.publishDir === ctx.resolveFromPackagePath("")) {
|
|
28
29
|
ctx.failBuild(
|
|
29
|
-
`Your publish directory cannot be the same as the base directory of your site
|
|
30
|
+
`Your publish directory cannot be the same as the base directory of your site. Please check your build settings`
|
|
30
31
|
);
|
|
31
32
|
}
|
|
32
33
|
try {
|
|
33
34
|
ctx.buildConfig;
|
|
34
35
|
} catch {
|
|
35
36
|
ctx.failBuild(
|
|
36
|
-
"Your publish directory does not contain expected Next.js build output
|
|
37
|
+
"Your publish directory does not contain expected Next.js build output. Please check your build settings"
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
|
-
if (
|
|
40
|
-
ctx.
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if (ctx.buildConfig.output === "standalone" || ctx.buildConfig.output === void 0) {
|
|
41
|
+
if (!existsSync(join(ctx.publishDir, "BUILD_ID"))) {
|
|
42
|
+
ctx.failBuild(
|
|
43
|
+
"Your publish directory does not contain expected Next.js build output. Please check your build settings"
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
if (!existsSync(ctx.standaloneRootDir)) {
|
|
47
|
+
ctx.failBuild(
|
|
48
|
+
`Your publish directory does not contain expected Next.js build output. Please make sure you are using Next.js version (${SUPPORTED_NEXT_VERSIONS})`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
43
51
|
}
|
|
44
|
-
if (ctx.buildConfig.output === "export"
|
|
45
|
-
ctx.
|
|
46
|
-
`Your export
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
if (ctx.buildConfig.output === "export") {
|
|
53
|
+
if (!ctx.exportDetail?.success) {
|
|
54
|
+
ctx.failBuild(`Your export failed to build. Please check your build settings`);
|
|
55
|
+
}
|
|
56
|
+
if (!existsSync(ctx.exportDetail?.outDirectory)) {
|
|
57
|
+
ctx.failBuild(
|
|
58
|
+
`Your export directory was not found at: ${ctx.exportDetail?.outDirectory}. Please check your build settings`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
50
61
|
}
|
|
51
62
|
}
|
|
52
63
|
function verifyNextVersion(ctx, nextVersion) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
// src/build/plugin-context.ts
|
|
9
|
-
import { readFileSync } from "node:fs";
|
|
9
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
10
10
|
import { readFile } from "node:fs/promises";
|
|
11
11
|
import { join, relative, resolve } from "node:path";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
@@ -146,6 +146,27 @@ var PluginContext = class {
|
|
|
146
146
|
async getPrerenderManifest() {
|
|
147
147
|
return JSON.parse(await readFile(join(this.publishDir, "prerender-manifest.json"), "utf-8"));
|
|
148
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Uses various heuristics to try to find the .next dir.
|
|
151
|
+
* Works by looking for BUILD_ID, so requires the site to have been built
|
|
152
|
+
*/
|
|
153
|
+
findDotNext() {
|
|
154
|
+
for (const dir of [
|
|
155
|
+
// The publish directory
|
|
156
|
+
this.publishDir,
|
|
157
|
+
// In the root
|
|
158
|
+
resolve(DEFAULT_PUBLISH_DIR),
|
|
159
|
+
// The sibling of the publish directory
|
|
160
|
+
resolve(this.publishDir, "..", DEFAULT_PUBLISH_DIR),
|
|
161
|
+
// In the package dir
|
|
162
|
+
resolve(this.constants.PACKAGE_PATH || "", DEFAULT_PUBLISH_DIR)
|
|
163
|
+
]) {
|
|
164
|
+
if (existsSync(join(dir, "BUILD_ID"))) {
|
|
165
|
+
return dir;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
149
170
|
/**
|
|
150
171
|
* Get Next.js middleware config from the build output
|
|
151
172
|
*/
|
|
@@ -159,12 +180,41 @@ var PluginContext = class {
|
|
|
159
180
|
/** Get RequiredServerFiles manifest from build output **/
|
|
160
181
|
get requiredServerFiles() {
|
|
161
182
|
if (!this._requiredServerFiles) {
|
|
183
|
+
let requiredServerFilesJson = join(this.publishDir, "required-server-files.json");
|
|
184
|
+
if (!existsSync(requiredServerFilesJson)) {
|
|
185
|
+
const dotNext = this.findDotNext();
|
|
186
|
+
if (dotNext) {
|
|
187
|
+
requiredServerFilesJson = join(dotNext, "required-server-files.json");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
162
190
|
this._requiredServerFiles = JSON.parse(
|
|
163
|
-
readFileSync(
|
|
191
|
+
readFileSync(requiredServerFilesJson, "utf-8")
|
|
164
192
|
);
|
|
165
193
|
}
|
|
166
194
|
return this._requiredServerFiles;
|
|
167
195
|
}
|
|
196
|
+
#exportDetail = null;
|
|
197
|
+
/** Get metadata when output = export */
|
|
198
|
+
get exportDetail() {
|
|
199
|
+
if (this.buildConfig.output !== "export") {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
if (!this.#exportDetail) {
|
|
203
|
+
const detailFile = join(
|
|
204
|
+
this.requiredServerFiles.appDir,
|
|
205
|
+
this.buildConfig.distDir,
|
|
206
|
+
"export-detail.json"
|
|
207
|
+
);
|
|
208
|
+
if (!existsSync(detailFile)) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
this.#exportDetail = JSON.parse(readFileSync(detailFile, "utf-8"));
|
|
213
|
+
} catch {
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return this.#exportDetail;
|
|
217
|
+
}
|
|
168
218
|
/** Get Next Config from build output **/
|
|
169
219
|
get buildConfig() {
|
|
170
220
|
return this.requiredServerFiles.config;
|
|
@@ -73,9 +73,12 @@ var copyStaticAssets = async (ctx) => {
|
|
|
73
73
|
};
|
|
74
74
|
var copyStaticExport = async (ctx) => {
|
|
75
75
|
await tracer.withActiveSpan("copyStaticExport", async () => {
|
|
76
|
+
if (!ctx.exportDetail?.outDirectory) {
|
|
77
|
+
ctx.failBuild("Export directory not found");
|
|
78
|
+
}
|
|
76
79
|
try {
|
|
77
80
|
await rm(ctx.staticDir, { recursive: true, force: true });
|
|
78
|
-
await cp(ctx.
|
|
81
|
+
await cp(ctx.exportDetail.outDirectory, ctx.staticDir, { recursive: true });
|
|
79
82
|
} catch (error) {
|
|
80
83
|
ctx.failBuild("Failed copying static export", error);
|
|
81
84
|
}
|
|
@@ -8,7 +8,7 @@ import "./chunk-5JVNISGM.js";
|
|
|
8
8
|
|
|
9
9
|
// package.json
|
|
10
10
|
var name = "@netlify/plugin-nextjs";
|
|
11
|
-
var version = "5.1.
|
|
11
|
+
var version = "5.1.2";
|
|
12
12
|
var description = "Run Next.js seamlessly on Netlify";
|
|
13
13
|
var main = "./dist/index.js";
|
|
14
14
|
var type = "module";
|
|
@@ -60,7 +60,7 @@ var devDependencies = {
|
|
|
60
60
|
"@netlify/blobs": "^7.0.1",
|
|
61
61
|
"@netlify/build": "^29.37.2",
|
|
62
62
|
"@netlify/edge-bundler": "^11.4.0",
|
|
63
|
-
"@netlify/edge-functions": "^2.
|
|
63
|
+
"@netlify/edge-functions": "^2.5.1",
|
|
64
64
|
"@netlify/eslint-config-node": "^7.0.1",
|
|
65
65
|
"@netlify/functions": "^2.5.1",
|
|
66
66
|
"@netlify/serverless-functions-api": "^1.10.1",
|
package/dist/index.js
CHANGED
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
createServerHandler
|
|
9
|
-
} from "./esm-chunks/chunk-
|
|
9
|
+
} from "./esm-chunks/chunk-HESS57SH.js";
|
|
10
10
|
import {
|
|
11
11
|
copyPrerenderedContent
|
|
12
12
|
} from "./esm-chunks/chunk-MRD3XSKD.js";
|
|
13
|
-
import "./esm-chunks/chunk-
|
|
13
|
+
import "./esm-chunks/chunk-4BNHE6TP.js";
|
|
14
14
|
import {
|
|
15
15
|
copyStaticAssets,
|
|
16
16
|
copyStaticContent,
|
|
17
17
|
copyStaticExport,
|
|
18
18
|
publishStaticDir,
|
|
19
19
|
unpublishStaticDir
|
|
20
|
-
} from "./esm-chunks/chunk-
|
|
20
|
+
} from "./esm-chunks/chunk-V2T6NUOM.js";
|
|
21
21
|
import "./esm-chunks/chunk-TYCYFZ22.js";
|
|
22
22
|
import {
|
|
23
23
|
wrapTracer
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from "./esm-chunks/chunk-Y3K5Q6FP.js";
|
|
29
29
|
import {
|
|
30
30
|
createEdgeHandlers
|
|
31
|
-
} from "./esm-chunks/chunk-
|
|
31
|
+
} from "./esm-chunks/chunk-UTQSBE5O.js";
|
|
32
32
|
import "./esm-chunks/chunk-VZNKO4OO.js";
|
|
33
33
|
import {
|
|
34
34
|
restoreBuildCache,
|
|
@@ -39,12 +39,12 @@ import {
|
|
|
39
39
|
} from "./esm-chunks/chunk-MCEOSJH6.js";
|
|
40
40
|
import {
|
|
41
41
|
PluginContext
|
|
42
|
-
} from "./esm-chunks/chunk-
|
|
42
|
+
} from "./esm-chunks/chunk-L6OM53B6.js";
|
|
43
43
|
import {
|
|
44
44
|
verifyBuildConfig,
|
|
45
45
|
verifyNoAdvancedAPIRoutes,
|
|
46
46
|
verifyPublishDir
|
|
47
|
-
} from "./esm-chunks/chunk-
|
|
47
|
+
} from "./esm-chunks/chunk-K7BTUM7O.js";
|
|
48
48
|
import "./esm-chunks/chunk-PJG75HGC.js";
|
|
49
49
|
import "./esm-chunks/chunk-BG455SFE.js";
|
|
50
50
|
import "./esm-chunks/chunk-UYKENJEU.js";
|
|
@@ -51202,7 +51202,7 @@ var import_sdk_trace_node = __toESM(require_src14(), 1);
|
|
|
51202
51202
|
var import_semantic_conventions = __toESM(require_src(), 1);
|
|
51203
51203
|
var {
|
|
51204
51204
|
default: { version, name }
|
|
51205
|
-
} = await import("../../esm-chunks/package-
|
|
51205
|
+
} = await import("../../esm-chunks/package-RVJOBSMH.js");
|
|
51206
51206
|
var sdk = new import_sdk_node.NodeSDK({
|
|
51207
51207
|
resource: new import_resources.Resource({
|
|
51208
51208
|
[import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: name,
|