@netlify/plugin-nextjs 5.10.7 → 5.11.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.
Files changed (33) hide show
  1. package/dist/build/advanced-api-routes.js +1 -1
  2. package/dist/build/cache.js +1 -1
  3. package/dist/build/content/prerendered.js +5 -9
  4. package/dist/build/content/server.js +22 -15
  5. package/dist/build/content/static.js +4 -8
  6. package/dist/build/functions/edge.js +2 -2
  7. package/dist/build/functions/server.js +4 -8
  8. package/dist/build/image-cdn.js +1 -1
  9. package/dist/build/plugin-context.js +2 -2
  10. package/dist/build/templates/handler-monorepo.tmpl.js +0 -5
  11. package/dist/build/templates/handler.tmpl.js +0 -4
  12. package/dist/build/verification.js +3 -3
  13. package/dist/esm-chunks/{chunk-OEQOKJGE.js → chunk-6BT4RYQJ.js} +1 -12
  14. package/dist/esm-chunks/chunk-FKDTZJRV.js +832 -0
  15. package/dist/esm-chunks/{chunk-APO262HE.js → chunk-PFLHY2KD.js} +1 -1
  16. package/dist/esm-chunks/{chunk-NFOLXH6F.js → chunk-YUXQHOYO.js} +1 -1
  17. package/dist/index.js +3 -7
  18. package/dist/run/config.js +3 -3
  19. package/dist/run/constants.js +3 -3
  20. package/dist/run/handlers/cache.cjs +24 -234
  21. package/dist/run/handlers/request-context.cjs +63 -88
  22. package/dist/run/handlers/server.js +9 -6
  23. package/dist/run/handlers/tags-handler.cjs +192 -0
  24. package/dist/run/handlers/tracer.cjs +4 -4
  25. package/dist/run/handlers/use-cache-handler.js +1553 -0
  26. package/dist/run/headers.js +1 -1
  27. package/dist/run/revalidate.js +1 -1
  28. package/dist/shared/blobkey.js +1 -1
  29. package/package.json +1 -1
  30. package/dist/esm-chunks/chunk-5QSXBV7L.js +0 -89
  31. package/dist/esm-chunks/chunk-GNGHTHMQ.js +0 -1624
  32. package/dist/esm-chunks/package-SGSU42JZ.js +0 -148
  33. package/dist/run/handlers/tracing.js +0 -68968
@@ -6,7 +6,7 @@
6
6
 
7
7
  import {
8
8
  __require
9
- } from "../esm-chunks/chunk-OEQOKJGE.js";
9
+ } from "../esm-chunks/chunk-6BT4RYQJ.js";
10
10
 
11
11
  // src/build/advanced-api-routes.ts
12
12
  import { existsSync } from "node:fs";
@@ -4,7 +4,7 @@
4
4
  return createRequire(import.meta.url);
5
5
  })();
6
6
 
7
- import "../esm-chunks/chunk-OEQOKJGE.js";
7
+ import "../esm-chunks/chunk-6BT4RYQJ.js";
8
8
 
9
9
  // src/build/cache.ts
10
10
  import { existsSync } from "node:fs";
@@ -5,24 +5,20 @@
5
5
  })();
6
6
 
7
7
  import {
8
+ trace,
8
9
  wrapTracer
9
- } from "../../esm-chunks/chunk-5QSXBV7L.js";
10
- import {
11
- init_esm,
12
- trace
13
- } from "../../esm-chunks/chunk-GNGHTHMQ.js";
10
+ } from "../../esm-chunks/chunk-FKDTZJRV.js";
14
11
  import {
15
12
  require_out
16
- } from "../../esm-chunks/chunk-NFOLXH6F.js";
13
+ } from "../../esm-chunks/chunk-YUXQHOYO.js";
17
14
  import {
18
15
  require_semver
19
- } from "../../esm-chunks/chunk-APO262HE.js";
16
+ } from "../../esm-chunks/chunk-PFLHY2KD.js";
20
17
  import {
21
18
  __toESM
22
- } from "../../esm-chunks/chunk-OEQOKJGE.js";
19
+ } from "../../esm-chunks/chunk-6BT4RYQJ.js";
23
20
 
