@netlify/plugin-nextjs 5.0.0-rc.4 → 5.0.0-rc.6

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.
@@ -617,7 +617,7 @@ var adjustDateHeader = async ({
617
617
  });
618
618
  const blobKey = await encodeBlobKey(key);
619
619
  const blobStore = getDeployStore({ fetch: fetchBeforeNextPatchedIt, consistency: "strong" });
620
- lastModified = await tracer.startActiveSpan(
620
+ lastModified = await tracer.withActiveSpan(
621
621
  "get cache to calculate date header",
622
622
  async (getBlobForDateSpan) => {
623
623
  getBlobForDateSpan.setAttributes({
@@ -626,7 +626,6 @@ var adjustDateHeader = async ({
626
626
  });
627
627
  const blob = await blobStore.get(blobKey, { type: "json" }) ?? {};
628
628
  getBlobForDateSpan.addEvent(blob ? "Cache hit" : "Cache miss");
629
- getBlobForDateSpan.end();
630
629
  return blob.lastModified;
631
630
  }
632
631
  );
@@ -33,11 +33,18 @@ function verifyPublishDir(ctx) {
33
33
  "Your publish directory does not contain expected Next.js build output, please check your build settings"
34
34
  );
35
35
  }
36
- if (!existsSync(ctx.standaloneRootDir)) {
36
+ if ((ctx.buildConfig.output === "standalone" || ctx.buildConfig.output === void 0) && !existsSync(ctx.standaloneRootDir)) {
37
37
  ctx.failBuild(
38
38
  `Your publish directory does not contain expected Next.js build output, please make sure you are using Next.js version (${SUPPORTED_NEXT_VERSIONS})`
39
39
  );
40
40
  }
41
+ if (ctx.buildConfig.output === "export" && !existsSync(ctx.resolveFromSiteDir("out"))) {
42
+ ctx.failBuild(
43
+ `Your export directory was not found at: ${ctx.resolveFromSiteDir(
44
+ "out"
45
+ )}, please check your build settings`
46
+ );
47
+ }
41
48
  }
42
49
  function verifyNextVersion(ctx, nextVersion) {
43
50
  if (!(0, import_semver.satisfies)(nextVersion, SUPPORTED_NEXT_VERSIONS, { includePrerelease: true })) {
@@ -9,7 +9,7 @@ import {
9
9
  copyNextServerCode,
10
10
  verifyHandlerDirStructure,
11
11
  writeTagsManifest
12
- } from "./chunk-BKDCZVBK.js";
12
+ } from "./chunk-CSTSA3JJ.js";
13
13
  import {
14
14
  require_out
15
15
  } from "./chunk-VZNKO4OO.js";
@@ -57,6 +57,14 @@ var copyStaticAssets = async (ctx) => {
57
57
  ctx.failBuild("Failed copying static assets", error);
58
58
  }
59
59
  };
60
+ var copyStaticExport = async (ctx) => {
61
+ try {
62
+ await rm(ctx.staticDir, { recursive: true, force: true });
63
+ await cp(ctx.resolveFromSiteDir("out"), ctx.staticDir, { recursive: true });
64
+ } catch (error) {
65
+ ctx.failBuild("Failed copying static export", error);
66
+ }
67
+ };
60
68
  var publishStaticDir = async (ctx) => {
61
69
  try {
62
70
  await rm(ctx.tempPublishDir, { recursive: true, force: true });
@@ -80,6 +88,7 @@ var unpublishStaticDir = async (ctx) => {
80
88
  export {
81
89
  copyStaticContent,
82
90
  copyStaticAssets,
91
+ copyStaticExport,
83
92
  publishStaticDir,
84
93
  unpublishStaticDir
85
94
  };
@@ -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.0.0-rc.4";
11
+ var version = "5.0.0-rc.6";
12
12
  var description = "Run Next.js seamlessly on Netlify";
13
13
  var main = "./dist/index.js";
14
14
  var type = "module";
@@ -53,7 +53,7 @@ var homepage = "https://github.com/netlify/next-runtime-minimal#readme";
53
53
  var devDependencies = {
54
54
  "@fastly/http-compute-js": "1.1.4",
55
55
  "@netlify/blobs": "^7.0.1",
56
- "@netlify/build": "^29.36.3",
56
+ "@netlify/build": "^29.36.4",
57
57
  "@netlify/edge-bundler": "^11.3.0",
58
58
  "@netlify/edge-functions": "^2.3.1",
59
59
  "@netlify/eslint-config-node": "^7.0.1",
@@ -89,7 +89,6 @@ var devDependencies = {
89
89
  "path-to-regexp": "^6.2.1",
90
90
  picomatch: "^3.0.1",
91
91
  prettier: "^3.2.5",
92
- "regexp-tree": "^0.1.27",
93
92
  semver: "^7.6.0",
94
93
  typescript: "^5.1.6",
95
94
  unionfs: "^4.5.1",
package/dist/index.js CHANGED
@@ -6,20 +6,21 @@
6
6
 
7
7
  import {
8
8
  copyPrerenderedContent
9
- } from "./esm-chunks/chunk-VSH4JS2L.js";
9
+ } from "./esm-chunks/chunk-75UGFPYW.js";
10
10
  import {
11
11
  copyStaticAssets,
12
12
  copyStaticContent,
13
+ copyStaticExport,
13
14
  publishStaticDir,
14
15
  unpublishStaticDir
15
- } from "./esm-chunks/chunk-3IGTKVSS.js";
16
+ } from "./esm-chunks/chunk-WFVNEURA.js";
16
17
  import {
17
18
  createEdgeHandlers
18
19
  } from "./esm-chunks/chunk-OBKVBMAL.js";
19
20
  import {
20
21
  createServerHandler
21
- } from "./esm-chunks/chunk-7HI65MAI.js";
22
- import "./esm-chunks/chunk-BKDCZVBK.js";
22
+ } from "./esm-chunks/chunk-W7XTKMHH.js";
23
+ import "./esm-chunks/chunk-CSTSA3JJ.js";
23
24
  import "./esm-chunks/chunk-VZNKO4OO.js";
24
25
  import {
25
26
  restoreBuildCache,
@@ -27,14 +28,14 @@ import {
27
28
  } from "./esm-chunks/chunk-72ZI2IVI.js";
28
29
  import {
29
30
  setImageConfig
30
- } from "./esm-chunks/chunk-XXBTIYSL.js";
31
+ } from "./esm-chunks/chunk-FMO6SJ5E.js";
31
32
  import {
32
33
  PluginContext
33
34
  } from "./esm-chunks/chunk-3NYX5FXN.js";
34
35
  import {
35
36
  verifyBuildConfig,
36
37
  verifyPublishDir
37
- } from "./esm-chunks/chunk-7CY6B4WT.js";
38
+ } from "./esm-chunks/chunk-MGPEWDDD.js";
38
39
  import "./esm-chunks/chunk-PJG75HGC.js";
39
40
  import "./esm-chunks/chunk-UYKENJEU.js";
40
41
  import "./esm-chunks/chunk-TYCYFZ22.js";
@@ -54,6 +55,9 @@ var onBuild = async (options) => {
54
55
  if (!options.constants.IS_LOCAL) {
55
56
  await saveBuildCache(ctx);
56
57
  }
58
+ if (ctx.buildConfig.output === "export") {
59
+ return copyStaticExport(ctx);
60
+ }
57
61
  await Promise.all([
58
62
  copyStaticAssets(ctx),
59
63
  copyStaticContent(ctx),
@@ -66,6 +70,13 @@ var onBuild = async (options) => {
66
70
  var onPostBuild = async (options) => {
67
71
  await publishStaticDir(new PluginContext(options));
68
72
  };
73
+ var onSuccess = async () => {
74
+ const prewarm = [process.env.DEPLOY_URL, process.env.DEPLOY_PRIME_URL, process.env.URL].filter(
75
+ // If running locally then the deploy ID is a placeholder value. Filtering for `https://0--` removes it.
76
+ (url) => Boolean(url && !url.startsWith("https://0--"))
77
+ );
78
+ await Promise.allSettled(prewarm.map((url) => fetch(url)));
79
+ };
69
80
  var onEnd = async (options) => {
70
81
  await unpublishStaticDir(new PluginContext(options));
71
82
  };
@@ -73,5 +84,6 @@ export {
73
84
  onBuild,
74
85
  onEnd,
75
86
  onPostBuild,
76
- onPreBuild
87
+ onPreBuild,
88
+ onSuccess
77
89
  };