@netlify/plugin-nextjs 5.9.1 → 5.9.3-background-debug-logs.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.
- package/dist/build/content/prerendered.js +2 -2
- package/dist/build/content/static.js +2 -2
- package/dist/esm-chunks/{chunk-XS27YRA5.js → chunk-5N54G5SN.js} +1 -1
- package/dist/esm-chunks/chunk-FB56KFLR.js +156 -0
- package/dist/esm-chunks/{chunk-KBX7SJLC.js → chunk-PG4KVN6X.js} +1 -1
- package/dist/esm-chunks/{next-4L47PQSM.js → next-FWMVEHSM.js} +10 -6
- package/dist/esm-chunks/{package-BD57IC76.js → package-W4QAAZFL.js} +2 -2
- package/dist/index.js +3 -3
- package/dist/run/handlers/cache.cjs +257 -141
- package/dist/run/handlers/request-context.cjs +100 -66
- package/dist/run/handlers/server.js +14 -7
- package/dist/run/handlers/tracer.cjs +88 -57
- package/dist/run/handlers/tracing.js +2 -2
- package/dist/run/handlers/wait-until.cjs +92 -58
- package/dist/run/next.cjs +96 -61
- package/dist/run/revalidate.js +1 -1
- package/package.json +1 -1
- package/dist/esm-chunks/chunk-NDSDIXRD.js +0 -122
- package/dist/esm-chunks/{chunk-BVYZSEV6.js → chunk-J4D25YDX.js} +3 -3
- package/dist/esm-chunks/{chunk-HWMLYAVP.js → chunk-NTLBFRPA.js} +3 -3
package/dist/run/next.cjs
CHANGED
|
@@ -523,66 +523,97 @@ var import_fs_monkey = __toESM(require_lib());
|
|
|
523
523
|
// src/run/handlers/request-context.cts
|
|
524
524
|
var import_node_async_hooks = require("node:async_hooks");
|
|
525
525
|
|
|
526
|
-
// node_modules/@netlify/functions/dist/chunk-
|
|
527
|
-
var
|
|
528
|
-
var
|
|
529
|
-
|
|
530
|
-
const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
|
|
531
|
-
return {
|
|
532
|
-
error: error.message,
|
|
533
|
-
error_cause: cause,
|
|
534
|
-
error_stack: error.stack
|
|
535
|
-
};
|
|
526
|
+
// node_modules/@netlify/functions/dist/chunk-C6P2IO65.mjs
|
|
527
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
528
|
+
var __esm2 = (fn, res) => function __init() {
|
|
529
|
+
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
536
530
|
};
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
531
|
+
|
|
532
|
+
// node_modules/@netlify/functions/dist/chunk-ATZ7N7EG.mjs
|
|
533
|
+
var import_process = require("process");
|
|
534
|
+
var systemLogTag;
|
|
535
|
+
var serializeError;
|
|
536
|
+
var LogLevel;
|
|
537
|
+
var SystemLogger;
|
|
538
|
+
var systemLogger;
|
|
539
|
+
var init_system_logger = __esm2({
|
|
540
|
+
"src/lib/system_logger.ts"() {
|
|
541
|
+
systemLogTag = "__nfSystemLog";
|
|
542
|
+
serializeError = (error) => {
|
|
543
|
+
const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
|
|
544
|
+
return {
|
|
545
|
+
error: error.message,
|
|
546
|
+
error_cause: cause,
|
|
547
|
+
error_stack: error.stack
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
551
|
+
LogLevel2[LogLevel2["Debug"] = 1] = "Debug";
|
|
552
|
+
LogLevel2[LogLevel2["Log"] = 2] = "Log";
|
|
553
|
+
LogLevel2[LogLevel2["Error"] = 3] = "Error";
|
|
554
|
+
return LogLevel2;
|
|
555
|
+
})(LogLevel || {});
|
|
556
|
+
SystemLogger = class _SystemLogger {
|
|
557
|
+
fields;
|
|
558
|
+
logLevel;
|
|
559
|
+
constructor(fields = {}, logLevel = 2) {
|
|
560
|
+
this.fields = fields;
|
|
561
|
+
this.logLevel = logLevel;
|
|
562
|
+
}
|
|
563
|
+
doLog(logger, message) {
|
|
564
|
+
if (import_process.env.NETLIFY_DEV && !import_process.env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
|
|
568
|
+
}
|
|
569
|
+
log(message) {
|
|
570
|
+
if (this.logLevel > 2) {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
this.doLog(console.log, message);
|
|
574
|
+
}
|
|
575
|
+
debug(message) {
|
|
576
|
+
if (this.logLevel > 1) {
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
this.doLog(console.debug, message);
|
|
580
|
+
}
|
|
581
|
+
error(message) {
|
|
582
|
+
if (this.logLevel > 3) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
this.doLog(console.error, message);
|
|
586
|
+
}
|
|
587
|
+
withLogLevel(level) {
|
|
588
|
+
return new _SystemLogger(this.fields, level);
|
|
589
|
+
}
|
|
590
|
+
withFields(fields) {
|
|
591
|
+
return new _SystemLogger(
|
|
592
|
+
{
|
|
593
|
+
...this.fields,
|
|
594
|
+
...fields
|
|
595
|
+
},
|
|
596
|
+
this.logLevel
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
withError(error) {
|
|
600
|
+
const fields = error instanceof Error ? serializeError(error) : { error };
|
|
601
|
+
return this.withFields(fields);
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
systemLogger = new SystemLogger();
|
|
579
605
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
// node_modules/@netlify/functions/dist/chunk-7ANA32NV.mjs
|
|
609
|
+
var init_internal = __esm2({
|
|
610
|
+
"src/internal.ts"() {
|
|
611
|
+
init_system_logger();
|
|
583
612
|
}
|
|
584
|
-
};
|
|
585
|
-
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
// node_modules/@netlify/functions/dist/internal.mjs
|
|
616
|
+
init_internal();
|
|
586
617
|
|
|
587
618
|
// src/run/handlers/request-context.cts
|
|
588
619
|
var REQUEST_CONTEXT_GLOBAL_KEY = Symbol.for("nf-request-context-async-local-storage");
|
|
@@ -2076,7 +2107,6 @@ var getRegionalBlobStore = (args = {}) => {
|
|
|
2076
2107
|
|
|
2077
2108
|
// src/run/next.cts
|
|
2078
2109
|
process.env.NODE_ENV = "production";
|
|
2079
|
-
console.time("import next server");
|
|
2080
2110
|
var { getRequestHandlers } = require("next/dist/server/lib/start-server.js");
|
|
2081
2111
|
var ResponseCache = require("next/dist/server/response-cache/index.js").default;
|
|
2082
2112
|
var originalGet = ResponseCache.prototype.get;
|
|
@@ -2089,7 +2119,10 @@ ResponseCache.prototype.get = function get(...getArgs) {
|
|
|
2089
2119
|
const workPromise = fn(...workFnArgs);
|
|
2090
2120
|
const requestContext = getRequestContext();
|
|
2091
2121
|
if (requestContext && workPromise instanceof Promise) {
|
|
2092
|
-
requestContext.trackBackgroundWork(
|
|
2122
|
+
requestContext.trackBackgroundWork(
|
|
2123
|
+
workPromise,
|
|
2124
|
+
`responseCache batcher ${JSON.stringify(key)}`
|
|
2125
|
+
);
|
|
2093
2126
|
}
|
|
2094
2127
|
return await workPromise;
|
|
2095
2128
|
};
|
|
@@ -2104,7 +2137,10 @@ ResponseCache.prototype.get = function get(...getArgs) {
|
|
|
2104
2137
|
const workPromise = new Promise((_resolve) => {
|
|
2105
2138
|
backgroundWork.set(key, _resolve);
|
|
2106
2139
|
});
|
|
2107
|
-
requestContext.trackBackgroundWork(
|
|
2140
|
+
requestContext.trackBackgroundWork(
|
|
2141
|
+
workPromise,
|
|
2142
|
+
`responseCache pendingResponses ${JSON.stringify(key)}`
|
|
2143
|
+
);
|
|
2108
2144
|
}
|
|
2109
2145
|
return originalPendingResponsesSet.call(this.pendingResponses, key, value);
|
|
2110
2146
|
};
|
|
@@ -2121,7 +2157,6 @@ ResponseCache.prototype.get = function get(...getArgs) {
|
|
|
2121
2157
|
}
|
|
2122
2158
|
return originalGet.apply(this, getArgs);
|
|
2123
2159
|
};
|
|
2124
|
-
console.timeEnd("import next server");
|
|
2125
2160
|
async function getMockedRequestHandler(...args) {
|
|
2126
2161
|
const tracer2 = getTracer();
|
|
2127
2162
|
return tracer2.withActiveSpan("mocked request handler", async () => {
|
package/dist/run/revalidate.js
CHANGED
package/package.json
CHANGED
|
@@ -1,122 +0,0 @@
|
|
|
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-HYMERDCV.mjs
|
|
12
|
-
import { env } from "process";
|
|
13
|
-
var systemLogTag = "__nfSystemLog";
|
|
14
|
-
var serializeError = (error) => {
|
|
15
|
-
const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
|
|
16
|
-
return {
|
|
17
|
-
error: error.message,
|
|
18
|
-
error_cause: cause,
|
|
19
|
-
error_stack: error.stack
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
23
|
-
LogLevel2[LogLevel2["Debug"] = 1] = "Debug";
|
|
24
|
-
LogLevel2[LogLevel2["Log"] = 2] = "Log";
|
|
25
|
-
LogLevel2[LogLevel2["Error"] = 3] = "Error";
|
|
26
|
-
return LogLevel2;
|
|
27
|
-
})(LogLevel || {});
|
|
28
|
-
var SystemLogger = class _SystemLogger {
|
|
29
|
-
fields;
|
|
30
|
-
logLevel;
|
|
31
|
-
constructor(fields = {}, logLevel = 2) {
|
|
32
|
-
this.fields = fields;
|
|
33
|
-
this.logLevel = logLevel;
|
|
34
|
-
}
|
|
35
|
-
doLog(logger, message) {
|
|
36
|
-
if (env.NETLIFY_DEV && !env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
|
|
40
|
-
}
|
|
41
|
-
log(message) {
|
|
42
|
-
if (this.logLevel > 2) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
this.doLog(console.log, message);
|
|
46
|
-
}
|
|
47
|
-
debug(message) {
|
|
48
|
-
if (this.logLevel > 1) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
this.doLog(console.debug, message);
|
|
52
|
-
}
|
|
53
|
-
error(message) {
|
|
54
|
-
if (this.logLevel > 3) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
this.doLog(console.error, message);
|
|
58
|
-
}
|
|
59
|
-
withLogLevel(level) {
|
|
60
|
-
return new _SystemLogger(this.fields, level);
|
|
61
|
-
}
|
|
62
|
-
withFields(fields) {
|
|
63
|
-
return new _SystemLogger(
|
|
64
|
-
{
|
|
65
|
-
...this.fields,
|
|
66
|
-
...fields
|
|
67
|
-
},
|
|
68
|
-
this.logLevel
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
withError(error) {
|
|
72
|
-
const fields = error instanceof Error ? serializeError(error) : { error };
|
|
73
|
-
return this.withFields(fields);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
var systemLogger = new SystemLogger();
|
|
77
|
-
|
|
78
|
-
// src/run/handlers/request-context.cts
|
|
79
|
-
function createRequestContext(request, context) {
|
|
80
|
-
const backgroundWorkPromises = [];
|
|
81
|
-
return {
|
|
82
|
-
captureServerTiming: request?.headers.has("x-next-debug-logging") ?? false,
|
|
83
|
-
trackBackgroundWork: (promise) => {
|
|
84
|
-
if (context?.waitUntil) {
|
|
85
|
-
context.waitUntil(promise);
|
|
86
|
-
} else {
|
|
87
|
-
backgroundWorkPromises.push(promise);
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
get backgroundWorkPromise() {
|
|
91
|
-
return Promise.allSettled(backgroundWorkPromises);
|
|
92
|
-
},
|
|
93
|
-
logger: systemLogger.withLogLevel(
|
|
94
|
-
request?.headers.has("x-nf-debug-logging") || request?.headers.has("x-next-debug-logging") ? LogLevel.Debug : LogLevel.Log
|
|
95
|
-
)
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
var REQUEST_CONTEXT_GLOBAL_KEY = Symbol.for("nf-request-context-async-local-storage");
|
|
99
|
-
var requestContextAsyncLocalStorage;
|
|
100
|
-
function getRequestContextAsyncLocalStorage() {
|
|
101
|
-
if (requestContextAsyncLocalStorage) {
|
|
102
|
-
return requestContextAsyncLocalStorage;
|
|
103
|
-
}
|
|
104
|
-
const extendedGlobalThis = globalThis;
|
|
105
|
-
if (extendedGlobalThis[REQUEST_CONTEXT_GLOBAL_KEY]) {
|
|
106
|
-
return extendedGlobalThis[REQUEST_CONTEXT_GLOBAL_KEY];
|
|
107
|
-
}
|
|
108
|
-
const storage = new AsyncLocalStorage();
|
|
109
|
-
requestContextAsyncLocalStorage = storage;
|
|
110
|
-
extendedGlobalThis[REQUEST_CONTEXT_GLOBAL_KEY] = storage;
|
|
111
|
-
return storage;
|
|
112
|
-
}
|
|
113
|
-
var getRequestContext = () => getRequestContextAsyncLocalStorage().getStore();
|
|
114
|
-
function getLogger() {
|
|
115
|
-
return getRequestContext()?.logger ?? systemLogger;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export {
|
|
119
|
-
createRequestContext,
|
|
120
|
-
getRequestContext,
|
|
121
|
-
getLogger
|
|
122
|
-
};
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
encodeBlobKey
|
|
9
|
-
} from "./chunk-TYCYFZ22.js";
|
|
10
7
|
import {
|
|
11
8
|
wrapTracer
|
|
12
9
|
} from "./chunk-5QSXBV7L.js";
|
|
@@ -23,6 +20,9 @@ import {
|
|
|
23
20
|
import {
|
|
24
21
|
require_semver
|
|
25
22
|
} from "./chunk-APO262HE.js";
|
|
23
|
+
import {
|
|
24
|
+
encodeBlobKey
|
|
25
|
+
} from "./chunk-TYCYFZ22.js";
|
|
26
26
|
import {
|
|
27
27
|
__toESM
|
|
28
28
|
} from "./chunk-OEQOKJGE.js";
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
encodeBlobKey
|
|
9
|
-
} from "./chunk-TYCYFZ22.js";
|
|
10
7
|
import {
|
|
11
8
|
wrapTracer
|
|
12
9
|
} from "./chunk-5QSXBV7L.js";
|
|
@@ -20,6 +17,9 @@ import {
|
|
|
20
17
|
import {
|
|
21
18
|
require_out
|
|
22
19
|
} from "./chunk-KGYJQ2U2.js";
|
|
20
|
+
import {
|
|
21
|
+
encodeBlobKey
|
|
22
|
+
} from "./chunk-TYCYFZ22.js";
|
|
23
23
|
import {
|
|
24
24
|
__toESM
|
|
25
25
|
} from "./chunk-OEQOKJGE.js";
|