24
21
  // src/build/content/prerendered.ts
25
- init_esm();
26
22
  import { existsSync } from "node:fs";
27
23
  import { mkdir, readFile, writeFile } from "node:fs/promises";
28
24
  import { join } from "node:path";
@@ -5,24 +5,20 @@
5
5
  })();
6
6
 
7
7
  import {
8
+ trace,
8
9
  wrapTracer
9
- } from "../../esm-chunks/chunk-5QSXBV7L.js";
10
- import {
11
- init_esm,
12
- trace
13
- } from "../../esm-chunks/chunk-GNGHTHMQ.js";
10
+ } from "../../esm-chunks/chunk-FKDTZJRV.js";
14
11
  import {
15
12
  require_out
16
- } from "../../esm-chunks/chunk-NFOLXH6F.js";
13
+ } from "../../esm-chunks/chunk-YUXQHOYO.js";
17
14
  import {
18
15
  require_semver
19
- } from "../../esm-chunks/chunk-APO262HE.js";
16
+ } from "../../esm-chunks/chunk-PFLHY2KD.js";
20
17
  import {
21
18
  __toESM
22
- } from "../../esm-chunks/chunk-OEQOKJGE.js";
19
+ } from "../../esm-chunks/chunk-6BT4RYQJ.js";
23
20
 
24
21
  // src/build/content/server.ts
25
- init_esm();
26
22
  import { existsSync } from "node:fs";
27
23
  import {
28
24
  access,
@@ -39,7 +35,7 @@ import { dirname, join, resolve, sep } from "node:path";
39
35
  import { join as posixJoin, sep as posixSep } from "node:path/posix";
40
36
  var import_fast_glob = __toESM(require_out(), 1);
41
37
  var import_semver = __toESM(require_semver(), 1);
42
- import { RUN_CONFIG } from "../../run/constants.js";
38
+ import { RUN_CONFIG_FILE } from "../../run/constants.js";
43
39
  var tracer = wrapTracer(trace.getTracer("Next runtime"));
44
40
  var toPosixPath = (path) => path.split(sep).join(posixSep);
45
41
  function isError(error) {
@@ -64,15 +60,24 @@ var copyNextServerCode = async (ctx) => {
64
60
  throw error;
65
61
  }
66
62
  }
67
- const reqServerFiles = JSON.parse(await readFile(reqServerFilesPath, "utf-8"));
63
+ const reqServerFiles = JSON.parse(
64
+ await readFile(reqServerFilesPath, "utf-8")
65
+ );
68
66
  if (toPosixPath(ctx.distDir).replace(new RegExp(`^${ctx.relativeAppDir}/?`), "") !== reqServerFiles.config.distDir) {
69
67
  reqServerFiles.config.distDir = ctx.nextDistDir;
70
68
  await writeFile(reqServerFilesPath, JSON.stringify(reqServerFiles));
71
69
  }
72
70
  await mkdir(ctx.serverHandlerDir, { recursive: true });
73
71
  await writeFile(
74
- join(ctx.serverHandlerDir, RUN_CONFIG),
75
- JSON.stringify(reqServerFiles.config),
72
+ join(ctx.serverHandlerDir, RUN_CONFIG_FILE),
73
+ JSON.stringify({
74
+ nextConfig: reqServerFiles.config,
75
+ // only enable setting up 'use cache' handler when Next.js supports CacheHandlerV2 as we don't have V1 compatible implementation
76
+ // see https://github.com/vercel/next.js/pull/76687 first released in v15.3.0-canary.13
77
+ enableUseCacheHandler: ctx.nextVersion ? (0, import_semver.satisfies)(ctx.nextVersion, ">=15.3.0-canary.13", {
78
+ includePrerelease: true
79
+ }) : false
80
+ }),
76
81
  "utf-8"
77
82
  );
78
83
  const srcDir = join(ctx.standaloneDir, ctx.nextDistDir);
@@ -216,8 +221,10 @@ var replaceMiddlewareManifest = async (sourcePath, destPath) => {
216
221
  await writeFile(destPath, newData);
217
222
  };
218
223
  var verifyHandlerDirStructure = async (ctx) => {
219
- const runConfig = JSON.parse(await readFile(join(ctx.serverHandlerDir, RUN_CONFIG), "utf-8"));
220
- const expectedBuildIDPath = join(ctx.serverHandlerDir, runConfig.distDir, "BUILD_ID");
224
+ const { nextConfig } = JSON.parse(
225
+ await readFile(join(ctx.serverHandlerDir, RUN_CONFIG_FILE), "utf-8")
226
+ );
227
+ const expectedBuildIDPath = join(ctx.serverHandlerDir, nextConfig.distDir, "BUILD_ID");
221
228
  if (!existsSync(expectedBuildIDPath)) {
222
229
  ctx.failBuild(
223
230
  `Failed creating server handler. BUILD_ID file not found at expected location "${expectedBuildIDPath}".`
@@ -5,21 +5,17 @@
5
5
  })();
6
6
 
7
7
  import {
8
+ trace,
8
9
  wrapTracer
9
- } from "../../esm-chunks/chunk-5QSXBV7L.js";
10
- import {
11
- init_esm,
12
- trace
13
- } from "../../esm-chunks/chunk-GNGHTHMQ.js";
10
+ } from "../../esm-chunks/chunk-FKDTZJRV.js";
14
11
  import {
15
12
  require_out
16
- } from "../../esm-chunks/chunk-NFOLXH6F.js";
13
+ } from "../../esm-chunks/chunk-YUXQHOYO.js";
17
14
  import {
18
15
  __toESM
19
- } from "../../esm-chunks/chunk-OEQOKJGE.js";
16
+ } from "../../esm-chunks/chunk-6BT4RYQJ.js";
20
17
 
