@netlify/plugin-nextjs 5.9.0 → 5.9.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.
Files changed (35) hide show
  1. package/dist/build/content/prerendered.js +2 -2
  2. package/dist/build/content/static.js +2 -2
  3. package/dist/build/functions/edge.js +1 -1
  4. package/dist/esm-chunks/{chunk-BFYMHE3E.js → chunk-HGXG447M.js} +13 -0
  5. package/dist/esm-chunks/chunk-LVXJQ2G2.js +147 -0
  6. package/dist/esm-chunks/{chunk-KBX7SJLC.js → chunk-NEZW7TGG.js} +1 -1
  7. package/dist/esm-chunks/{next-4L47PQSM.js → next-H2VMRX5P.js} +2 -4
  8. package/dist/esm-chunks/{package-LCNINN36.js → package-36IBNZ37.js} +2 -2
  9. package/dist/index.js +4 -4
  10. package/dist/run/handlers/cache.cjs +251 -139
  11. package/dist/run/handlers/request-context.cjs +88 -63
  12. package/dist/run/handlers/server.js +4 -4
  13. package/dist/run/handlers/tracer.cjs +88 -57
  14. package/dist/run/handlers/tracing.js +2 -2
  15. package/dist/run/handlers/wait-until.cjs +88 -57
  16. package/dist/run/next.cjs +88 -59
  17. package/edge-runtime/lib/middleware.ts +1 -1
  18. package/edge-runtime/lib/response.ts +5 -2
  19. package/edge-runtime/vendor/deno.land/x/htmlrewriter@v1.0.0/pkg/htmlrewriter.js +1218 -0
  20. package/edge-runtime/vendor/deno.land/x/htmlrewriter@v1.0.0/pkg/htmlrewriter_bg.wasm +0 -0
  21. package/edge-runtime/vendor/deno.land/x/htmlrewriter@v1.0.0/src/index.ts +80 -0
  22. package/edge-runtime/vendor/deno.land/x/{html_rewriter@v0.1.0-pre.17/vendor/html_rewriter.d.ts → htmlrewriter@v1.0.0/src/types.d.ts} +8 -25
  23. package/edge-runtime/vendor/import_map.json +0 -2
  24. package/edge-runtime/vendor.ts +1 -1
  25. package/package.json +1 -1
  26. package/dist/esm-chunks/chunk-NDSDIXRD.js +0 -122
  27. package/edge-runtime/vendor/deno.land/std@0.134.0/fmt/colors.ts +0 -536
  28. package/edge-runtime/vendor/deno.land/std@0.134.0/testing/_diff.ts +0 -360
  29. package/edge-runtime/vendor/deno.land/std@0.134.0/testing/asserts.ts +0 -866
  30. package/edge-runtime/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/index.ts +0 -133
  31. package/edge-runtime/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/vendor/asyncify.js +0 -112
  32. package/edge-runtime/vendor/deno.land/x/html_rewriter@v0.1.0-pre.17/vendor/html_rewriter.js +0 -974
  33. package/edge-runtime/vendor/raw.githubusercontent.com/worker-tools/resolvable-promise/master/index.ts +0 -50
  34. package/dist/esm-chunks/{chunk-BVYZSEV6.js → chunk-J4D25YDX.js} +3 -3
  35. package/dist/esm-chunks/{chunk-HWMLYAVP.js → chunk-NTLBFRPA.js} +3 -3
@@ -7,14 +7,14 @@
7
7
  import {
8
8
  copyFetchContent,
9
9
  copyPrerenderedContent
10
- } from "../../esm-chunks/chunk-BVYZSEV6.js";
11
- import "../../esm-chunks/chunk-TYCYFZ22.js";
10
+ } from "../../esm-chunks/chunk-J4D25YDX.js";
12
11
  import "../../esm-chunks/chunk-5QSXBV7L.js";
13
12
  import "../../esm-chunks/chunk-GNGHTHMQ.js";
14
13
  import "../../esm-chunks/chunk-ZSVHJNNY.js";
15
14
  import "../../esm-chunks/chunk-KGYJQ2U2.js";
16
15
  import "../../esm-chunks/chunk-ZENB67PD.js";
17
16
  import "../../esm-chunks/chunk-APO262HE.js";
17
+ import "../../esm-chunks/chunk-TYCYFZ22.js";
18
18
  import "../../esm-chunks/chunk-OEQOKJGE.js";
