@netlify/plugin-nextjs 5.15.1 → 5.15.3
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/server.js +66 -51
- package/dist/build/content/static.js +1 -1
- package/dist/build/functions/server.js +1 -1
- package/dist/build/plugin-context.js +21 -2
- package/dist/build/verification.js +1 -1
- package/dist/esm-chunks/{chunk-TVEBGDAB.js → chunk-JNOKXHJS.js} +1 -1
- package/dist/esm-chunks/{chunk-5V5HA6YA.js → chunk-QCOH52QC.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/run/{revalidate.js → augment-next-response.js} +22 -3
- package/dist/run/handlers/request-context.cjs +2 -2
- package/dist/run/handlers/server.js +14 -14
- package/dist/run/handlers/tags-handler.cjs +1 -1
- package/dist/run/handlers/tracer.cjs +1 -1
- package/dist/run/handlers/use-cache-handler.js +3 -4
- package/dist/run/handlers/wait-until.cjs +1 -1
- package/dist/run/headers.js +1 -1
- package/dist/run/storage/regional-blob-store.cjs +39 -28
- package/dist/run/storage/request-scoped-in-memory-cache.cjs +3 -4
- package/dist/run/storage/storage.cjs +5 -9
- package/package.json +1 -1
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
import {
|
|
8
8
|
trace,
|
|
9
9
|
wrapTracer
|
|
10
|
-
} from "../../esm-chunks/chunk-
|
|
10
|
+
} from "../../esm-chunks/chunk-QCOH52QC.js";
|
|
11
11
|
import {
|
|
12
12
|
require_out
|
|
13
13
|
} from "../../esm-chunks/chunk-YUXQHOYO.js";
|
|
14
14
|
import {
|
|
15
15
|
require_semver
|
|
16
|
-
} from "../../esm-chunks/chunk-
|
|
16
|
+
} from "../../esm-chunks/chunk-JNOKXHJS.js";
|
|
17
17
|
import {
|
|
18
18
|
__toESM
|
|
19
19
|
} from "../../esm-chunks/chunk-6BT4RYQJ.js";
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
import {
|
|
8
8
|
trace,
|
|
9
9
|
wrapTracer
|
|
10
|
-
} from "../../esm-chunks/chunk-
|
|
10
|
+
} from "../../esm-chunks/chunk-QCOH52QC.js";
|
|
11
11
|
import {
|
|
12
12
|
require_out
|
|
13
13
|
} from "../../esm-chunks/chunk-YUXQHOYO.js";
|
|
14
14
|
import {
|
|
15
15
|
require_semver
|
|
16
|
-
} from "../../esm-chunks/chunk-
|
|
16
|
+
} from "../../esm-chunks/chunk-JNOKXHJS.js";
|
|
17
17
|
import {
|
|
18
18
|
__toESM
|
|
19
19
|
} from "../../esm-chunks/chunk-6BT4RYQJ.js";
|
|
@@ -31,13 +31,13 @@ import {
|
|
|
31
31
|
writeFile
|
|
32
32
|
} from "node:fs/promises";
|
|
33
33
|
import { createRequire } from "node:module";
|
|
34
|
-
import { dirname, join,
|
|
35
|
-
import { join as posixJoin, sep as posixSep } from "node:path/posix";
|
|
34
|
+
import { dirname, join, sep } from "node:path";
|
|
35
|
+
import { join as posixJoin, relative as posixRelative, sep as posixSep } from "node:path/posix";
|
|
36
36
|
var import_fast_glob = __toESM(require_out(), 1);
|
|
37
37
|
var import_semver = __toESM(require_semver(), 1);
|
|
38
38
|
import { RUN_CONFIG_FILE } from "../../run/constants.js";
|
|
39
39
|
var tracer = wrapTracer(trace.getTracer("Next runtime"));
|
|
40
|
-
var toPosixPath = (path) => path.split(sep).join(posixSep);
|
|
40
|
+
var toPosixPath = (path) => path.replace(/^\\+\?\\+/, "").split(sep).join(posixSep);
|
|
41
41
|
function isError(error) {
|
|
42
42
|
return error instanceof Error;
|
|
43
43
|
}
|
|
@@ -98,29 +98,39 @@ var copyNextServerCode = async (ctx) => {
|
|
|
98
98
|
extglob: true
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
throw new Error("Could not patch middleware manifest file", { cause: error });
|
|
110
|
-
}
|
|
111
|
-
return;
|
|
101
|
+
const promises = paths.map(async (path) => {
|
|
102
|
+
const srcPath = join(srcDir, path);
|
|
103
|
+
const destPath = join(destDir, path);
|
|
104
|
+
if (path === "server/middleware-manifest.json") {
|
|
105
|
+
try {
|
|
106
|
+
await replaceMiddlewareManifest(srcPath, destPath);
|
|
107
|
+
} catch (error) {
|
|
108
|
+
throw new Error("Could not patch middleware manifest file", { cause: error });
|
|
112
109
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (path === "server/functions-config-manifest.json") {
|
|
113
|
+
try {
|
|
114
|
+
await replaceFunctionsConfigManifest(srcPath, destPath);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
throw new Error("Could not patch functions config manifest file", { cause: error });
|
|
120
117
|
}
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
await cp(srcPath, destPath, { recursive: true, force: true });
|
|
121
|
+
});
|
|
122
|
+
if (existsSync(join(srcDir, "node_modules"))) {
|
|
123
|
+
const filter = ctx.constants.IS_LOCAL ? void 0 : nodeModulesFilter;
|
|
124
|
+
const src = join(srcDir, "node_modules");
|
|
125
|
+
const dest = join(destDir, "node_modules");
|
|
126
|
+
await cp(src, dest, {
|
|
127
|
+
recursive: true,
|
|
128
|
+
verbatimSymlinks: true,
|
|
129
|
+
force: true,
|
|
130
|
+
filter
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
await Promise.all(promises);
|
|
124
134
|
});
|
|
125
135
|
};
|
|
126
136
|
async function recreateNodeModuleSymlinks(src, dest, org) {
|
|
@@ -188,32 +198,37 @@ async function patchNextModules(ctx, nextVersion, serverHandlerRequireResolve) {
|
|
|
188
198
|
}
|
|
189
199
|
var copyNextDependencies = async (ctx) => {
|
|
190
200
|
await tracer.withActiveSpan("copyNextDependencies", async () => {
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
const promises = [];
|
|
202
|
+
const nodeModulesLocations = /* @__PURE__ */ new Set();
|
|
203
|
+
const commonFilter = ctx.constants.IS_LOCAL ? void 0 : nodeModulesFilter;
|
|
204
|
+
const dotNextDir = toPosixPath(join(ctx.standaloneDir, ctx.nextDistDir));
|
|
205
|
+
const standaloneRootDir = toPosixPath(ctx.standaloneRootDir);
|
|
206
|
+
const outputFileTracingRoot = toPosixPath(ctx.outputFileTracingRoot);
|
|
207
|
+
await cp(ctx.standaloneRootDir, ctx.serverHandlerRootDir, {
|
|
208
|
+
recursive: true,
|
|
209
|
+
verbatimSymlinks: true,
|
|
210
|
+
force: true,
|
|
211
|
+
filter: async (sourcePath, destination) => {
|
|
212
|
+
const posixSourcePath = toPosixPath(sourcePath);
|
|
213
|
+
if (posixSourcePath === dotNextDir) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
if (sourcePath.endsWith("node_modules")) {
|
|
217
|
+
nodeModulesLocations.add({
|
|
218
|
+
source: posixSourcePath,
|
|
219
|
+
destination: toPosixPath(destination)
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
return commonFilter?.(sourcePath) ?? true;
|
|
207
223
|
}
|
|
208
224
|
});
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
);
|
|
225
|
+
for (const {
|
|
226
|
+
source: nodeModulesLocationInStandalone,
|
|
227
|
+
destination: locationInServerHandler
|
|
228
|
+
} of nodeModulesLocations) {
|
|
229
|
+
const relativeToRoot = posixRelative(standaloneRootDir, nodeModulesLocationInStandalone);
|
|
230
|
+
const locationInProject = posixJoin(outputFileTracingRoot, relativeToRoot);
|
|
231
|
+
promises.push(recreateNodeModuleSymlinks(locationInProject, locationInServerHandler));
|
|
217
232
|
}
|
|
218
233
|
await Promise.all(promises);
|
|
219
234
|
const serverHandlerRequire = createRequire(posixJoin(ctx.serverHandlerDir, ":internal:"));
|
|
@@ -301,7 +316,7 @@ var verifyHandlerDirStructure = async (ctx) => {
|
|
|
301
316
|
);
|
|
302
317
|
}
|
|
303
318
|
};
|
|
304
|
-
var nodeModulesFilter =
|
|
319
|
+
var nodeModulesFilter = (sourcePath) => {
|
|
305
320
|
if (sourcePath.includes(".pnpm") && (sourcePath.includes("linuxmusl-x64") || sourcePath.includes("linux-x64-musl"))) {
|
|
306
321
|
return false;
|
|
307
322
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
require_semver
|
|
9
|
-
} from "../esm-chunks/chunk-
|
|
9
|
+
} from "../esm-chunks/chunk-JNOKXHJS.js";
|
|
10
10
|
import {
|
|
11
11
|
__toESM
|
|
12
12
|
} from "../esm-chunks/chunk-6BT4RYQJ.js";
|
|
@@ -16,7 +16,7 @@ var import_semver = __toESM(require_semver(), 1);
|
|
|
16
16
|
import { existsSync, readFileSync } from "node:fs";
|
|
17
17
|
import { readFile } from "node:fs/promises";
|
|
18
18
|
import { createRequire } from "node:module";
|
|
19
|
-
import { join, relative, resolve } from "node:path";
|
|
19
|
+
import { join, relative, resolve, sep } from "node:path";
|
|
20
20
|
import { join as posixJoin, relative as posixRelative } from "node:path/posix";
|
|
21
21
|
import { fileURLToPath } from "node:url";
|
|
22
22
|
var MODULE_DIR = fileURLToPath(new URL(".", import.meta.url));
|
|
@@ -54,6 +54,25 @@ var PluginContext = class {
|
|
|
54
54
|
get relativeAppDir() {
|
|
55
55
|
return this.requiredServerFiles.relativeAppDir ?? "";
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* The root directory for output file tracing. Paths inside standalone directory preserve paths of project, relative to this directory.
|
|
59
|
+
*/
|
|
60
|
+
get outputFileTracingRoot() {
|
|
61
|
+
const outputFileTracingRootFromRequiredServerFiles = this.requiredServerFiles.config.outputFileTracingRoot ?? // fallback for older Next.js versions that don't have outputFileTracingRoot in the config, but had it in config.experimental
|
|
62
|
+
this.requiredServerFiles.config.experimental.outputFileTracingRoot;
|
|
63
|
+
if (outputFileTracingRootFromRequiredServerFiles) {
|
|
64
|
+
return outputFileTracingRootFromRequiredServerFiles;
|
|
65
|
+
}
|
|
66
|
+
if (!this.relativeAppDir.includes("..")) {
|
|
67
|
+
const depth = this.relativeAppDir === "" ? 0 : this.relativeAppDir.split(sep).length;
|
|
68
|
+
const computedOutputFileTracingRoot = resolve(
|
|
69
|
+
this.requiredServerFiles.appDir,
|
|
70
|
+
...Array.from({ length: depth }).fill("..")
|
|
71
|
+
);
|
|
72
|
+
return computedOutputFileTracingRoot;
|
|
73
|
+
}
|
|
74
|
+
return process.cwd();
|
|
75
|
+
}
|
|
57
76
|
/**
|
|
58
77
|
* The working directory inside the lambda that is used for monorepos to execute the serverless function
|
|
59
78
|
*/
|
|
@@ -1259,7 +1259,7 @@ var require_range = __commonJS({
|
|
|
1259
1259
|
var require_comparator = __commonJS({
|
|
1260
1260
|
"node_modules/semver/classes/comparator.js"(exports, module) {
|
|
1261
1261
|
"use strict";
|
|
1262
|
-
var ANY = Symbol("SemVer ANY");
|
|
1262
|
+
var ANY = /* @__PURE__ */ Symbol("SemVer ANY");
|
|
1263
1263
|
var Comparator = class _Comparator {
|
|
1264
1264
|
static get ANY() {
|
|
1265
1265
|
return ANY;
|
|
@@ -80,7 +80,7 @@ var isCompatible = _makeCompatibilityCheck(VERSION);
|
|
|
80
80
|
|
|
81
81
|
// node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
|
|
82
82
|
var major = VERSION.split(".")[0];
|
|
83
|
-
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
|
|
83
|
+
var GLOBAL_OPENTELEMETRY_API_KEY = /* @__PURE__ */ Symbol.for("opentelemetry.js.api." + major);
|
|
84
84
|
var _global = _globalThis;
|
|
85
85
|
function registerGlobal(type, instance, diag, allowOverride) {
|
|
86
86
|
var _a;
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
import "../esm-chunks/chunk-6BT4RYQJ.js";
|
|
8
8
|
|
|
9
|
-
// src/run/
|
|
9
|
+
// src/run/augment-next-response.ts
|
|
10
10
|
import { isPromise } from "node:util/types";
|
|
11
11
|
function isRevalidateMethod(key, nextResponseField) {
|
|
12
12
|
return key === "revalidate" && typeof nextResponseField === "function";
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
function isAppendHeaderMethod(key, nextResponseField) {
|
|
15
|
+
return key === "appendHeader" && typeof nextResponseField === "function";
|
|
16
|
+
}
|
|
17
|
+
var augmentNextResponse = (response, requestContext) => {
|
|
15
18
|
return new Proxy(response, {
|
|
16
19
|
get(target, key) {
|
|
17
20
|
const originalValue = Reflect.get(target, key);
|
|
@@ -25,10 +28,26 @@ var nextResponseProxy = (response, requestContext) => {
|
|
|
25
28
|
return result;
|
|
26
29
|
};
|
|
27
30
|
}
|
|
31
|
+
if (isAppendHeaderMethod(key, originalValue)) {
|
|
32
|
+
return function patchedAppendHeader(...args) {
|
|
33
|
+
if (typeof args[0] === "string" && (args[0] === "location" || args[0] === "Location")) {
|
|
34
|
+
let existing = target.getHeader("location");
|
|
35
|
+
if (typeof existing !== "undefined") {
|
|
36
|
+
if (!Array.isArray(existing)) {
|
|
37
|
+
existing = [String(existing)];
|
|
38
|
+
}
|
|
39
|
+
if (existing.includes(String(args[1]))) {
|
|
40
|
+
return target;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return originalValue.apply(target, args);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
28
47
|
return originalValue;
|
|
29
48
|
}
|
|
30
49
|
});
|
|
31
50
|
};
|
|
32
51
|
export {
|
|
33
|
-
|
|
52
|
+
augmentNextResponse
|
|
34
53
|
};
|
|
@@ -96,8 +96,8 @@ var SystemLogger = class _SystemLogger {
|
|
|
96
96
|
var systemLogger = new SystemLogger();
|
|
97
97
|
|
|
98
98
|
// src/run/handlers/request-context.cts
|
|
99
|
-
var REQUEST_CONTEXT_GLOBAL_KEY = Symbol.for("nf-request-context-async-local-storage");
|
|
100
|
-
var REQUEST_COUNTER_KEY = Symbol.for("nf-request-counter");
|
|
99
|
+
var REQUEST_CONTEXT_GLOBAL_KEY = /* @__PURE__ */ Symbol.for("nf-request-context-async-local-storage");
|
|
100
|
+
var REQUEST_COUNTER_KEY = /* @__PURE__ */ Symbol.for("nf-request-counter");
|
|
101
101
|
var extendedGlobalThis = globalThis;
|
|
102
102
|
function getFallbackRequestID() {
|
|
103
103
|
const requestNumber = extendedGlobalThis[REQUEST_COUNTER_KEY] ?? 0;
|
|
@@ -1069,7 +1069,7 @@ var require_inspect = __commonJS({
|
|
|
1069
1069
|
});
|
|
1070
1070
|
}, 719: (t2) => {
|
|
1071
1071
|
var e2 = /\u001b\[\d\d?m/g;
|
|
1072
|
-
t2.exports = { customInspectSymbol: Symbol.for("nodejs.util.inspect.custom"), isError: function(t3) {
|
|
1072
|
+
t2.exports = { customInspectSymbol: /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), isError: function(t3) {
|
|
1073
1073
|
return t3 instanceof Error;
|
|
1074
1074
|
}, join: Array.prototype.join.call.bind(Array.prototype.join), removeColors: function(t3) {
|
|
1075
1075
|
return String.prototype.replace.call(t3, e2, "");
|
|
@@ -1438,7 +1438,7 @@ var require_inspect = __commonJS({
|
|
|
1438
1438
|
for (var r3 = 0, n2 = new Array(e3); r3 < e3; r3++) n2[r3] = t3[r3];
|
|
1439
1439
|
return n2;
|
|
1440
1440
|
}
|
|
1441
|
-
var l = r2(906), u = Symbol("kPending"), f = Symbol("kRejected");
|
|
1441
|
+
var l = r2(906), u = /* @__PURE__ */ Symbol("kPending"), f = /* @__PURE__ */ Symbol("kRejected");
|
|
1442
1442
|
t2.exports = { getOwnNonIndexProperties: function(t3) {
|
|
1443
1443
|
for (var e3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2, r3 = Object.getOwnPropertyDescriptors(t3), n2 = [], a2 = 0, c2 = Object.entries(r3); a2 < c2.length; a2++) {
|
|
1444
1444
|
var l2 = i(c2[a2], 2), u2 = l2[0], f2 = l2[1];
|
|
@@ -1697,12 +1697,12 @@ var _c;
|
|
|
1697
1697
|
var _d;
|
|
1698
1698
|
var _e;
|
|
1699
1699
|
var _f;
|
|
1700
|
-
var kHeaders = Symbol("kHeaders");
|
|
1701
|
-
var kHeadersDistinct = Symbol("kHeadersDistinct");
|
|
1702
|
-
var kHeadersCount = Symbol("kHeadersCount");
|
|
1703
|
-
var kTrailers = Symbol("kTrailers");
|
|
1704
|
-
var kTrailersDistinct = Symbol("kTrailersDistinct");
|
|
1705
|
-
var kTrailersCount = Symbol("kTrailersCount");
|
|
1700
|
+
var kHeaders = /* @__PURE__ */ Symbol("kHeaders");
|
|
1701
|
+
var kHeadersDistinct = /* @__PURE__ */ Symbol("kHeadersDistinct");
|
|
1702
|
+
var kHeadersCount = /* @__PURE__ */ Symbol("kHeadersCount");
|
|
1703
|
+
var kTrailers = /* @__PURE__ */ Symbol("kTrailers");
|
|
1704
|
+
var kTrailersDistinct = /* @__PURE__ */ Symbol("kTrailersDistinct");
|
|
1705
|
+
var kTrailersCount = /* @__PURE__ */ Symbol("kTrailersCount");
|
|
1706
1706
|
var ComputeJsIncomingMessage = class extends Readable {
|
|
1707
1707
|
constructor() {
|
|
1708
1708
|
const streamOptions = {};
|
|
@@ -2008,8 +2008,8 @@ function isUint8Array(value) {
|
|
|
2008
2008
|
}
|
|
2009
2009
|
|
|
2010
2010
|
// node_modules/@fastly/http-compute-js/dist/http-compute-js/internal-http.js
|
|
2011
|
-
var kNeedDrain = Symbol("kNeedDrain");
|
|
2012
|
-
var kOutHeaders = Symbol("kOutHeaders");
|
|
2011
|
+
var kNeedDrain = /* @__PURE__ */ Symbol("kNeedDrain");
|
|
2012
|
+
var kOutHeaders = /* @__PURE__ */ Symbol("kOutHeaders");
|
|
2013
2013
|
function utcDate() {
|
|
2014
2014
|
return (/* @__PURE__ */ new Date()).toUTCString();
|
|
2015
2015
|
}
|
|
@@ -2032,8 +2032,8 @@ var chunkExpression = /(?:^|\W)chunked(?:$|\W)/i;
|
|
|
2032
2032
|
|
|
2033
2033
|
// node_modules/@fastly/http-compute-js/dist/http-compute-js/http-outgoing.js
|
|
2034
2034
|
var _a2;
|
|
2035
|
-
var kCorked = Symbol("corked");
|
|
2036
|
-
var kUniqueHeaders = Symbol("kUniqueHeaders");
|
|
2035
|
+
var kCorked = /* @__PURE__ */ Symbol("corked");
|
|
2036
|
+
var kUniqueHeaders = /* @__PURE__ */ Symbol("kUniqueHeaders");
|
|
2037
2037
|
function debug(format2) {
|
|
2038
2038
|
}
|
|
2039
2039
|
var nop = () => {
|
|
@@ -3091,6 +3091,7 @@ function toComputeResponse(res) {
|
|
|
3091
3091
|
}
|
|
3092
3092
|
|
|
3093
3093
|
// src/run/handlers/server.ts
|
|
3094
|
+
import { augmentNextResponse } from "../augment-next-response.js";
|
|
3094
3095
|
import { getRunConfig, setRunConfig } from "../config.js";
|
|
3095
3096
|
import {
|
|
3096
3097
|
adjustDateHeader,
|
|
@@ -3099,7 +3100,6 @@ import {
|
|
|
3099
3100
|
setCacheTagsHeaders,
|
|
3100
3101
|
setVaryHeaders
|
|
3101
3102
|
} from "../headers.js";
|
|
3102
|
-
import { nextResponseProxy } from "../revalidate.js";
|
|
3103
3103
|
import { setFetchBeforeNextPatchedIt } from "../storage/storage.cjs";
|
|
3104
3104
|
import { getLogger } from "./request-context.cjs";
|
|
3105
3105
|
import { getTracer, recordWarning, withActiveSpan } from "./tracer.cjs";
|
|
@@ -3154,7 +3154,7 @@ var server_default = async (request, _context, topLevelSpan, requestContext) =>
|
|
|
3154
3154
|
}
|
|
3155
3155
|
});
|
|
3156
3156
|
disableFaultyTransferEncodingHandling(res);
|
|
3157
|
-
const resProxy =
|
|
3157
|
+
const resProxy = augmentNextResponse(res, requestContext);
|
|
3158
3158
|
const nextHandlerPromise = nextHandler(req, resProxy).catch((error) => {
|
|
3159
3159
|
getLogger().withError(error).error("next handler error");
|
|
3160
3160
|
console.error(error);
|
|
@@ -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.15.
|
|
89
|
+
var version = "5.15.3";
|
|
90
90
|
|
|
91
91
|
// src/run/handlers/tags-handler.cts
|
|
92
92
|
var import_storage = require("../storage/storage.cjs");
|
|
@@ -117,7 +117,7 @@ var isCompatible = _makeCompatibilityCheck(VERSION);
|
|
|
117
117
|
|
|
118
118
|
// node_modules/@netlify/otel/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
|
|
119
119
|
var major = VERSION.split(".")[0];
|
|
120
|
-
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
|
|
120
|
+
var GLOBAL_OPENTELEMETRY_API_KEY = /* @__PURE__ */ Symbol.for("opentelemetry.js.api." + major);
|
|
121
121
|
var _global = _globalThis;
|
|
122
122
|
function registerGlobal(type, instance, diag, allowOverride) {
|
|
123
123
|
var _a;
|
|
@@ -53,7 +53,6 @@ if (typeof AC === "undefined") {
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
var shouldWarn = (code) => !warned.has(code);
|
|
56
|
-
var TYPE = Symbol("type");
|
|
57
56
|
var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
|
|
58
57
|
var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
|
|
59
58
|
var ZeroArray = class extends Array {
|
|
@@ -1386,9 +1385,9 @@ import {
|
|
|
1386
1385
|
markTagsAsStaleAndPurgeEdgeCache
|
|
1387
1386
|
} from "./tags-handler.cjs";
|
|
1388
1387
|
import { getTracer, withActiveSpan } from "./tracer.cjs";
|
|
1389
|
-
var LRU_CACHE_GLOBAL_KEY = Symbol.for("nf-use-cache-handler-lru-cache");
|
|
1390
|
-
var PENDING_SETS_GLOBAL_KEY = Symbol.for("nf-use-cache-handler-pending-sets");
|
|
1391
|
-
var cacheHandlersSymbol = Symbol.for("@next/cache-handlers");
|
|
1388
|
+
var LRU_CACHE_GLOBAL_KEY = /* @__PURE__ */ Symbol.for("nf-use-cache-handler-lru-cache");
|
|
1389
|
+
var PENDING_SETS_GLOBAL_KEY = /* @__PURE__ */ Symbol.for("nf-use-cache-handler-pending-sets");
|
|
1390
|
+
var cacheHandlersSymbol = /* @__PURE__ */ Symbol.for("@next/cache-handlers");
|
|
1392
1391
|
var extendedGlobalThis = globalThis;
|
|
1393
1392
|
function getLRUCache() {
|
|
1394
1393
|
if (extendedGlobalThis[LRU_CACHE_GLOBAL_KEY]) {
|
|
@@ -24,7 +24,7 @@ __export(wait_until_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(wait_until_exports);
|
|
26
26
|
var import_request_context = require("./request-context.cjs");
|
|
27
|
-
var NEXT_REQUEST_CONTEXT_SYMBOL = Symbol.for("@next/request-context");
|
|
27
|
+
var NEXT_REQUEST_CONTEXT_SYMBOL = /* @__PURE__ */ Symbol.for("@next/request-context");
|
|
28
28
|
function setupWaitUntil() {
|
|
29
29
|
;
|
|
30
30
|
globalThis[NEXT_REQUEST_CONTEXT_SYMBOL] = {
|
package/dist/run/headers.js
CHANGED
|
@@ -9,7 +9,7 @@ import "../esm-chunks/chunk-6BT4RYQJ.js";
|
|
|
9
9
|
// src/run/headers.ts
|
|
10
10
|
import { recordWarning } from "./handlers/tracer.cjs";
|
|
11
11
|
import { getMemoizedKeyValueStoreBackedByRegionalBlobStore } from "./storage/storage.cjs";
|
|
12
|
-
var ALL_VARIATIONS = Symbol.for("ALL_VARIATIONS");
|
|
12
|
+
var ALL_VARIATIONS = /* @__PURE__ */ Symbol.for("ALL_VARIATIONS");
|
|
13
13
|
var NetlifyVaryKeys = /* @__PURE__ */ new Set(["header", "language", "cookie", "query", "country"]);
|
|
14
14
|
var isNetlifyVaryKey = (key) => NetlifyVaryKeys.has(key);
|
|
15
15
|
var generateNetlifyVaryValues = ({
|
|
@@ -30,7 +30,23 @@ var getString = (input) => typeof input === "string" ? input : JSON.stringify(in
|
|
|
30
30
|
var base64Decode = globalThis.Buffer ? (input) => Buffer.from(input, "base64").toString() : (input) => atob(input);
|
|
31
31
|
var base64Encode = globalThis.Buffer ? (input) => Buffer.from(getString(input)).toString("base64") : (input) => btoa(getString(input));
|
|
32
32
|
|
|
33
|
-
// node_modules/@netlify/
|
|
33
|
+
// node_modules/@netlify/otel/dist/main.js
|
|
34
|
+
var GET_TRACER = "__netlify__getTracer";
|
|
35
|
+
var getTracer = (name, version) => {
|
|
36
|
+
return globalThis[GET_TRACER]?.(name, version);
|
|
37
|
+
};
|
|
38
|
+
function withActiveSpan(tracer, name, optionsOrFn, contextOrFn, fn) {
|
|
39
|
+
const func = typeof contextOrFn === "function" ? contextOrFn : typeof optionsOrFn === "function" ? optionsOrFn : fn;
|
|
40
|
+
if (!func) {
|
|
41
|
+
throw new Error("function to execute with active span is missing");
|
|
42
|
+
}
|
|
43
|
+
if (!tracer) {
|
|
44
|
+
return func();
|
|
45
|
+
}
|
|
46
|
+
return tracer.withActiveSpan(name, optionsOrFn, contextOrFn, func);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// node_modules/@netlify/blobs/dist/chunk-3OMJJ4EG.js
|
|
34
50
|
var getEnvironment = () => {
|
|
35
51
|
const { Deno, Netlify, process: process2 } = globalThis;
|
|
36
52
|
return Netlify?.env ?? Deno?.env ?? {
|
|
@@ -123,6 +139,12 @@ var collectIterator = async (iterator) => {
|
|
|
123
139
|
}
|
|
124
140
|
return result;
|
|
125
141
|
};
|
|
142
|
+
function withSpan(span, name, fn) {
|
|
143
|
+
if (span) return fn(span);
|
|
144
|
+
return withActiveSpan(getTracer(), name, (span2) => {
|
|
145
|
+
return fn(span2);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
126
148
|
var BlobsConsistencyError = class extends Error {
|
|
127
149
|
constructor() {
|
|
128
150
|
super(
|
|
@@ -337,22 +359,6 @@ var getClientOptions = (options, contextOverride) => {
|
|
|
337
359
|
return clientOptions;
|
|
338
360
|
};
|
|
339
361
|
|
|
340
|
-
// node_modules/@netlify/otel/dist/main.js
|
|
341
|
-
var GET_TRACER = "__netlify__getTracer";
|
|
342
|
-
var getTracer = (name, version) => {
|
|
343
|
-
return globalThis[GET_TRACER]?.(name, version);
|
|
344
|
-
};
|
|
345
|
-
function withActiveSpan(tracer, name, optionsOrFn, contextOrFn, fn) {
|
|
346
|
-
const func = typeof contextOrFn === "function" ? contextOrFn : typeof optionsOrFn === "function" ? optionsOrFn : fn;
|
|
347
|
-
if (!func) {
|
|
348
|
-
throw new Error("function to execute with active span is missing");
|
|
349
|
-
}
|
|
350
|
-
if (!tracer) {
|
|
351
|
-
return func();
|
|
352
|
-
}
|
|
353
|
-
return tracer.withActiveSpan(name, optionsOrFn, contextOrFn, func);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
362
|
// node_modules/@netlify/blobs/dist/main.js
|
|
357
363
|
var DEPLOY_STORE_PREFIX = "deploy:";
|
|
358
364
|
var LEGACY_STORE_INTERNAL_PREFIX = "netlify-internal/legacy-namespace/";
|
|
@@ -404,7 +410,7 @@ var Store = class _Store {
|
|
|
404
410
|
};
|
|
405
411
|
}
|
|
406
412
|
async get(key, options) {
|
|
407
|
-
return
|
|
413
|
+
return withSpan(options?.span, "blobs.get", async (span) => {
|
|
408
414
|
const { consistency, type } = options ?? {};
|
|
409
415
|
span?.setAttributes({
|
|
410
416
|
"blobs.store": this.name,
|
|
@@ -447,15 +453,20 @@ var Store = class _Store {
|
|
|
447
453
|
throw new BlobsInternalError(res);
|
|
448
454
|
});
|
|
449
455
|
}
|
|
450
|
-
async getMetadata(key,
|
|
451
|
-
return
|
|
456
|
+
async getMetadata(key, options = {}) {
|
|
457
|
+
return withSpan(options?.span, "blobs.getMetadata", async (span) => {
|
|
452
458
|
span?.setAttributes({
|
|
453
459
|
"blobs.store": this.name,
|
|
454
460
|
"blobs.key": key,
|
|
455
461
|
"blobs.method": "HEAD",
|
|
456
|
-
"blobs.consistency": consistency
|
|
462
|
+
"blobs.consistency": options.consistency
|
|
463
|
+
});
|
|
464
|
+
const res = await this.client.makeRequest({
|
|
465
|
+
consistency: options.consistency,
|
|
466
|
+
key,
|
|
467
|
+
method: "head",
|
|
468
|
+
storeName: this.name
|
|
457
469
|
});
|
|
458
|
-
const res = await this.client.makeRequest({ consistency, key, method: "head", storeName: this.name });
|
|
459
470
|
span?.setAttributes({
|
|
460
471
|
"blobs.response.status": res.status
|
|
461
472
|
});
|
|
@@ -475,7 +486,7 @@ var Store = class _Store {
|
|
|
475
486
|
});
|
|
476
487
|
}
|
|
477
488
|
async getWithMetadata(key, options) {
|
|
478
|
-
return
|
|
489
|
+
return withSpan(options?.span, "blobs.getWithMetadata", async (span) => {
|
|
479
490
|
const { consistency, etag: requestETag, type } = options ?? {};
|
|
480
491
|
const headers = requestETag ? { "if-none-match": requestETag } : void 0;
|
|
481
492
|
span?.setAttributes({
|
|
@@ -532,7 +543,7 @@ var Store = class _Store {
|
|
|
532
543
|
});
|
|
533
544
|
}
|
|
534
545
|
list(options = {}) {
|
|
535
|
-
return
|
|
546
|
+
return withSpan(options.span, "blobs.list", (span) => {
|
|
536
547
|
span?.setAttributes({
|
|
537
548
|
"blobs.store": this.name,
|
|
538
549
|
"blobs.method": "GET",
|
|
@@ -554,7 +565,7 @@ var Store = class _Store {
|
|
|
554
565
|
});
|
|
555
566
|
}
|
|
556
567
|
async set(key, data, options = {}) {
|
|
557
|
-
return
|
|
568
|
+
return withSpan(options.span, "blobs.set", async (span) => {
|
|
558
569
|
span?.setAttributes({
|
|
559
570
|
"blobs.store": this.name,
|
|
560
571
|
"blobs.key": key,
|
|
@@ -591,7 +602,7 @@ var Store = class _Store {
|
|
|
591
602
|
});
|
|
592
603
|
}
|
|
593
604
|
async setJSON(key, data, options = {}) {
|
|
594
|
-
return
|
|
605
|
+
return withSpan(options.span, "blobs.setJSON", async (span) => {
|
|
595
606
|
span?.setAttributes({
|
|
596
607
|
"blobs.store": this.name,
|
|
597
608
|
"blobs.key": key,
|
|
@@ -707,7 +718,7 @@ var Store = class _Store {
|
|
|
707
718
|
let done = false;
|
|
708
719
|
return {
|
|
709
720
|
async next() {
|
|
710
|
-
return
|
|
721
|
+
return withSpan(options?.span, "blobs.list.next", async (span) => {
|
|
711
722
|
span?.setAttributes({
|
|
712
723
|
"blobs.store": storeName,
|
|
713
724
|
"blobs.method": "GET",
|
|
@@ -786,7 +797,7 @@ var getDeployStore = (input = {}) => {
|
|
|
786
797
|
};
|
|
787
798
|
|
|
788
799
|
// src/run/storage/regional-blob-store.cts
|
|
789
|
-
var FETCH_BEFORE_NEXT_PATCHED_IT = Symbol.for("nf-not-patched-fetch");
|
|
800
|
+
var FETCH_BEFORE_NEXT_PATCHED_IT = /* @__PURE__ */ Symbol.for("nf-not-patched-fetch");
|
|
790
801
|
var extendedGlobalThis = globalThis;
|
|
791
802
|
function attemptToGetOriginalFetch(fetch) {
|
|
792
803
|
return fetch._nextOriginalFetch ?? fetch;
|
|
@@ -70,7 +70,6 @@ if (typeof AC === "undefined") {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
var shouldWarn = (code) => !warned.has(code);
|
|
73
|
-
var TYPE = Symbol("type");
|
|
74
73
|
var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
|
|
75
74
|
var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
|
|
76
75
|
var ZeroArray = class extends Array {
|
|
@@ -1399,12 +1398,12 @@ var LRUCache = class _LRUCache {
|
|
|
1399
1398
|
var import_blob_types = require("../../shared/blob-types.cjs");
|
|
1400
1399
|
var import_request_context = require("../handlers/request-context.cjs");
|
|
1401
1400
|
var import_tracer = require("../handlers/tracer.cjs");
|
|
1402
|
-
var NullValue = Symbol.for("null-value");
|
|
1401
|
+
var NullValue = /* @__PURE__ */ Symbol.for("null-value");
|
|
1403
1402
|
var isDataWithEtag = (value) => {
|
|
1404
1403
|
return typeof value === "object" && value !== null && "data" in value && "etag" in value;
|
|
1405
1404
|
};
|
|
1406
|
-
var IN_MEMORY_CACHE_MAX_SIZE = Symbol.for("nf-in-memory-cache-max-size");
|
|
1407
|
-
var IN_MEMORY_LRU_CACHE = Symbol.for("nf-in-memory-lru-cache");
|
|
1405
|
+
var IN_MEMORY_CACHE_MAX_SIZE = /* @__PURE__ */ Symbol.for("nf-in-memory-cache-max-size");
|
|
1406
|
+
var IN_MEMORY_LRU_CACHE = /* @__PURE__ */ Symbol.for("nf-in-memory-lru-cache");
|
|
1408
1407
|
var extendedGlobalThis = globalThis;
|
|
1409
1408
|
var DEFAULT_FALLBACK_MAX_SIZE = 50 * 1024 * 1024;
|
|
1410
1409
|
function setInMemoryCacheMaxSizeFromNextConfig(size) {
|
|
@@ -57,10 +57,11 @@ var getMemoizedKeyValueStoreBackedByRegionalBlobStore = (...args) => {
|
|
|
57
57
|
const blobKey = await encodeBlobKey(key);
|
|
58
58
|
const getPromise = (0, import_tracer.withActiveSpan)(tracer, otelSpanTitle, async (span) => {
|
|
59
59
|
const { etag: previousEtag, globalValue: previousBlob } = memoizedValue?.conditional ? memoizedValue : {};
|
|
60
|
-
span?.setAttributes({ key
|
|
60
|
+
span?.setAttributes({ key });
|
|
61
61
|
const result = await store.getWithMetadata(blobKey, {
|
|
62
62
|
type: "json",
|
|
63
|
-
etag: previousEtag
|
|
63
|
+
etag: previousEtag,
|
|
64
|
+
span
|
|
64
65
|
});
|
|
65
66
|
const shouldReuseMemoizedBlob = result?.etag && previousEtag === result?.etag;
|
|
66
67
|
const blob = shouldReuseMemoizedBlob ? previousBlob : result?.data;
|
|
@@ -72,11 +73,6 @@ var getMemoizedKeyValueStoreBackedByRegionalBlobStore = (...args) => {
|
|
|
72
73
|
} else {
|
|
73
74
|
inMemoryCache.set(key, blob);
|
|
74
75
|
}
|
|
75
|
-
span?.setAttributes({
|
|
76
|
-
etag: result?.etag,
|
|
77
|
-
reusingPreviouslyFetchedBlob: shouldReuseMemoizedBlob,
|
|
78
|
-
status: blob ? shouldReuseMemoizedBlob ? "Hit, no change" : "Hit" : "Miss"
|
|
79
|
-
});
|
|
80
76
|
return blob;
|
|
81
77
|
});
|
|
82
78
|
inMemoryCache.set(key, getPromise);
|
|
@@ -87,8 +83,8 @@ var getMemoizedKeyValueStoreBackedByRegionalBlobStore = (...args) => {
|
|
|
87
83
|
inMemoryCache.set(key, value);
|
|
88
84
|
const blobKey = await encodeBlobKey(key);
|
|
89
85
|
return (0, import_tracer.withActiveSpan)(tracer, otelSpanTitle, async (span) => {
|
|
90
|
-
span?.setAttributes({ key
|
|
91
|
-
const writeResult = await store.setJSON(blobKey, value);
|
|
86
|
+
span?.setAttributes({ key });
|
|
87
|
+
const writeResult = await store.setJSON(blobKey, value, { span });
|
|
92
88
|
if (writeResult?.etag) {
|
|
93
89
|
inMemoryCache.set(key, {
|
|
94
90
|
data: value,
|