21
18
  // src/build/content/static.ts
22
- init_esm();
23
19
  import { existsSync } from "node:fs";
24
20
  import { cp, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
25
21
  import { basename, join } from "node:path";
@@ -6,11 +6,11 @@
6
6
 
7
7
  import {
8
8
  require_out
9
- } from "../../esm-chunks/chunk-NFOLXH6F.js";
9
+ } from "../../esm-chunks/chunk-YUXQHOYO.js";
10
10
  import {
11
11
  __commonJS,
12
12
  __toESM
13
- } from "../../esm-chunks/chunk-OEQOKJGE.js";
13
+ } from "../../esm-chunks/chunk-6BT4RYQJ.js";
14
14
 
15
15
  // node_modules/path-to-regexp/dist/index.js
16
16
  var require_dist = __commonJS({
@@ -5,21 +5,17 @@
5
5
  })();
6
6
 
7
7
  import {
8
+ trace,
8
9
  wrapTracer
9
- } from "../../esm-chunks/chunk-5QSXBV7L.js";
10
- import {
11
- init_esm,
12
- trace
13
- } from "../../esm-chunks/chunk-GNGHTHMQ.js";
10
+ } from "../../esm-chunks/chunk-FKDTZJRV.js";
14
11
  import {
15
12
  require_out
16
- } from "../../esm-chunks/chunk-NFOLXH6F.js";
13
+ } from "../../esm-chunks/chunk-YUXQHOYO.js";
17
14
  import {
18
15
  __toESM
19
- } from "../../esm-chunks/chunk-OEQOKJGE.js";
16
+ } from "../../esm-chunks/chunk-6BT4RYQJ.js";
20
17
 
21
18
  // src/build/functions/server.ts
22
- init_esm();
23
19
  import { cp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
24
20
  import { join, relative } from "node:path";
25
21
  import { join as posixJoin } from "node:path/posix";
@@ -7,7 +7,7 @@
7
7
  import {
8
8
  __commonJS,
9
9
  __toESM
10
- } from "../esm-chunks/chunk-OEQOKJGE.js";
10
+ } from "../esm-chunks/chunk-6BT4RYQJ.js";
11
11
 
12
12
  // node_modules/picomatch/lib/constants.js