19
19
  export {
20
20
  copyFetchContent,
@@ -10,14 +10,14 @@ import {
10
10
  copyStaticExport,
11
11
  publishStaticDir,
12
12
  unpublishStaticDir
13
- } from "../../esm-chunks/chunk-HWMLYAVP.js";
14
- import "../../esm-chunks/chunk-TYCYFZ22.js";
13
+ } from "../../esm-chunks/chunk-NTLBFRPA.js";
15
14
  import "../../esm-chunks/chunk-5QSXBV7L.js";
16
15
  import "../../esm-chunks/chunk-GNGHTHMQ.js";
17
16
  import "../../esm-chunks/chunk-ZSVHJNNY.js";
18
17
  import "../../esm-chunks/chunk-KGYJQ2U2.js";
19
18
  import "../../esm-chunks/chunk-ZENB67PD.js";
20
19
  import "../../esm-chunks/chunk-APO262HE.js";
20
+ import "../../esm-chunks/chunk-TYCYFZ22.js";
21
21
  import "../../esm-chunks/chunk-OEQOKJGE.js";
22
22
  export {
23
23
  copyStaticAssets,
@@ -7,7 +7,7 @@
7
7
  import {
8
8
  clearStaleEdgeHandlers,
9
9
  createEdgeHandlers
10
- } from "../../esm-chunks/chunk-BFYMHE3E.js";
10
+ } from "../../esm-chunks/chunk-HGXG447M.js";
11
11
  import "../../esm-chunks/chunk-GFYWJNQR.js";
12
12
  import "../../esm-chunks/chunk-KGYJQ2U2.js";
13
13
  import "../../esm-chunks/chunk-APO262HE.js";
@@ -462,11 +462,24 @@ var writeHandlerFile = async (ctx, { matchers, name }) => {
462
462
  join(handlerRuntimeDirectory, "next.config.json"),
463
463
  JSON.stringify(minimalNextConfig)
464
464
  );
465
+ const htmlRewriterWasm = await readFile(
466
+ join(
467
+ ctx.pluginDir,
468
+ "edge-runtime/vendor/deno.land/x/htmlrewriter@v1.0.0/pkg/htmlrewriter_bg.wasm"
469
+ )
470
+ );
465
471
  await writeFile(
466
472
  join(handlerDirectory, `${handlerName}.js`),
467
473
  `
474
+ import { decode as _base64Decode } from './edge-runtime/vendor/deno.land/std@0.175.0/encoding/base64.ts';
475
+ import { init as htmlRewriterInit } from './edge-runtime/vendor/deno.land/x/htmlrewriter@v1.0.0/src/index.ts'
468
476
  import {handleMiddleware} from './edge-runtime/middleware.ts';
469
477
  import handler from './server/${name}.js';
478
+
479
+ await htmlRewriterInit({ module_or_path: _base64Decode(${JSON.stringify(
480
+ htmlRewriterWasm.toString("base64")
481
+ )}).buffer });
482
+
470
483
  export default (req, context) => handleMiddleware(req, context, handler);
471
484
  `
472
485
  );
