@netlify/plugin-nextjs 5.11.5 → 5.12.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.
@@ -89,6 +89,7 @@ var copyNextServerCode = async (ctx) => {
89
89
  `server/*`,
90
90
  `server/chunks/**/*`,
91
91
  `server/edge-chunks/**/*`,
92
+ `server/edge/chunks/**/*`,
92
93
  `server/+(app|pages)/**/*.js`
93
94
  ],
94
95
  {
@@ -511,9 +511,14 @@ var copyHandlerDependencies = async (ctx, { name, env, files, wasm }) => {
511
511
  parts.push(`;// Concatenated file: ${file}
512
512
  `, entrypoint);
513
513
  }
514
- const exports = `const middlewareEntryKey = Object.keys(_ENTRIES).find(entryKey => entryKey.startsWith("middleware_${name}")); export default _ENTRIES[middlewareEntryKey].default;`;
514
+ parts.push(
515
+ `const middlewareEntryKey = Object.keys(_ENTRIES).find(entryKey => entryKey.startsWith("middleware_${name}"));`,
516
+ // turbopack entries are promises so we await here to get actual entry
517
+ // non-turbopack entries are already resolved, so await does not change anything
518
+ `export default await _ENTRIES[middlewareEntryKey].default;`
519
+ );
515
520
  await mkdir(dirname(outputFile), { recursive: true });
516
- await writeFile(outputFile, [...parts, exports].join("\n"));
521
+ await writeFile(outputFile, parts.join("\n"));
517
522
  };
518
523
  var createEdgeHandler = async (ctx, definition) => {
519
524
  await copyHandlerDependencies(ctx, definition);
package/dist/index.js CHANGED
@@ -31,14 +31,24 @@ import {
31
31
  verifyNetlifyFormsWorkaround,
32
32
  verifyPublishDir
33
33
  } from "./build/verification.js";
34
+ var skipPlugin = process.env.NETLIFY_NEXT_PLUGIN_SKIP === "true" || process.env.NETLIFY_NEXT_PLUGIN_SKIP === "1";
35
+ var skipText = "Skipping Next.js plugin due to NETLIFY_NEXT_PLUGIN_SKIP environment variable.";
34
36
  var tracer = wrapTracer(trace.getTracer("Next.js runtime"));
35
37
  var onPreDev = async (options) => {
38
+ if (skipPlugin) {
39
+ console.warn(skipText);
40
+ return;
41
+ }
36
42
  await tracer.withActiveSpan("onPreDev", async () => {
37
43
  const context = new PluginContext(options);
38
44
  await rm(context.blobDir, { recursive: true, force: true });
39
45
  });
40
46
  };
41
47
  var onPreBuild = async (options) => {
48
+ if (skipPlugin) {
49
+ console.warn(skipText);
50
+ return;
51
+ }
42
52
  await tracer.withActiveSpan("onPreBuild", async () => {
43
53
  process.env.NEXT_PRIVATE_STANDALONE = "true";
44
54
  const ctx = new PluginContext(options);
@@ -51,6 +61,10 @@ var onPreBuild = async (options) => {
51
61
  });
52
62
  };
53
63
  var onBuild = async (options) => {
64
+ if (skipPlugin) {
65
+ console.warn(skipText);
66
+ return;
67
+ }
54
68
  await tracer.withActiveSpan("onBuild", async (span) => {
55
69
  const ctx = new PluginContext(options);
56
70
  verifyPublishDir(ctx);
@@ -75,11 +89,19 @@ var onBuild = async (options) => {
75
89
  });
76
90
  };
77
91
  var onPostBuild = async (options) => {
92
+ if (skipPlugin) {
93
+ console.warn(skipText);
94
+ return;
95
+ }
78
96
  await tracer.withActiveSpan("onPostBuild", async () => {
79
97
  await publishStaticDir(new PluginContext(options));
80
98
  });
81
99
  };
82
100
  var onSuccess = async () => {
101
+ if (skipPlugin) {
102
+ console.warn(skipText);
103
+ return;
104
+ }
83
105
  await tracer.withActiveSpan("onSuccess", async () => {
84
106
  const prewarm = [process.env.DEPLOY_URL, process.env.DEPLOY_PRIME_URL, process.env.URL].filter(
85
107
  // If running locally then the deploy ID is a placeholder value. Filtering for `https://0--` removes it.
@@ -89,6 +111,10 @@ var onSuccess = async () => {
89
111
  });
90
112
  };
91
113
  var onEnd = async (options) => {
114
+ if (skipPlugin) {
115
+ console.warn(skipText);
116
+ return;
117
+ }
92
118
  await tracer.withActiveSpan("onEnd", async () => {
93
119
  await unpublishStaticDir(new PluginContext(options));
94
120
  });
@@ -86,7 +86,7 @@ var pipeline = (0, import_util.promisify)(import_stream.pipeline);
86
86
 
87
87
  // package.json
88
88
  var name = "@netlify/plugin-nextjs";
89
- var version = "5.11.5";
89
+ var version = "5.12.0";
90
90
 
91
91
  // src/run/handlers/tags-handler.cts
92
92
  var import_storage = require("../storage/storage.cjs");
@@ -36,3 +36,8 @@ globalThis.require = function nextRuntimeMinimalRequireShim(name) {
36
36
  }
37
37
 
38
38
  var _ENTRIES = {}
39
+ try {
40
+ // turbopack builds use self._ENTRIES not globalThis._ENTRIES
41
+ // so making sure both points to same object
42
+ self._ENTRIES = _ENTRIES
43
+ } catch {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "5.11.5",
3
+ "version": "5.12.0",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",