13
13
  var require_constants = __commonJS({
@@ -6,10 +6,10 @@
6
6
 
7
7
  import {
8
8
  require_semver
9
- } from "../esm-chunks/chunk-APO262HE.js";
9
+ } from "../esm-chunks/chunk-PFLHY2KD.js";
10
10
  import {
11
11
  __toESM
12
- } from "../esm-chunks/chunk-OEQOKJGE.js";
12
+ } from "../esm-chunks/chunk-6BT4RYQJ.js";
13
13
 
14
14
  // src/build/plugin-context.ts
15
15
  var import_semver = __toESM(require_semver(), 1);
@@ -3,7 +3,6 @@ import {
3
3
  runWithRequestContext,
4
4
  } from '{{cwd}}/.netlify/dist/run/handlers/request-context.cjs'
5
5
  import { getTracer } from '{{cwd}}/.netlify/dist/run/handlers/tracer.cjs'
6
- import tracing from '{{cwd}}/.netlify/dist/run/handlers/tracing.js'
7
6
 
8
7
  process.chdir('{{cwd}}')
9
8
 
@@ -12,10 +11,6 @@ process.env.USE_REGIONAL_BLOBS = '{{useRegionalBlobs}}'
12
11
 
13
12
  let cachedHandler
14
13
  export default async function (req, context) {
15
- if (process.env.NETLIFY_OTLP_TRACE_EXPORTER_URL) {
16
- tracing.start()
17
- }
18
-
19
14
  const requestContext = createRequestContext(req, context)
20
15
  const tracer = getTracer()
21
16
 
@@ -4,15 +4,11 @@ import {
4
4
  } from './.netlify/dist/run/handlers/request-context.cjs'
5
5
  import serverHandler from './.netlify/dist/run/handlers/server.js'
6
6
  import { getTracer } from './.netlify/dist/run/handlers/tracer.cjs'
7
- import tracing from './.netlify/dist/run/handlers/tracing.js'
8
7
 
9
8
  // Set feature flag for regional blobs
10
9
  process.env.USE_REGIONAL_BLOBS = '{{useRegionalBlobs}}'
11
10
 
12
11
  export default async function handler(req, context) {
13
- if (process.env.NETLIFY_OTLP_TRACE_EXPORTER_URL) {
14
- tracing.start()
15
- }
16
12
  const requestContext = createRequestContext(req, context)
17
13
  const tracer = getTracer()
18
14
 
@@ -6,13 +6,13 @@
6
6
 
7
7
  import {
8
8
  require_out
9
- } from "../esm-chunks/chunk-NFOLXH6F.js";
9
+ } from "../esm-chunks/chunk-YUXQHOYO.js";
10
10
  import {
11
11
  require_semver
12
- } from "../esm-chunks/chunk-APO262HE.js";
12
+ } from "../esm-chunks/chunk-PFLHY2KD.js";
13
13
  import {
14
14
  __toESM
15
- } from "../esm-chunks/chunk-OEQOKJGE.js";
15
+ } from "../esm-chunks/chunk-6BT4RYQJ.js";
16
16
 
17
17
  // src/build/verification.ts
18
18
  var import_fast_glob = __toESM(require_out(), 1);
@@ -16,16 +16,9 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
16
16
  if (typeof require !== "undefined") return require.apply(this, arguments);
17
17
  throw Error('Dynamic require of "' + x + '" is not supported');
18
18
  });
19
- var __esm = (fn, res) => function __init() {
20
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
21
- };
22
19
  var __commonJS = (cb, mod) => function __require2() {
23
20
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
21
  };
25
- var __export = (target, all) => {
26
- for (var name in all)
27
- __defProp(target, name, { get: all[name], enumerable: true });
28
- };
29
22
  var __copyProps = (to, from, except, desc) => {
30
23
  if (from && typeof from === "object" || typeof from === "function") {
31
24
  for (let key of __getOwnPropNames(from))
@@ -42,13 +35,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
42
35
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
36
  mod
44
37
  ));
45
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
38
 
47
39
  export {
48
40
  __require,
49
- __esm,
50
41
  __commonJS,
51
- __export,
52
- __toESM,
53
- __toCommonJS
42
+ __toESM
54
43
  };