@@ -0,0 +1,147 @@
1
+
2
+ var require = await (async () => {
3
+ var { createRequire } = await import("node:module");
4
+ return createRequire(import.meta.url);
5
+ })();
6
+
7
+
8
+ // src/run/handlers/request-context.cts
9
+ import { AsyncLocalStorage } from "node:async_hooks";
10
+
11
+ // node_modules/@netlify/functions/dist/chunk-C6P2IO65.mjs
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __esm = (fn, res) => function __init() {
14
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
+ };
16
+
17
+ // node_modules/@netlify/functions/dist/chunk-ATZ7N7EG.mjs
18
+ import { env } from "process";
19
+ var systemLogTag;
20
+ var serializeError;
21
+ var LogLevel;
22
+ var SystemLogger;
23
+ var systemLogger;
24
+ var init_system_logger = __esm({
25
+ "src/lib/system_logger.ts"() {
26
+ systemLogTag = "__nfSystemLog";
27
+ serializeError = (error) => {
28
+ const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
29
+ return {
30
+ error: error.message,
31
+ error_cause: cause,
32
+ error_stack: error.stack
33
+ };
34
+ };
35
+ LogLevel = /* @__PURE__ */ ((LogLevel2) => {
36
+ LogLevel2[LogLevel2["Debug"] = 1] = "Debug";
37
+ LogLevel2[LogLevel2["Log"] = 2] = "Log";
38
+ LogLevel2[LogLevel2["Error"] = 3] = "Error";
39
+ return LogLevel2;
40
+ })(LogLevel || {});
41
+ SystemLogger = class _SystemLogger {
42
+ fields;
43
+ logLevel;
44
+ constructor(fields = {}, logLevel = 2) {
45
+ this.fields = fields;
46
+ this.logLevel = logLevel;
47
+ }
48
+ doLog(logger, message) {
49
+ if (env.NETLIFY_DEV && !env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
50
+ return;
51
+ }
52
+ logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
53
+ }
54
+ log(message) {
55
+ if (this.logLevel > 2) {
56
+ return;
57
+ }
58
+ this.doLog(console.log, message);
59
+ }
60
+ debug(message) {
61
+ if (this.logLevel > 1) {
62
+ return;
63
+ }
64
+ this.doLog(console.debug, message);
65
+ }
66
+ error(message) {
67
+ if (this.logLevel > 3) {
68
+ return;
69
+ }
70
+ this.doLog(console.error, message);
71
+ }
72
+ withLogLevel(level) {
73
+ return new _SystemLogger(this.fields, level);
74
+ }
75
+ withFields(fields) {
76
+ return new _SystemLogger(
77
+ {
78
+ ...this.fields,
79
+ ...fields
80
+ },
81
+ this.logLevel
82
+ );
83
+ }
84
+ withError(error) {
85
+ const fields = error instanceof Error ? serializeError(error) : { error };
86
+ return this.withFields(fields);
87
+ }
88
+ };
89
+ systemLogger = new SystemLogger();
90
+ }
91
+ });
92
+
93
+ // node_modules/@netlify/functions/dist/chunk-7ANA32NV.mjs
94
+ var init_internal = __esm({
95
+ "src/internal.ts"() {
96
+ init_system_logger();
97
+ }
98
+ });
99
+
100
+ // node_modules/@netlify/functions/dist/internal.mjs
101
+ init_internal();
102
+
103
+ // src/run/handlers/request-context.cts
104
+ function createRequestContext(request, context) {
105
+ const backgroundWorkPromises = [];
106
+ return {
107
+ captureServerTiming: request?.headers.has("x-next-debug-logging") ?? false,
108
+ trackBackgroundWork: (promise) => {
109
+ if (context?.waitUntil) {
110
+ context.waitUntil(promise);
111
+ } else {
112
+ backgroundWorkPromises.push(promise);
113
+ }
114
+ },
115
+ get backgroundWorkPromise() {
116
+ return Promise.allSettled(backgroundWorkPromises);
117
+ },
118
+ logger: systemLogger.withLogLevel(
119
+ request?.headers.has("x-nf-debug-logging") || request?.headers.has("x-next-debug-logging") ? LogLevel.Debug : LogLevel.Log
120
+ )
121
+ };
122
+ }
123
+ var REQUEST_CONTEXT_GLOBAL_KEY = Symbol.for("nf-request-context-async-local-storage");
124
+ var requestContextAsyncLocalStorage;
125
+ function getRequestContextAsyncLocalStorage() {
126
+ if (requestContextAsyncLocalStorage) {
127
+ return requestContextAsyncLocalStorage;
128
+ }
129
+ const extendedGlobalThis = globalThis;
130
+ if (extendedGlobalThis[REQUEST_CONTEXT_GLOBAL_KEY]) {
131
+ return extendedGlobalThis[REQUEST_CONTEXT_GLOBAL_KEY];
132
+ }
133
+ const storage = new AsyncLocalStorage();
134
+ requestContextAsyncLocalStorage = storage;
135
+ extendedGlobalThis[REQUEST_CONTEXT_GLOBAL_KEY] = storage;
136
+ return storage;
137
+ }
138
+ var getRequestContext = () => getRequestContextAsyncLocalStorage().getStore();
139
+ function getLogger() {
140
+ return getRequestContext()?.logger ?? systemLogger;
141
+ }
142
+
143
+ export {
144
+ createRequestContext,
145
+ getRequestContext,
146
+ getLogger
147
+ };
@@ -6,7 +6,7 @@
6
6
 
7
7
  import {
8
8
  getRequestContext
9
- } from "./chunk-NDSDIXRD.js";
9
+ } from "./chunk-LVXJQ2G2.js";
10
10
  import {
11
11
  wrapTracer
12
12
  } from "./chunk-5QSXBV7L.js";
@@ -6,10 +6,10 @@
6
6
 
7
7
  import {
8
8
  getTracer
9
- } from "./chunk-KBX7SJLC.js";
9
+ } from "./chunk-NEZW7TGG.js";
10
10
  import {
11
11
  getRequestContext
12
- } from "./chunk-NDSDIXRD.js";
12
+ } from "./chunk-LVXJQ2G2.js";
13
13
  import {
14
14
  getRegionalBlobStore
15
15
  } from "./chunk-K4RDUZYO.js";
@@ -478,7 +478,6 @@ var import_fs_monkey = __toESM(require_lib());
478
478
  import fs from "fs/promises";
479
479
  import { relative, resolve } from "path";
480
480
  process.env.NODE_ENV = "production";
481
- console.time("import next server");
482
481
  var { getRequestHandlers } = __require("next/dist/server/lib/start-server.js");
483
482
  var ResponseCache = __require("next/dist/server/response-cache/index.js").default;
484
483
  var originalGet = ResponseCache.prototype.get;
@@ -523,7 +522,6 @@ ResponseCache.prototype.get = function get(...getArgs) {
523
522
  }
524
523
  return originalGet.apply(this, getArgs);
525
524
  };
526
- console.timeEnd("import next server");
527
525
  async function getMockedRequestHandler(...args) {
528
526
  const tracer = getTracer();
529
527
  return tracer.withActiveSpan("mocked request handler", async () => {
@@ -8,7 +8,7 @@ import "./chunk-OEQOKJGE.js";
8
8
 
9
9
  // package.json
10
10
  var name = "@netlify/plugin-nextjs";
11
- var version = "5.9.0";
11
+ var version = "5.9.2";
12
12
  var description = "Run Next.js seamlessly on Netlify";
13
13
  var main = "./dist/index.js";
14
14
  var type = "module";
@@ -62,7 +62,7 @@ var devDependencies = {
62
62
  "@netlify/edge-bundler": "^12.2.3",
63
63
  "@netlify/edge-functions": "^2.11.0",
64
64
  "@netlify/eslint-config-node": "^7.0.1",
65
- "@netlify/functions": "^2.8.2",
65
+ "@netlify/functions": "^3.0.0",
66
66
  "@netlify/serverless-functions-api": "^1.30.1",
67
67
  "@netlify/zip-it-and-ship-it": "^9.41.0",
68
68
  "@opentelemetry/api": "^1.8.0",
package/dist/index.js CHANGED
@@ -7,14 +7,14 @@
7
7
  import {
8
8
  clearStaleEdgeHandlers,
9
9
  createEdgeHandlers
10
- } from "./esm-chunks/chunk-BFYMHE3E.js";
10
+ } from "./esm-chunks/chunk-HGXG447M.js";
11
11
  import {
12
12
  clearStaleServerHandlers,
13
13
  createServerHandler
14
14
  } from "./esm-chunks/chunk-DLVROEVU.js";
15
15
  import {
16
16
  copyPrerenderedContent
17
- } from "./esm-chunks/chunk-BVYZSEV6.js";
17
+ } from "./esm-chunks/chunk-J4D25YDX.js";
18
18
  import "./esm-chunks/chunk-IJZEDP6B.js";
19
19
  import {
20
20
  copyStaticAssets,
@@ -22,8 +22,7 @@ import {
22
22
  copyStaticExport,
23
23
  publishStaticDir,
24
24
  unpublishStaticDir
25
- } from "./esm-chunks/chunk-HWMLYAVP.js";
26
- import "./esm-chunks/chunk-TYCYFZ22.js";
25
+ } from "./esm-chunks/chunk-NTLBFRPA.js";
27
26
  import {
28
27
  wrapTracer
29
28
  } from "./esm-chunks/chunk-5QSXBV7L.js";
@@ -49,6 +48,7 @@ import {
49
48
  import "./esm-chunks/chunk-KGYJQ2U2.js";
50
49
  import "./esm-chunks/chunk-ZENB67PD.js";
51
50
  import "./esm-chunks/chunk-APO262HE.js";
51
+ import "./esm-chunks/chunk-TYCYFZ22.js";
52
52
  import "./esm-chunks/chunk-UYKENJEU.js";
53
53
  import "./esm-chunks/chunk-OEQOKJGE.js";
54
54