1966 lines
77 KiB
JavaScript
1966 lines
77 KiB
JavaScript
globalThis.monorepoPackagePath = "";globalThis.openNextDebug = false;globalThis.openNextVersion = "3.7.6";
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
}) : x)(function(x) {
|
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
});
|
|
var __esm = (fn, res) => function __init() {
|
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
};
|
|
var __commonJS = (cb, mod3) => function __require2() {
|
|
return mod3 || (0, cb[__getOwnPropNames(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports;
|
|
};
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __reExport = (target, mod3, secondTarget) => (__copyProps(target, mod3, "default"), secondTarget && __copyProps(secondTarget, mod3, "default"));
|
|
var __toESM = (mod3, isNodeMode, target) => (target = mod3 != null ? __create(__getProtoOf(mod3)) : {}, __copyProps(
|
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
// file that has been converted to a CommonJS file using a Babel-
|
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
isNodeMode || !mod3 || !mod3.__esModule ? __defProp(target, "default", { value: mod3, enumerable: true }) : target,
|
|
mod3
|
|
));
|
|
var __toCommonJS = (mod3) => __copyProps(__defProp({}, "__esModule", { value: true }), mod3);
|
|
|
|
// node_modules/@opennextjs/aws/dist/utils/error.js
|
|
function isOpenNextError(e) {
|
|
try {
|
|
return "__openNextInternal" in e;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
var IgnorableError, FatalError;
|
|
var init_error = __esm({
|
|
"node_modules/@opennextjs/aws/dist/utils/error.js"() {
|
|
IgnorableError = class extends Error {
|
|
__openNextInternal = true;
|
|
canIgnore = true;
|
|
logLevel = 0;
|
|
constructor(message) {
|
|
super(message);
|
|
this.name = "IgnorableError";
|
|
}
|
|
};
|
|
FatalError = class extends Error {
|
|
__openNextInternal = true;
|
|
canIgnore = false;
|
|
logLevel = 2;
|
|
constructor(message) {
|
|
super(message);
|
|
this.name = "FatalError";
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/adapters/logger.js
|
|
function debug(...args) {
|
|
if (globalThis.openNextDebug) {
|
|
console.log(...args);
|
|
}
|
|
}
|
|
function warn(...args) {
|
|
console.warn(...args);
|
|
}
|
|
function error(...args) {
|
|
if (args.some((arg) => isDownplayedErrorLog(arg))) {
|
|
return debug(...args);
|
|
}
|
|
if (args.some((arg) => isOpenNextError(arg))) {
|
|
const error2 = args.find((arg) => isOpenNextError(arg));
|
|
if (error2.logLevel < getOpenNextErrorLogLevel()) {
|
|
return;
|
|
}
|
|
if (error2.logLevel === 0) {
|
|
return console.log(...args.map((arg) => isOpenNextError(arg) ? `${arg.name}: ${arg.message}` : arg));
|
|
}
|
|
if (error2.logLevel === 1) {
|
|
return warn(...args.map((arg) => isOpenNextError(arg) ? `${arg.name}: ${arg.message}` : arg));
|
|
}
|
|
return console.error(...args);
|
|
}
|
|
console.error(...args);
|
|
}
|
|
function getOpenNextErrorLogLevel() {
|
|
const strLevel = process.env.OPEN_NEXT_ERROR_LOG_LEVEL ?? "1";
|
|
switch (strLevel.toLowerCase()) {
|
|
case "debug":
|
|
case "0":
|
|
return 0;
|
|
case "error":
|
|
case "2":
|
|
return 2;
|
|
default:
|
|
return 1;
|
|
}
|
|
}
|
|
var DOWNPLAYED_ERROR_LOGS, isDownplayedErrorLog;
|
|
var init_logger = __esm({
|
|
"node_modules/@opennextjs/aws/dist/adapters/logger.js"() {
|
|
init_error();
|
|
DOWNPLAYED_ERROR_LOGS = [
|
|
{
|
|
clientName: "S3Client",
|
|
commandName: "GetObjectCommand",
|
|
errorName: "NoSuchKey"
|
|
}
|
|
];
|
|
isDownplayedErrorLog = (errorLog) => DOWNPLAYED_ERROR_LOGS.some((downplayedInput) => downplayedInput.clientName === errorLog?.clientName && downplayedInput.commandName === errorLog?.commandName && (downplayedInput.errorName === errorLog?.error?.name || downplayedInput.errorName === errorLog?.error?.Code));
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/http/util.js
|
|
function parseSetCookieHeader(cookies) {
|
|
if (!cookies) {
|
|
return [];
|
|
}
|
|
if (typeof cookies === "string") {
|
|
return cookies.split(/(?<!Expires=\w+),/i).map((c) => c.trim());
|
|
}
|
|
return cookies;
|
|
}
|
|
function getQueryFromIterator(it) {
|
|
const query = {};
|
|
for (const [key, value] of it) {
|
|
if (key in query) {
|
|
if (Array.isArray(query[key])) {
|
|
query[key].push(value);
|
|
} else {
|
|
query[key] = [query[key], value];
|
|
}
|
|
} else {
|
|
query[key] = value;
|
|
}
|
|
}
|
|
return query;
|
|
}
|
|
var parseHeaders, convertHeader;
|
|
var init_util = __esm({
|
|
"node_modules/@opennextjs/aws/dist/http/util.js"() {
|
|
parseHeaders = (headers) => {
|
|
const result = {};
|
|
if (!headers) {
|
|
return result;
|
|
}
|
|
for (const [key, value] of Object.entries(headers)) {
|
|
if (value === void 0) {
|
|
continue;
|
|
}
|
|
result[key.toLowerCase()] = convertHeader(value);
|
|
}
|
|
return result;
|
|
};
|
|
convertHeader = (header) => {
|
|
if (typeof header === "string") {
|
|
return header;
|
|
}
|
|
if (Array.isArray(header)) {
|
|
return header.join(",");
|
|
}
|
|
return String(header);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node-built-in-modules:node:module
|
|
var node_module_exports = {};
|
|
import * as node_module_star from "node:module";
|
|
var init_node_module = __esm({
|
|
"node-built-in-modules:node:module"() {
|
|
__reExport(node_module_exports, node_module_star);
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/utils/stream.js
|
|
import { Readable } from "node:stream";
|
|
function emptyReadableStream() {
|
|
if (process.env.OPEN_NEXT_FORCE_NON_EMPTY_RESPONSE === "true") {
|
|
return Readable.toWeb(Readable.from([Buffer.from("SOMETHING")]));
|
|
}
|
|
return Readable.toWeb(Readable.from([]));
|
|
}
|
|
var init_stream = __esm({
|
|
"node_modules/@opennextjs/aws/dist/utils/stream.js"() {
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/overrides/converters/utils.js
|
|
function getQueryFromSearchParams(searchParams) {
|
|
return getQueryFromIterator(searchParams.entries());
|
|
}
|
|
var init_utils = __esm({
|
|
"node_modules/@opennextjs/aws/dist/overrides/converters/utils.js"() {
|
|
init_util();
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/node_modules/cookie/dist/index.js
|
|
var require_dist = __commonJS({
|
|
"node_modules/@opennextjs/aws/node_modules/cookie/dist/index.js"(exports) {
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.parse = parse2;
|
|
exports.serialize = serialize;
|
|
var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
var __toString = Object.prototype.toString;
|
|
var NullObject = /* @__PURE__ */ (() => {
|
|
const C = function() {
|
|
};
|
|
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
return C;
|
|
})();
|
|
function parse2(str, options) {
|
|
const obj = new NullObject();
|
|
const len = str.length;
|
|
if (len < 2)
|
|
return obj;
|
|
const dec = options?.decode || decode;
|
|
let index = 0;
|
|
do {
|
|
const eqIdx = str.indexOf("=", index);
|
|
if (eqIdx === -1)
|
|
break;
|
|
const colonIdx = str.indexOf(";", index);
|
|
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
if (eqIdx > endIdx) {
|
|
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
continue;
|
|
}
|
|
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
if (obj[key] === void 0) {
|
|
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
obj[key] = value;
|
|
}
|
|
index = endIdx + 1;
|
|
} while (index < len);
|
|
return obj;
|
|
}
|
|
function startIndex(str, index, max) {
|
|
do {
|
|
const code = str.charCodeAt(index);
|
|
if (code !== 32 && code !== 9)
|
|
return index;
|
|
} while (++index < max);
|
|
return max;
|
|
}
|
|
function endIndex(str, index, min) {
|
|
while (index > min) {
|
|
const code = str.charCodeAt(--index);
|
|
if (code !== 32 && code !== 9)
|
|
return index + 1;
|
|
}
|
|
return min;
|
|
}
|
|
function serialize(name, val, options) {
|
|
const enc = options?.encode || encodeURIComponent;
|
|
if (!cookieNameRegExp.test(name)) {
|
|
throw new TypeError(`argument name is invalid: ${name}`);
|
|
}
|
|
const value = enc(val);
|
|
if (!cookieValueRegExp.test(value)) {
|
|
throw new TypeError(`argument val is invalid: ${val}`);
|
|
}
|
|
let str = name + "=" + value;
|
|
if (!options)
|
|
return str;
|
|
if (options.maxAge !== void 0) {
|
|
if (!Number.isInteger(options.maxAge)) {
|
|
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
}
|
|
str += "; Max-Age=" + options.maxAge;
|
|
}
|
|
if (options.domain) {
|
|
if (!domainValueRegExp.test(options.domain)) {
|
|
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
}
|
|
str += "; Domain=" + options.domain;
|
|
}
|
|
if (options.path) {
|
|
if (!pathValueRegExp.test(options.path)) {
|
|
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
}
|
|
str += "; Path=" + options.path;
|
|
}
|
|
if (options.expires) {
|
|
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
}
|
|
str += "; Expires=" + options.expires.toUTCString();
|
|
}
|
|
if (options.httpOnly) {
|
|
str += "; HttpOnly";
|
|
}
|
|
if (options.secure) {
|
|
str += "; Secure";
|
|
}
|
|
if (options.partitioned) {
|
|
str += "; Partitioned";
|
|
}
|
|
if (options.priority) {
|
|
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
|
|
switch (priority) {
|
|
case "low":
|
|
str += "; Priority=Low";
|
|
break;
|
|
case "medium":
|
|
str += "; Priority=Medium";
|
|
break;
|
|
case "high":
|
|
str += "; Priority=High";
|
|
break;
|
|
default:
|
|
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
}
|
|
}
|
|
if (options.sameSite) {
|
|
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
switch (sameSite) {
|
|
case true:
|
|
case "strict":
|
|
str += "; SameSite=Strict";
|
|
break;
|
|
case "lax":
|
|
str += "; SameSite=Lax";
|
|
break;
|
|
case "none":
|
|
str += "; SameSite=None";
|
|
break;
|
|
default:
|
|
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
}
|
|
}
|
|
return str;
|
|
}
|
|
function decode(str) {
|
|
if (str.indexOf("%") === -1)
|
|
return str;
|
|
try {
|
|
return decodeURIComponent(str);
|
|
} catch (e) {
|
|
return str;
|
|
}
|
|
}
|
|
function isDate(val) {
|
|
return __toString.call(val) === "[object Date]";
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/overrides/converters/edge.js
|
|
var edge_exports = {};
|
|
__export(edge_exports, {
|
|
default: () => edge_default
|
|
});
|
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
var import_cookie, NULL_BODY_STATUSES, converter, edge_default;
|
|
var init_edge = __esm({
|
|
"node_modules/@opennextjs/aws/dist/overrides/converters/edge.js"() {
|
|
import_cookie = __toESM(require_dist(), 1);
|
|
init_util();
|
|
init_utils();
|
|
NULL_BODY_STATUSES = /* @__PURE__ */ new Set([101, 103, 204, 205, 304]);
|
|
converter = {
|
|
convertFrom: async (event) => {
|
|
const url = new URL(event.url);
|
|
const searchParams = url.searchParams;
|
|
const query = getQueryFromSearchParams(searchParams);
|
|
const body = await event.arrayBuffer();
|
|
const headers = {};
|
|
event.headers.forEach((value, key) => {
|
|
headers[key] = value;
|
|
});
|
|
const rawPath = url.pathname;
|
|
const method = event.method;
|
|
const shouldHaveBody = method !== "GET" && method !== "HEAD";
|
|
const cookieHeader = event.headers.get("cookie");
|
|
const cookies = cookieHeader ? import_cookie.default.parse(cookieHeader) : {};
|
|
return {
|
|
type: "core",
|
|
method,
|
|
rawPath,
|
|
url: event.url,
|
|
body: shouldHaveBody ? Buffer2.from(body) : void 0,
|
|
headers,
|
|
remoteAddress: event.headers.get("x-forwarded-for") ?? "::1",
|
|
query,
|
|
cookies
|
|
};
|
|
},
|
|
convertTo: async (result) => {
|
|
if ("internalEvent" in result) {
|
|
const request = new Request(result.internalEvent.url, {
|
|
body: result.internalEvent.body,
|
|
method: result.internalEvent.method,
|
|
headers: {
|
|
...result.internalEvent.headers,
|
|
"x-forwarded-host": result.internalEvent.headers.host
|
|
}
|
|
});
|
|
if (globalThis.__dangerous_ON_edge_converter_returns_request === true) {
|
|
return request;
|
|
}
|
|
const cfCache = (result.isISR || result.internalEvent.rawPath.startsWith("/_next/image")) && process.env.DISABLE_CACHE !== "true" ? { cacheEverything: true } : {};
|
|
return fetch(request, {
|
|
// This is a hack to make sure that the response is cached by Cloudflare
|
|
// See https://developers.cloudflare.com/workers/examples/cache-using-fetch/#caching-html-resources
|
|
// @ts-expect-error - This is a Cloudflare specific option
|
|
cf: cfCache
|
|
});
|
|
}
|
|
const headers = new Headers();
|
|
for (const [key, value] of Object.entries(result.headers)) {
|
|
if (key === "set-cookie" && typeof value === "string") {
|
|
const cookies = parseSetCookieHeader(value);
|
|
for (const cookie of cookies) {
|
|
headers.append(key, cookie);
|
|
}
|
|
continue;
|
|
}
|
|
if (Array.isArray(value)) {
|
|
for (const v of value) {
|
|
headers.append(key, v);
|
|
}
|
|
} else {
|
|
headers.set(key, value);
|
|
}
|
|
}
|
|
const body = NULL_BODY_STATUSES.has(result.statusCode) ? null : result.body;
|
|
return new Response(body, {
|
|
status: result.statusCode,
|
|
headers
|
|
});
|
|
},
|
|
name: "edge"
|
|
};
|
|
edge_default = converter;
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/overrides/wrappers/cloudflare-node.js
|
|
var cloudflare_node_exports = {};
|
|
__export(cloudflare_node_exports, {
|
|
default: () => cloudflare_node_default
|
|
});
|
|
import { Writable } from "node:stream";
|
|
var NULL_BODY_STATUSES2, handler, cloudflare_node_default;
|
|
var init_cloudflare_node = __esm({
|
|
"node_modules/@opennextjs/aws/dist/overrides/wrappers/cloudflare-node.js"() {
|
|
NULL_BODY_STATUSES2 = /* @__PURE__ */ new Set([101, 204, 205, 304]);
|
|
handler = async (handler3, converter2) => async (request, env, ctx, abortSignal) => {
|
|
globalThis.process = process;
|
|
for (const [key, value] of Object.entries(env)) {
|
|
if (typeof value === "string") {
|
|
process.env[key] = value;
|
|
}
|
|
}
|
|
const internalEvent = await converter2.convertFrom(request);
|
|
const url = new URL(request.url);
|
|
const { promise: promiseResponse, resolve: resolveResponse } = Promise.withResolvers();
|
|
const streamCreator = {
|
|
writeHeaders(prelude) {
|
|
const { statusCode, cookies, headers } = prelude;
|
|
const responseHeaders = new Headers(headers);
|
|
for (const cookie of cookies) {
|
|
responseHeaders.append("Set-Cookie", cookie);
|
|
}
|
|
if (url.hostname === "localhost") {
|
|
responseHeaders.set("Content-Encoding", "identity");
|
|
}
|
|
const { readable, writable } = new TransformStream({
|
|
transform(chunk, controller) {
|
|
controller.enqueue(Uint8Array.from(chunk.chunk ?? chunk));
|
|
}
|
|
});
|
|
const body = NULL_BODY_STATUSES2.has(statusCode) ? null : readable;
|
|
const response = new Response(body, {
|
|
status: statusCode,
|
|
headers: responseHeaders
|
|
});
|
|
resolveResponse(response);
|
|
return Writable.fromWeb(writable);
|
|
},
|
|
// This is for passing along the original abort signal from the initial Request you retrieve in your worker
|
|
// Ensures that the response we pass to NextServer is aborted if the request is aborted
|
|
// By doing this `request.signal.onabort` will work in route handlers
|
|
abortSignal
|
|
};
|
|
ctx.waitUntil(handler3(internalEvent, {
|
|
streamCreator,
|
|
waitUntil: ctx.waitUntil.bind(ctx)
|
|
}));
|
|
return promiseResponse;
|
|
};
|
|
cloudflare_node_default = {
|
|
wrapper: handler,
|
|
name: "cloudflare-node",
|
|
supportStreaming: true
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/overrides/tagCache/dummy.js
|
|
var dummy_exports = {};
|
|
__export(dummy_exports, {
|
|
default: () => dummy_default
|
|
});
|
|
var dummyTagCache, dummy_default;
|
|
var init_dummy = __esm({
|
|
"node_modules/@opennextjs/aws/dist/overrides/tagCache/dummy.js"() {
|
|
dummyTagCache = {
|
|
name: "dummy",
|
|
mode: "original",
|
|
getByPath: async () => {
|
|
return [];
|
|
},
|
|
getByTag: async () => {
|
|
return [];
|
|
},
|
|
getLastModified: async (_, lastModified) => {
|
|
return lastModified ?? Date.now();
|
|
},
|
|
writeTags: async () => {
|
|
return;
|
|
}
|
|
};
|
|
dummy_default = dummyTagCache;
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/overrides/queue/dummy.js
|
|
var dummy_exports2 = {};
|
|
__export(dummy_exports2, {
|
|
default: () => dummy_default2
|
|
});
|
|
var dummyQueue, dummy_default2;
|
|
var init_dummy2 = __esm({
|
|
"node_modules/@opennextjs/aws/dist/overrides/queue/dummy.js"() {
|
|
init_error();
|
|
dummyQueue = {
|
|
name: "dummy",
|
|
send: async () => {
|
|
throw new FatalError("Dummy queue is not implemented");
|
|
}
|
|
};
|
|
dummy_default2 = dummyQueue;
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/overrides/incrementalCache/dummy.js
|
|
var dummy_exports3 = {};
|
|
__export(dummy_exports3, {
|
|
default: () => dummy_default3
|
|
});
|
|
var dummyIncrementalCache, dummy_default3;
|
|
var init_dummy3 = __esm({
|
|
"node_modules/@opennextjs/aws/dist/overrides/incrementalCache/dummy.js"() {
|
|
init_error();
|
|
dummyIncrementalCache = {
|
|
name: "dummy",
|
|
get: async () => {
|
|
throw new IgnorableError('"Dummy" cache does not cache anything');
|
|
},
|
|
set: async () => {
|
|
throw new IgnorableError('"Dummy" cache does not cache anything');
|
|
},
|
|
delete: async () => {
|
|
throw new IgnorableError('"Dummy" cache does not cache anything');
|
|
}
|
|
};
|
|
dummy_default3 = dummyIncrementalCache;
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/overrides/assetResolver/dummy.js
|
|
var dummy_exports4 = {};
|
|
__export(dummy_exports4, {
|
|
default: () => dummy_default4
|
|
});
|
|
var resolver, dummy_default4;
|
|
var init_dummy4 = __esm({
|
|
"node_modules/@opennextjs/aws/dist/overrides/assetResolver/dummy.js"() {
|
|
resolver = {
|
|
name: "dummy"
|
|
};
|
|
dummy_default4 = resolver;
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/overrides/proxyExternalRequest/fetch.js
|
|
var fetch_exports = {};
|
|
__export(fetch_exports, {
|
|
default: () => fetch_default
|
|
});
|
|
var fetchProxy, fetch_default;
|
|
var init_fetch = __esm({
|
|
"node_modules/@opennextjs/aws/dist/overrides/proxyExternalRequest/fetch.js"() {
|
|
init_stream();
|
|
fetchProxy = {
|
|
name: "fetch-proxy",
|
|
// @ts-ignore
|
|
proxy: async (internalEvent) => {
|
|
const { url, headers: eventHeaders, method, body } = internalEvent;
|
|
const headers = Object.fromEntries(Object.entries(eventHeaders).filter(([key]) => key.toLowerCase() !== "cf-connecting-ip"));
|
|
const response = await fetch(url, {
|
|
method,
|
|
headers,
|
|
body
|
|
});
|
|
const responseHeaders = {};
|
|
response.headers.forEach((value, key) => {
|
|
responseHeaders[key] = value;
|
|
});
|
|
return {
|
|
type: "core",
|
|
headers: responseHeaders,
|
|
statusCode: response.status,
|
|
isBase64Encoded: true,
|
|
body: response.body ?? emptyReadableStream()
|
|
};
|
|
}
|
|
};
|
|
fetch_default = fetchProxy;
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/overrides/cdnInvalidation/dummy.js
|
|
var dummy_exports5 = {};
|
|
__export(dummy_exports5, {
|
|
default: () => dummy_default5
|
|
});
|
|
var dummy_default5;
|
|
var init_dummy5 = __esm({
|
|
"node_modules/@opennextjs/aws/dist/overrides/cdnInvalidation/dummy.js"() {
|
|
dummy_default5 = {
|
|
name: "dummy",
|
|
invalidatePaths: (_) => {
|
|
return Promise.resolve();
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/@opennextjs/aws/dist/adapters/config/index.js
|
|
init_logger();
|
|
import path from "node:path";
|
|
globalThis.__dirname ??= "";
|
|
var NEXT_DIR = path.join(__dirname, ".next");
|
|
var OPEN_NEXT_DIR = path.join(__dirname, ".open-next");
|
|
debug({ NEXT_DIR, OPEN_NEXT_DIR });
|
|
var NextConfig = { "env": {}, "webpack": null, "eslint": { "ignoreDuringBuilds": true }, "typescript": { "ignoreBuildErrors": true, "tsconfigPath": "tsconfig.json" }, "distDir": ".next", "cleanDistDir": true, "assetPrefix": "", "cacheMaxMemorySize": 52428800, "configOrigin": "next.config.mjs", "useFileSystemPublicRoutes": true, "generateEtags": true, "pageExtensions": ["tsx", "ts", "jsx", "js"], "poweredByHeader": true, "compress": true, "analyticsId": "", "images": { "deviceSizes": [640, 750, 828, 1080, 1200, 1920, 2048, 3840], "imageSizes": [16, 32, 48, 64, 96, 128, 256, 384], "path": "/_next/image", "loader": "default", "loaderFile": "", "domains": [], "disableStaticImages": false, "minimumCacheTTL": 60, "formats": ["image/webp"], "dangerouslyAllowSVG": false, "contentSecurityPolicy": "script-src 'none'; frame-src 'none'; sandbox;", "contentDispositionType": "inline", "remotePatterns": [], "unoptimized": true }, "devIndicators": { "buildActivity": true, "buildActivityPosition": "bottom-right" }, "onDemandEntries": { "maxInactiveAge": 6e4, "pagesBufferLength": 5 }, "amp": { "canonicalBase": "" }, "basePath": "", "sassOptions": {}, "trailingSlash": false, "i18n": null, "productionBrowserSourceMaps": false, "optimizeFonts": true, "excludeDefaultMomentLocales": true, "serverRuntimeConfig": {}, "publicRuntimeConfig": {}, "reactProductionProfiling": false, "reactStrictMode": null, "httpAgentOptions": { "keepAlive": true }, "outputFileTracing": true, "staticPageGenerationTimeout": 60, "swcMinify": true, "output": "standalone", "modularizeImports": { "@mui/icons-material": { "transform": "@mui/icons-material/{{member}}" }, "lodash": { "transform": "lodash/{{member}}" } }, "experimental": { "multiZoneDraftMode": false, "prerenderEarlyExit": false, "serverMinification": true, "serverSourceMaps": false, "linkNoTouchStart": false, "caseSensitiveRoutes": false, "clientRouterFilter": true, "clientRouterFilterRedirects": false, "fetchCacheKeyPrefix": "", "middlewarePrefetch": "flexible", "optimisticClientCache": true, "manualClientBasePath": false, "cpus": 11, "memoryBasedWorkersCount": false, "isrFlushToDisk": true, "workerThreads": false, "optimizeCss": false, "nextScriptWorkers": false, "scrollRestoration": false, "externalDir": false, "disableOptimizedLoading": false, "gzipSize": true, "craCompat": false, "esmExternals": true, "fullySpecified": false, "outputFileTracingRoot": "/home/Nicholai/Documents/Dev/united_v03/united-tattoo/united-tattoo", "swcTraceProfiling": false, "forceSwcTransforms": false, "largePageDataBytes": 128e3, "adjustFontFallbacks": false, "adjustFontFallbacksWithSizeAdjust": false, "typedRoutes": false, "instrumentationHook": false, "bundlePagesExternals": false, "parallelServerCompiles": false, "parallelServerBuildTraces": false, "ppr": false, "missingSuspenseWithCSRBailout": true, "optimizeServerReact": true, "useEarlyImport": false, "staleTimes": { "dynamic": 30, "static": 300 }, "optimizePackageImports": ["lucide-react", "date-fns", "lodash-es", "ramda", "antd", "react-bootstrap", "ahooks", "@ant-design/icons", "@headlessui/react", "@headlessui-float/react", "@heroicons/react/20/solid", "@heroicons/react/24/solid", "@heroicons/react/24/outline", "@visx/visx", "@tremor/react", "rxjs", "@mui/material", "@mui/icons-material", "recharts", "react-use", "@material-ui/core", "@material-ui/icons", "@tabler/icons-react", "mui-core", "react-icons/ai", "react-icons/bi", "react-icons/bs", "react-icons/cg", "react-icons/ci", "react-icons/di", "react-icons/fa", "react-icons/fa6", "react-icons/fc", "react-icons/fi", "react-icons/gi", "react-icons/go", "react-icons/gr", "react-icons/hi", "react-icons/hi2", "react-icons/im", "react-icons/io", "react-icons/io5", "react-icons/lia", "react-icons/lib", "react-icons/lu", "react-icons/md", "react-icons/pi", "react-icons/ri", "react-icons/rx", "react-icons/si", "react-icons/sl", "react-icons/tb", "react-icons/tfi", "react-icons/ti", "react-icons/vsc", "react-icons/wi"], "trustHostHeader": false, "isExperimentalCompile": false }, "configFileName": "next.config.mjs" };
|
|
var BuildId = "YY7sC6MVxKHFhQ9os9EJ-";
|
|
var HtmlPages = [];
|
|
var RoutesManifest = { "basePath": "", "rewrites": { "beforeFiles": [], "afterFiles": [], "fallback": [] }, "redirects": [{ "source": "/:path+/", "destination": "/:path+", "internal": true, "statusCode": 308, "regex": "^(?:/((?:[^/]+?)(?:/(?:[^/]+?))*))/$" }], "routes": { "static": [{ "page": "/", "regex": "^/(?:/)?$", "routeKeys": {}, "namedRegex": "^/(?:/)?$" }, { "page": "/_not-found", "regex": "^/_not\\-found(?:/)?$", "routeKeys": {}, "namedRegex": "^/_not\\-found(?:/)?$" }, { "page": "/admin", "regex": "^/admin(?:/)?$", "routeKeys": {}, "namedRegex": "^/admin(?:/)?$" }, { "page": "/admin/analytics", "regex": "^/admin/analytics(?:/)?$", "routeKeys": {}, "namedRegex": "^/admin/analytics(?:/)?$" }, { "page": "/admin/artists", "regex": "^/admin/artists(?:/)?$", "routeKeys": {}, "namedRegex": "^/admin/artists(?:/)?$" }, { "page": "/admin/artists/new", "regex": "^/admin/artists/new(?:/)?$", "routeKeys": {}, "namedRegex": "^/admin/artists/new(?:/)?$" }, { "page": "/admin/calendar", "regex": "^/admin/calendar(?:/)?$", "routeKeys": {}, "namedRegex": "^/admin/calendar(?:/)?$" }, { "page": "/admin/portfolio", "regex": "^/admin/portfolio(?:/)?$", "routeKeys": {}, "namedRegex": "^/admin/portfolio(?:/)?$" }, { "page": "/admin/settings", "regex": "^/admin/settings(?:/)?$", "routeKeys": {}, "namedRegex": "^/admin/settings(?:/)?$" }, { "page": "/admin/uploads", "regex": "^/admin/uploads(?:/)?$", "routeKeys": {}, "namedRegex": "^/admin/uploads(?:/)?$" }, { "page": "/aftercare", "regex": "^/aftercare(?:/)?$", "routeKeys": {}, "namedRegex": "^/aftercare(?:/)?$" }, { "page": "/artist-dashboard", "regex": "^/artist\\-dashboard(?:/)?$", "routeKeys": {}, "namedRegex": "^/artist\\-dashboard(?:/)?$" }, { "page": "/artist-dashboard/portfolio", "regex": "^/artist\\-dashboard/portfolio(?:/)?$", "routeKeys": {}, "namedRegex": "^/artist\\-dashboard/portfolio(?:/)?$" }, { "page": "/artist-dashboard/profile", "regex": "^/artist\\-dashboard/profile(?:/)?$", "routeKeys": {}, "namedRegex": "^/artist\\-dashboard/profile(?:/)?$" }, { "page": "/artists", "regex": "^/artists(?:/)?$", "routeKeys": {}, "namedRegex": "^/artists(?:/)?$" }, { "page": "/auth/error", "regex": "^/auth/error(?:/)?$", "routeKeys": {}, "namedRegex": "^/auth/error(?:/)?$" }, { "page": "/auth/signin", "regex": "^/auth/signin(?:/)?$", "routeKeys": {}, "namedRegex": "^/auth/signin(?:/)?$" }, { "page": "/book", "regex": "^/book(?:/)?$", "routeKeys": {}, "namedRegex": "^/book(?:/)?$" }, { "page": "/contact", "regex": "^/contact(?:/)?$", "routeKeys": {}, "namedRegex": "^/contact(?:/)?$" }, { "page": "/deposit", "regex": "^/deposit(?:/)?$", "routeKeys": {}, "namedRegex": "^/deposit(?:/)?$" }, { "page": "/favicon.ico", "regex": "^/favicon\\.ico(?:/)?$", "routeKeys": {}, "namedRegex": "^/favicon\\.ico(?:/)?$" }, { "page": "/gift-cards", "regex": "^/gift\\-cards(?:/)?$", "routeKeys": {}, "namedRegex": "^/gift\\-cards(?:/)?$" }, { "page": "/privacy", "regex": "^/privacy(?:/)?$", "routeKeys": {}, "namedRegex": "^/privacy(?:/)?$" }, { "page": "/specials", "regex": "^/specials(?:/)?$", "routeKeys": {}, "namedRegex": "^/specials(?:/)?$" }, { "page": "/terms", "regex": "^/terms(?:/)?$", "routeKeys": {}, "namedRegex": "^/terms(?:/)?$" }], "dynamic": [{ "page": "/admin/artists/[id]", "regex": "^/admin/artists/([^/]+?)(?:/)?$", "routeKeys": { "nxtPid": "nxtPid" }, "namedRegex": "^/admin/artists/(?<nxtPid>[^/]+?)(?:/)?$" }, { "page": "/api/artists/[id]", "regex": "^/api/artists/([^/]+?)(?:/)?$", "routeKeys": { "nxtPid": "nxtPid" }, "namedRegex": "^/api/artists/(?<nxtPid>[^/]+?)(?:/)?$" }, { "page": "/api/auth/[...nextauth]", "regex": "^/api/auth/(.+?)(?:/)?$", "routeKeys": { "nxtPnextauth": "nxtPnextauth" }, "namedRegex": "^/api/auth/(?<nxtPnextauth>.+?)(?:/)?$" }, { "page": "/api/portfolio/[id]", "regex": "^/api/portfolio/([^/]+?)(?:/)?$", "routeKeys": { "nxtPid": "nxtPid" }, "namedRegex": "^/api/portfolio/(?<nxtPid>[^/]+?)(?:/)?$" }, { "page": "/artists/[id]", "regex": "^/artists/([^/]+?)(?:/)?$", "routeKeys": { "nxtPid": "nxtPid" }, "namedRegex": "^/artists/(?<nxtPid>[^/]+?)(?:/)?$" }, { "page": "/artists/[id]/book", "regex": "^/artists/([^/]+?)/book(?:/)?$", "routeKeys": { "nxtPid": "nxtPid" }, "namedRegex": "^/artists/(?<nxtPid>[^/]+?)/book(?:/)?$" }], "data": { "static": [], "dynamic": [] } }, "locales": [] };
|
|
var MiddlewareManifest = { "version": 3, "middleware": { "/": { "files": ["server/edge-runtime-webpack.js", "server/middleware.js"], "name": "middleware", "page": "/", "matchers": [{ "regexp": "^(?:\\/(_next\\/data\\/[^/]{1,}))?(?:\\/((?!_next\\/static|_next\\/image|favicon.ico|public|.*\\.png$|.*\\.jpg$|.*\\.jpeg$|.*\\.gif$|.*\\.svg$).*))(.json)?[\\/#\\?]?$", "originalSource": "/((?!_next/static|_next/image|favicon.ico|public|.*\\.png$|.*\\.jpg$|.*\\.jpeg$|.*\\.gif$|.*\\.svg$).*)" }], "wasm": [], "assets": [], "env": { "__NEXT_BUILD_ID": "YY7sC6MVxKHFhQ9os9EJ-", "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "dIIe8uld0IZYSR75raX3hqcoXVKi4G5ZTC9ulh2RS/M=", "__NEXT_PREVIEW_MODE_ID": "55cfb8bce98f34386492e3e3013b3def", "__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "5b32ca192fc7429a1bb0ed5c67f7f91fe66c60e85c5bfb60804bb73c72f79e3c", "__NEXT_PREVIEW_MODE_SIGNING_KEY": "2de3a5f4686c5891b3e0b87bbf44a183fdd7bc9b2a7ef3a918a2772770dad5b4" } } }, "functions": {}, "sortedMiddleware": ["/"] };
|
|
var AppPathRoutesManifest = { "/_not-found/page": "/_not-found", "/aftercare/page": "/aftercare", "/api/admin/migrate/route": "/api/admin/migrate", "/api/auth/[...nextauth]/route": "/api/auth/[...nextauth]", "/api/public/migrate/route": "/api/public/migrate", "/artists/[id]/book/page": "/artists/[id]/book", "/artists/[id]/page": "/artists/[id]", "/artists/page": "/artists", "/auth/error/page": "/auth/error", "/auth/signin/page": "/auth/signin", "/book/page": "/book", "/contact/page": "/contact", "/deposit/page": "/deposit", "/favicon.ico/route": "/favicon.ico", "/gift-cards/page": "/gift-cards", "/page": "/", "/privacy/page": "/privacy", "/specials/page": "/specials", "/terms/page": "/terms", "/api/admin/stats/route": "/api/admin/stats", "/api/artists/me/route": "/api/artists/me", "/api/artists/[id]/route": "/api/artists/[id]", "/api/files/bulk-delete/route": "/api/files/bulk-delete", "/api/files/folder/route": "/api/files/folder", "/api/artists/route": "/api/artists", "/api/files/route": "/api/files", "/api/appointments/route": "/api/appointments", "/api/portfolio/bulk-delete/route": "/api/portfolio/bulk-delete", "/api/files/stats/route": "/api/files/stats", "/api/portfolio/stats/route": "/api/portfolio/stats", "/api/portfolio/route": "/api/portfolio", "/api/portfolio/[id]/route": "/api/portfolio/[id]", "/api/settings/route": "/api/settings", "/api/upload/route": "/api/upload", "/api/users/route": "/api/users", "/admin/artists/[id]/page": "/admin/artists/[id]", "/admin/artists/new/page": "/admin/artists/new", "/admin/artists/page": "/admin/artists", "/admin/calendar/page": "/admin/calendar", "/admin/page": "/admin", "/artist-dashboard/page": "/artist-dashboard", "/artist-dashboard/portfolio/page": "/artist-dashboard/portfolio", "/artist-dashboard/profile/page": "/artist-dashboard/profile", "/admin/portfolio/page": "/admin/portfolio", "/admin/settings/page": "/admin/settings", "/admin/uploads/page": "/admin/uploads", "/admin/analytics/page": "/admin/analytics" };
|
|
var FunctionsConfigManifest = { "version": 1, "functions": { "/api/artists/me": {}, "/api/artists/[id]": {}, "/api/admin/stats": {}, "/api/files/folder": {}, "/api/artists": {}, "/api/files/bulk-delete": {}, "/api/files/stats": {}, "/api/files": {}, "/api/appointments": {}, "/api/portfolio/[id]": {}, "/api/portfolio/bulk-delete": {}, "/api/portfolio/stats": {}, "/api/portfolio": {}, "/api/users": {}, "/api/upload": {}, "/admin/analytics": {}, "/admin/portfolio": {}, "/admin/settings": {}, "/admin/uploads": {}, "/api/settings": {} } };
|
|
var PagesManifest = { "/_app": "pages/_app.js", "/_error": "pages/_error.js", "/_document": "pages/_document.js" };
|
|
process.env.NEXT_BUILD_ID = BuildId;
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/createMainHandler.js
|
|
init_logger();
|
|
|
|
// node_modules/@opennextjs/aws/dist/adapters/util.js
|
|
function setNodeEnv() {
|
|
const processEnv = process.env;
|
|
processEnv.NODE_ENV = process.env.NODE_ENV ?? "production";
|
|
}
|
|
function generateUniqueId() {
|
|
return Math.random().toString(36).slice(2, 8);
|
|
}
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/requestHandler.js
|
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
|
// node_modules/@opennextjs/aws/dist/http/openNextResponse.js
|
|
init_logger();
|
|
init_util();
|
|
import { Transform } from "node:stream";
|
|
var SET_COOKIE_HEADER = "set-cookie";
|
|
var CANNOT_BE_USED = "This cannot be used in OpenNext";
|
|
var OpenNextNodeResponse = class extends Transform {
|
|
fixHeaders;
|
|
onEnd;
|
|
streamCreator;
|
|
initialHeaders;
|
|
statusCode;
|
|
statusMessage = "";
|
|
headers = {};
|
|
_cookies = [];
|
|
responseStream;
|
|
headersSent = false;
|
|
_chunks = [];
|
|
// To comply with the ServerResponse interface :
|
|
strictContentLength = false;
|
|
assignSocket(_socket) {
|
|
throw new Error(CANNOT_BE_USED);
|
|
}
|
|
detachSocket(_socket) {
|
|
throw new Error(CANNOT_BE_USED);
|
|
}
|
|
// We might have to revisit those 3 in the future
|
|
writeContinue(_callback) {
|
|
throw new Error(CANNOT_BE_USED);
|
|
}
|
|
writeEarlyHints(_hints, _callback) {
|
|
throw new Error(CANNOT_BE_USED);
|
|
}
|
|
writeProcessing() {
|
|
throw new Error(CANNOT_BE_USED);
|
|
}
|
|
/**
|
|
* This is a dummy request object to comply with the ServerResponse interface
|
|
* It will never be defined
|
|
*/
|
|
req;
|
|
chunkedEncoding = false;
|
|
shouldKeepAlive = true;
|
|
useChunkedEncodingByDefault = true;
|
|
sendDate = false;
|
|
connection = null;
|
|
socket = null;
|
|
setTimeout(_msecs, _callback) {
|
|
throw new Error(CANNOT_BE_USED);
|
|
}
|
|
addTrailers(_headers) {
|
|
throw new Error(CANNOT_BE_USED);
|
|
}
|
|
constructor(fixHeaders, onEnd, streamCreator, initialHeaders, statusCode) {
|
|
super();
|
|
this.fixHeaders = fixHeaders;
|
|
this.onEnd = onEnd;
|
|
this.streamCreator = streamCreator;
|
|
this.initialHeaders = initialHeaders;
|
|
if (statusCode && Number.isInteger(statusCode) && statusCode >= 100 && statusCode <= 599) {
|
|
this.statusCode = statusCode;
|
|
}
|
|
streamCreator?.abortSignal?.addEventListener("abort", () => {
|
|
this.destroy();
|
|
});
|
|
}
|
|
// Necessary for next 12
|
|
// We might have to implement all the methods here
|
|
get originalResponse() {
|
|
return this;
|
|
}
|
|
get finished() {
|
|
return this.responseStream ? this.responseStream?.writableFinished : this.writableFinished;
|
|
}
|
|
setHeader(name, value) {
|
|
const key = name.toLowerCase();
|
|
if (key === SET_COOKIE_HEADER) {
|
|
if (Array.isArray(value)) {
|
|
this._cookies = value;
|
|
} else {
|
|
this._cookies = [value];
|
|
}
|
|
}
|
|
this.headers[key] = value;
|
|
return this;
|
|
}
|
|
removeHeader(name) {
|
|
const key = name.toLowerCase();
|
|
if (key === SET_COOKIE_HEADER) {
|
|
this._cookies = [];
|
|
} else {
|
|
delete this.headers[key];
|
|
}
|
|
return this;
|
|
}
|
|
hasHeader(name) {
|
|
const key = name.toLowerCase();
|
|
if (key === SET_COOKIE_HEADER) {
|
|
return this._cookies.length > 0;
|
|
}
|
|
return this.headers[key] !== void 0;
|
|
}
|
|
getHeaders() {
|
|
return this.headers;
|
|
}
|
|
getHeader(name) {
|
|
return this.headers[name.toLowerCase()];
|
|
}
|
|
getHeaderNames() {
|
|
return Object.keys(this.headers);
|
|
}
|
|
// Only used directly in next@14+
|
|
flushHeaders() {
|
|
this.headersSent = true;
|
|
const mergeHeadersPriority = globalThis.__openNextAls?.getStore()?.mergeHeadersPriority ?? "middleware";
|
|
if (this.initialHeaders) {
|
|
this.headers = mergeHeadersPriority === "middleware" ? {
|
|
...this.headers,
|
|
...this.initialHeaders
|
|
} : {
|
|
...this.initialHeaders,
|
|
...this.headers
|
|
};
|
|
const initialCookies = parseSetCookieHeader(this.initialHeaders[SET_COOKIE_HEADER]?.toString());
|
|
this._cookies = mergeHeadersPriority === "middleware" ? [...this._cookies, ...initialCookies] : [...initialCookies, ...this._cookies];
|
|
}
|
|
this.fixHeaders(this.headers);
|
|
this.fixHeadersForError();
|
|
this.headers[SET_COOKIE_HEADER] = this._cookies;
|
|
const parsedHeaders = parseHeaders(this.headers);
|
|
delete parsedHeaders[SET_COOKIE_HEADER];
|
|
if (this.streamCreator) {
|
|
this.responseStream = this.streamCreator?.writeHeaders({
|
|
statusCode: this.statusCode ?? 200,
|
|
cookies: this._cookies,
|
|
headers: parsedHeaders
|
|
});
|
|
this.pipe(this.responseStream);
|
|
}
|
|
}
|
|
appendHeader(name, value) {
|
|
const key = name.toLowerCase();
|
|
if (!this.hasHeader(key)) {
|
|
return this.setHeader(key, value);
|
|
}
|
|
const existingHeader = this.getHeader(key);
|
|
const toAppend = Array.isArray(value) ? value : [value];
|
|
const newValue = Array.isArray(existingHeader) ? [...existingHeader, ...toAppend] : [existingHeader, ...toAppend];
|
|
return this.setHeader(key, newValue);
|
|
}
|
|
writeHead(statusCode, statusMessage, headers) {
|
|
let _headers = headers;
|
|
let _statusMessage;
|
|
if (typeof statusMessage === "string") {
|
|
_statusMessage = statusMessage;
|
|
} else {
|
|
_headers = statusMessage;
|
|
}
|
|
const finalHeaders = this.headers;
|
|
if (_headers) {
|
|
if (Array.isArray(_headers)) {
|
|
for (let i = 0; i < _headers.length; i += 2) {
|
|
finalHeaders[_headers[i]] = _headers[i + 1];
|
|
}
|
|
} else {
|
|
for (const key of Object.keys(_headers)) {
|
|
finalHeaders[key] = _headers[key];
|
|
}
|
|
}
|
|
}
|
|
this.statusCode = statusCode;
|
|
if (headers) {
|
|
this.headers = finalHeaders;
|
|
}
|
|
this.flushHeaders();
|
|
return this;
|
|
}
|
|
/**
|
|
* OpenNext specific method
|
|
*/
|
|
getFixedHeaders() {
|
|
this.fixHeaders(this.headers);
|
|
this.fixHeadersForError();
|
|
this.headers[SET_COOKIE_HEADER] = this._cookies;
|
|
return this.headers;
|
|
}
|
|
getBody() {
|
|
return Buffer.concat(this._chunks);
|
|
}
|
|
_internalWrite(chunk, encoding) {
|
|
this._chunks.push(Buffer.from(chunk, encoding));
|
|
this.push(chunk, encoding);
|
|
this.streamCreator?.onWrite?.();
|
|
}
|
|
_transform(chunk, encoding, callback) {
|
|
if (!this.headersSent) {
|
|
this.flushHeaders();
|
|
}
|
|
this._internalWrite(chunk, encoding);
|
|
callback();
|
|
}
|
|
_flush(callback) {
|
|
if (!this.headersSent) {
|
|
this.flushHeaders();
|
|
}
|
|
globalThis.__openNextAls?.getStore()?.pendingPromiseRunner.add(this.onEnd(this.headers));
|
|
const bodyLength = this.getBody().length;
|
|
this.streamCreator?.onFinish?.(bodyLength);
|
|
if (bodyLength === 0 && // We use an env variable here because not all aws account have the same behavior
|
|
// On some aws accounts the response will hang if the body is empty
|
|
// We are modifying the response body here, this is not a good practice
|
|
process.env.OPEN_NEXT_FORCE_NON_EMPTY_RESPONSE === "true") {
|
|
debug('Force writing "SOMETHING" to the response body');
|
|
this.push("SOMETHING");
|
|
}
|
|
callback();
|
|
}
|
|
/**
|
|
* New method in Node 18.15+
|
|
* There are probably not used right now in Next.js, but better be safe than sorry
|
|
*/
|
|
setHeaders(headers) {
|
|
headers.forEach((value, key) => {
|
|
this.setHeader(key, Array.isArray(value) ? value : value.toString());
|
|
});
|
|
return this;
|
|
}
|
|
/**
|
|
* Next specific methods
|
|
* On earlier versions of next.js, those methods are mandatory to make everything work
|
|
*/
|
|
get sent() {
|
|
return this.finished || this.headersSent;
|
|
}
|
|
getHeaderValues(name) {
|
|
const values = this.getHeader(name);
|
|
if (values === void 0)
|
|
return void 0;
|
|
return (Array.isArray(values) ? values : [values]).map((value) => value.toString());
|
|
}
|
|
send() {
|
|
const body = this.getBody();
|
|
this.end(body);
|
|
}
|
|
body(value) {
|
|
this.write(value);
|
|
return this;
|
|
}
|
|
onClose(callback) {
|
|
this.on("close", callback);
|
|
}
|
|
redirect(destination, statusCode) {
|
|
this.setHeader("Location", destination);
|
|
this.statusCode = statusCode;
|
|
if (statusCode === 308) {
|
|
this.setHeader("Refresh", `0;url=${destination}`);
|
|
}
|
|
return this;
|
|
}
|
|
// For some reason, next returns the 500 error page with some cache-control headers
|
|
// We need to fix that
|
|
fixHeadersForError() {
|
|
if (process.env.OPEN_NEXT_DANGEROUSLY_SET_ERROR_HEADERS === "true") {
|
|
return;
|
|
}
|
|
if (this.statusCode === 404 || this.statusCode === 500) {
|
|
this.headers["cache-control"] = "private, no-cache, no-store, max-age=0, must-revalidate";
|
|
}
|
|
}
|
|
};
|
|
|
|
// node_modules/@opennextjs/aws/dist/http/request.js
|
|
import http from "node:http";
|
|
var IncomingMessage = class extends http.IncomingMessage {
|
|
constructor({ method, url, headers, body, remoteAddress }) {
|
|
super({
|
|
encrypted: true,
|
|
readable: false,
|
|
remoteAddress,
|
|
address: () => ({ port: 443 }),
|
|
end: Function.prototype,
|
|
destroy: Function.prototype
|
|
});
|
|
if (body) {
|
|
headers["content-length"] ??= String(Buffer.byteLength(body));
|
|
}
|
|
Object.assign(this, {
|
|
ip: remoteAddress,
|
|
complete: true,
|
|
httpVersion: "1.1",
|
|
httpVersionMajor: "1",
|
|
httpVersionMinor: "1",
|
|
method,
|
|
headers,
|
|
body,
|
|
url
|
|
});
|
|
this._read = () => {
|
|
this.push(body);
|
|
this.push(null);
|
|
};
|
|
}
|
|
};
|
|
|
|
// node_modules/@opennextjs/aws/dist/utils/promise.js
|
|
init_logger();
|
|
var DetachedPromise = class {
|
|
resolve;
|
|
reject;
|
|
promise;
|
|
constructor() {
|
|
let resolve;
|
|
let reject;
|
|
this.promise = new Promise((res, rej) => {
|
|
resolve = res;
|
|
reject = rej;
|
|
});
|
|
this.resolve = resolve;
|
|
this.reject = reject;
|
|
}
|
|
};
|
|
var DetachedPromiseRunner = class {
|
|
promises = [];
|
|
withResolvers() {
|
|
const detachedPromise = new DetachedPromise();
|
|
this.promises.push(detachedPromise);
|
|
return detachedPromise;
|
|
}
|
|
add(promise) {
|
|
const detachedPromise = new DetachedPromise();
|
|
this.promises.push(detachedPromise);
|
|
promise.then(detachedPromise.resolve, detachedPromise.reject);
|
|
}
|
|
async await() {
|
|
debug(`Awaiting ${this.promises.length} detached promises`);
|
|
const results = await Promise.allSettled(this.promises.map((p) => p.promise));
|
|
const rejectedPromises = results.filter((r) => r.status === "rejected");
|
|
rejectedPromises.forEach((r) => {
|
|
error(r.reason);
|
|
});
|
|
}
|
|
};
|
|
async function awaitAllDetachedPromise() {
|
|
const store = globalThis.__openNextAls.getStore();
|
|
const promisesToAwait = store?.pendingPromiseRunner.await() ?? Promise.resolve();
|
|
if (store?.waitUntil) {
|
|
store.waitUntil(promisesToAwait);
|
|
return;
|
|
}
|
|
await promisesToAwait;
|
|
}
|
|
function provideNextAfterProvider() {
|
|
const NEXT_REQUEST_CONTEXT_SYMBOL = Symbol.for("@next/request-context");
|
|
const VERCEL_REQUEST_CONTEXT_SYMBOL = Symbol.for("@vercel/request-context");
|
|
const store = globalThis.__openNextAls.getStore();
|
|
const waitUntil = store?.waitUntil ?? ((promise) => store?.pendingPromiseRunner.add(promise));
|
|
const nextAfterContext = {
|
|
get: () => ({
|
|
waitUntil
|
|
})
|
|
};
|
|
globalThis[NEXT_REQUEST_CONTEXT_SYMBOL] = nextAfterContext;
|
|
if (process.env.EMULATE_VERCEL_REQUEST_CONTEXT) {
|
|
globalThis[VERCEL_REQUEST_CONTEXT_SYMBOL] = nextAfterContext;
|
|
}
|
|
}
|
|
function runWithOpenNextRequestContext({ isISRRevalidation, waitUntil, requestId = Math.random().toString(36) }, fn) {
|
|
return globalThis.__openNextAls.run({
|
|
requestId,
|
|
pendingPromiseRunner: new DetachedPromiseRunner(),
|
|
isISRRevalidation,
|
|
waitUntil,
|
|
writtenTags: /* @__PURE__ */ new Set()
|
|
}, async () => {
|
|
provideNextAfterProvider();
|
|
let result;
|
|
try {
|
|
result = await fn();
|
|
} finally {
|
|
await awaitAllDetachedPromise();
|
|
}
|
|
return result;
|
|
});
|
|
}
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/requestHandler.js
|
|
init_logger();
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/patchAsyncStorage.js
|
|
var mod = (init_node_module(), __toCommonJS(node_module_exports));
|
|
var resolveFilename = mod._resolveFilename;
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routing/util.js
|
|
import crypto from "node:crypto";
|
|
import { Readable as Readable2 } from "node:stream";
|
|
init_util();
|
|
init_logger();
|
|
|
|
// node_modules/@opennextjs/aws/dist/utils/binary.js
|
|
var commonBinaryMimeTypes = /* @__PURE__ */ new Set([
|
|
"application/octet-stream",
|
|
// Docs
|
|
"application/epub+zip",
|
|
"application/msword",
|
|
"application/pdf",
|
|
"application/rtf",
|
|
"application/vnd.amazon.ebook",
|
|
"application/vnd.ms-excel",
|
|
"application/vnd.ms-powerpoint",
|
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
// Fonts
|
|
"font/otf",
|
|
"font/woff",
|
|
"font/woff2",
|
|
// Images
|
|
"image/bmp",
|
|
"image/gif",
|
|
"image/jpeg",
|
|
"image/png",
|
|
"image/tiff",
|
|
"image/vnd.microsoft.icon",
|
|
"image/webp",
|
|
// Audio
|
|
"audio/3gpp",
|
|
"audio/aac",
|
|
"audio/basic",
|
|
"audio/flac",
|
|
"audio/mpeg",
|
|
"audio/ogg",
|
|
"audio/wavaudio/webm",
|
|
"audio/x-aiff",
|
|
"audio/x-midi",
|
|
"audio/x-wav",
|
|
// Video
|
|
"video/3gpp",
|
|
"video/mp2t",
|
|
"video/mpeg",
|
|
"video/ogg",
|
|
"video/quicktime",
|
|
"video/webm",
|
|
"video/x-msvideo",
|
|
// Archives
|
|
"application/java-archive",
|
|
"application/vnd.apple.installer+xml",
|
|
"application/x-7z-compressed",
|
|
"application/x-apple-diskimage",
|
|
"application/x-bzip",
|
|
"application/x-bzip2",
|
|
"application/x-gzip",
|
|
"application/x-java-archive",
|
|
"application/x-rar-compressed",
|
|
"application/x-tar",
|
|
"application/x-zip",
|
|
"application/zip",
|
|
// Serialized data
|
|
"application/x-protobuf"
|
|
]);
|
|
function isBinaryContentType(contentType) {
|
|
if (!contentType)
|
|
return false;
|
|
const value = contentType?.split(";")[0] ?? "";
|
|
return commonBinaryMimeTypes.has(value);
|
|
}
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routing/i18n/index.js
|
|
init_stream();
|
|
init_logger();
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routing/i18n/accept-header.js
|
|
function parse(raw, preferences, options) {
|
|
const lowers = /* @__PURE__ */ new Map();
|
|
const header = raw.replace(/[ \t]/g, "");
|
|
if (preferences) {
|
|
let pos = 0;
|
|
for (const preference of preferences) {
|
|
const lower = preference.toLowerCase();
|
|
lowers.set(lower, { orig: preference, pos: pos++ });
|
|
if (options.prefixMatch) {
|
|
const parts2 = lower.split("-");
|
|
while (parts2.pop(), parts2.length > 0) {
|
|
const joined = parts2.join("-");
|
|
if (!lowers.has(joined)) {
|
|
lowers.set(joined, { orig: preference, pos: pos++ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const parts = header.split(",");
|
|
const selections = [];
|
|
const map = /* @__PURE__ */ new Set();
|
|
for (let i = 0; i < parts.length; ++i) {
|
|
const part = parts[i];
|
|
if (!part) {
|
|
continue;
|
|
}
|
|
const params = part.split(";");
|
|
if (params.length > 2) {
|
|
throw new Error(`Invalid ${options.type} header`);
|
|
}
|
|
const token = params[0].toLowerCase();
|
|
if (!token) {
|
|
throw new Error(`Invalid ${options.type} header`);
|
|
}
|
|
const selection = { token, pos: i, q: 1 };
|
|
if (preferences && lowers.has(token)) {
|
|
selection.pref = lowers.get(token).pos;
|
|
}
|
|
map.add(selection.token);
|
|
if (params.length === 2) {
|
|
const q = params[1];
|
|
const [key, value] = q.split("=");
|
|
if (!value || key !== "q" && key !== "Q") {
|
|
throw new Error(`Invalid ${options.type} header`);
|
|
}
|
|
const score = Number.parseFloat(value);
|
|
if (score === 0) {
|
|
continue;
|
|
}
|
|
if (Number.isFinite(score) && score <= 1 && score >= 1e-3) {
|
|
selection.q = score;
|
|
}
|
|
}
|
|
selections.push(selection);
|
|
}
|
|
selections.sort((a, b) => {
|
|
if (b.q !== a.q) {
|
|
return b.q - a.q;
|
|
}
|
|
if (b.pref !== a.pref) {
|
|
if (a.pref === void 0) {
|
|
return 1;
|
|
}
|
|
if (b.pref === void 0) {
|
|
return -1;
|
|
}
|
|
return a.pref - b.pref;
|
|
}
|
|
return a.pos - b.pos;
|
|
});
|
|
const values = selections.map((selection) => selection.token);
|
|
if (!preferences || !preferences.length) {
|
|
return values;
|
|
}
|
|
const preferred = [];
|
|
for (const selection of values) {
|
|
if (selection === "*") {
|
|
for (const [preference, value] of lowers) {
|
|
if (!map.has(preference)) {
|
|
preferred.push(value.orig);
|
|
}
|
|
}
|
|
} else {
|
|
const lower = selection.toLowerCase();
|
|
if (lowers.has(lower)) {
|
|
preferred.push(lowers.get(lower).orig);
|
|
}
|
|
}
|
|
}
|
|
return preferred;
|
|
}
|
|
function acceptLanguage(header = "", preferences) {
|
|
return parse(header, preferences, {
|
|
type: "accept-language",
|
|
prefixMatch: true
|
|
})[0] || void 0;
|
|
}
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routing/i18n/index.js
|
|
function isLocalizedPath(path2) {
|
|
return NextConfig.i18n?.locales.includes(path2.split("/")[1].toLowerCase()) ?? false;
|
|
}
|
|
function getLocaleFromCookie(cookies) {
|
|
const i18n = NextConfig.i18n;
|
|
const nextLocale = cookies.NEXT_LOCALE?.toLowerCase();
|
|
return nextLocale ? i18n?.locales.find((locale) => nextLocale === locale.toLowerCase()) : void 0;
|
|
}
|
|
function detectDomainLocale({ hostname, detectedLocale }) {
|
|
const i18n = NextConfig.i18n;
|
|
const domains = i18n?.domains;
|
|
if (!domains) {
|
|
return;
|
|
}
|
|
const lowercasedLocale = detectedLocale?.toLowerCase();
|
|
for (const domain of domains) {
|
|
const domainHostname = domain.domain.split(":", 1)[0].toLowerCase();
|
|
if (hostname === domainHostname || lowercasedLocale === domain.defaultLocale.toLowerCase() || domain.locales?.some((locale) => lowercasedLocale === locale.toLowerCase())) {
|
|
return domain;
|
|
}
|
|
}
|
|
}
|
|
function detectLocale(internalEvent, i18n) {
|
|
const domainLocale = detectDomainLocale({
|
|
hostname: internalEvent.headers.host
|
|
});
|
|
if (i18n.localeDetection === false) {
|
|
return domainLocale?.defaultLocale ?? i18n.defaultLocale;
|
|
}
|
|
const cookiesLocale = getLocaleFromCookie(internalEvent.cookies);
|
|
const preferredLocale = acceptLanguage(internalEvent.headers["accept-language"], i18n?.locales);
|
|
debug({
|
|
cookiesLocale,
|
|
preferredLocale,
|
|
defaultLocale: i18n.defaultLocale,
|
|
domainLocale
|
|
});
|
|
return domainLocale?.defaultLocale ?? cookiesLocale ?? preferredLocale ?? i18n.defaultLocale;
|
|
}
|
|
function localizePath(internalEvent) {
|
|
const i18n = NextConfig.i18n;
|
|
if (!i18n) {
|
|
return internalEvent.rawPath;
|
|
}
|
|
if (isLocalizedPath(internalEvent.rawPath)) {
|
|
return internalEvent.rawPath;
|
|
}
|
|
const detectedLocale = detectLocale(internalEvent, i18n);
|
|
return `/${detectedLocale}${internalEvent.rawPath}`;
|
|
}
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routing/queue.js
|
|
function generateShardId(rawPath, maxConcurrency, prefix) {
|
|
let a = cyrb128(rawPath);
|
|
let t = a += 1831565813;
|
|
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
const randomFloat = ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
const randomInt = Math.floor(randomFloat * maxConcurrency);
|
|
return `${prefix}-${randomInt}`;
|
|
}
|
|
function generateMessageGroupId(rawPath) {
|
|
const maxConcurrency = Number.parseInt(process.env.MAX_REVALIDATE_CONCURRENCY ?? "10");
|
|
return generateShardId(rawPath, maxConcurrency, "revalidate");
|
|
}
|
|
function cyrb128(str) {
|
|
let h1 = 1779033703;
|
|
let h2 = 3144134277;
|
|
let h3 = 1013904242;
|
|
let h4 = 2773480762;
|
|
for (let i = 0, k; i < str.length; i++) {
|
|
k = str.charCodeAt(i);
|
|
h1 = h2 ^ Math.imul(h1 ^ k, 597399067);
|
|
h2 = h3 ^ Math.imul(h2 ^ k, 2869860233);
|
|
h3 = h4 ^ Math.imul(h3 ^ k, 951274213);
|
|
h4 = h1 ^ Math.imul(h4 ^ k, 2716044179);
|
|
}
|
|
h1 = Math.imul(h3 ^ h1 >>> 18, 597399067);
|
|
h2 = Math.imul(h4 ^ h2 >>> 22, 2869860233);
|
|
h3 = Math.imul(h1 ^ h3 >>> 17, 951274213);
|
|
h4 = Math.imul(h2 ^ h4 >>> 19, 2716044179);
|
|
h1 ^= h2 ^ h3 ^ h4, h2 ^= h1, h3 ^= h1, h4 ^= h1;
|
|
return h1 >>> 0;
|
|
}
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routing/util.js
|
|
function constructNextUrl(baseUrl, path2) {
|
|
const nextBasePath = NextConfig.basePath ?? "";
|
|
const url = new URL(`${nextBasePath}${path2}`, baseUrl);
|
|
return url.href;
|
|
}
|
|
function convertRes(res) {
|
|
const statusCode = res.statusCode || 200;
|
|
const headers = parseHeaders(res.getFixedHeaders());
|
|
const isBase64Encoded = isBinaryContentType(headers["content-type"]) || !!headers["content-encoding"];
|
|
const body = Readable2.toWeb(Readable2.from(res.getBody()));
|
|
return {
|
|
type: "core",
|
|
statusCode,
|
|
headers,
|
|
body,
|
|
isBase64Encoded
|
|
};
|
|
}
|
|
function convertToQuery(querystring) {
|
|
const query = new URLSearchParams(querystring);
|
|
const queryObject = {};
|
|
for (const key of query.keys()) {
|
|
const queries = query.getAll(key);
|
|
queryObject[key] = queries.length > 1 ? queries : queries[0];
|
|
}
|
|
return queryObject;
|
|
}
|
|
function getMiddlewareMatch(middlewareManifest2, functionsManifest) {
|
|
if (functionsManifest?.functions?.["/_middleware"]) {
|
|
return functionsManifest.functions["/_middleware"].matchers?.map(({ regexp }) => new RegExp(regexp)) ?? [/.*/];
|
|
}
|
|
const rootMiddleware = middlewareManifest2.middleware["/"];
|
|
if (!rootMiddleware?.matchers)
|
|
return [];
|
|
return rootMiddleware.matchers.map(({ regexp }) => new RegExp(regexp));
|
|
}
|
|
var CommonHeaders;
|
|
(function(CommonHeaders2) {
|
|
CommonHeaders2["CACHE_CONTROL"] = "cache-control";
|
|
CommonHeaders2["NEXT_CACHE"] = "x-nextjs-cache";
|
|
})(CommonHeaders || (CommonHeaders = {}));
|
|
function fixCacheHeaderForHtmlPages(internalEvent, headers) {
|
|
if (internalEvent.rawPath === "/404" || internalEvent.rawPath === "/500") {
|
|
if (process.env.OPEN_NEXT_DANGEROUSLY_SET_ERROR_HEADERS === "true") {
|
|
return;
|
|
}
|
|
headers[CommonHeaders.CACHE_CONTROL] = "private, no-cache, no-store, max-age=0, must-revalidate";
|
|
return;
|
|
}
|
|
const localizedPath = localizePath(internalEvent);
|
|
if (HtmlPages.includes(localizedPath) && !internalEvent.headers["x-middleware-prefetch"]) {
|
|
headers[CommonHeaders.CACHE_CONTROL] = "public, max-age=0, s-maxage=31536000, must-revalidate";
|
|
}
|
|
}
|
|
function fixSWRCacheHeader(headers) {
|
|
let cacheControl = headers[CommonHeaders.CACHE_CONTROL];
|
|
if (!cacheControl)
|
|
return;
|
|
if (Array.isArray(cacheControl)) {
|
|
cacheControl = cacheControl.join(",");
|
|
}
|
|
if (typeof cacheControl !== "string")
|
|
return;
|
|
headers[CommonHeaders.CACHE_CONTROL] = cacheControl.replace(/\bstale-while-revalidate(?!=)/, "stale-while-revalidate=2592000");
|
|
}
|
|
function addOpenNextHeader(headers) {
|
|
if (NextConfig.poweredByHeader) {
|
|
headers["X-OpenNext"] = "1";
|
|
}
|
|
if (globalThis.openNextDebug) {
|
|
headers["X-OpenNext-Version"] = globalThis.openNextVersion;
|
|
}
|
|
if (process.env.OPEN_NEXT_REQUEST_ID_HEADER || globalThis.openNextDebug) {
|
|
headers["X-OpenNext-RequestId"] = globalThis.__openNextAls.getStore()?.requestId;
|
|
}
|
|
}
|
|
async function revalidateIfRequired(host, rawPath, headers, req) {
|
|
if (headers[CommonHeaders.NEXT_CACHE] === "STALE") {
|
|
const internalMeta = req?.[Symbol.for("NextInternalRequestMeta")];
|
|
const revalidateUrl = internalMeta?._nextDidRewrite ? rawPath.startsWith("/_next/data/") ? `/_next/data/${BuildId}${internalMeta?._nextRewroteUrl}.json` : internalMeta?._nextRewroteUrl : rawPath;
|
|
try {
|
|
const hash = (str) => crypto.createHash("md5").update(str).digest("hex");
|
|
const lastModified = globalThis.__openNextAls.getStore()?.lastModified ?? 0;
|
|
const eTag = `${headers.etag ?? headers.ETag ?? ""}`;
|
|
await globalThis.queue.send({
|
|
MessageBody: { host, url: revalidateUrl, eTag, lastModified },
|
|
MessageDeduplicationId: hash(`${rawPath}-${lastModified}-${eTag}`),
|
|
MessageGroupId: generateMessageGroupId(rawPath)
|
|
});
|
|
} catch (e) {
|
|
error(`Failed to revalidate stale page ${rawPath}`, e);
|
|
}
|
|
}
|
|
}
|
|
function fixISRHeaders(headers) {
|
|
if (headers[CommonHeaders.NEXT_CACHE] === "REVALIDATED") {
|
|
headers[CommonHeaders.CACHE_CONTROL] = "private, no-cache, no-store, max-age=0, must-revalidate";
|
|
return;
|
|
}
|
|
const _lastModified = globalThis.__openNextAls.getStore()?.lastModified ?? 0;
|
|
if (headers[CommonHeaders.NEXT_CACHE] === "HIT" && _lastModified > 0) {
|
|
const age = Math.round((Date.now() - _lastModified) / 1e3);
|
|
const regex = /s-maxage=(\d+)/;
|
|
const cacheControl = headers[CommonHeaders.CACHE_CONTROL];
|
|
debug("cache-control", cacheControl, _lastModified, Date.now());
|
|
if (typeof cacheControl !== "string")
|
|
return;
|
|
const match = cacheControl.match(regex);
|
|
const sMaxAge = match ? Number.parseInt(match[1]) : void 0;
|
|
if (sMaxAge && sMaxAge !== 31536e3) {
|
|
const remainingTtl = Math.max(sMaxAge - age, 1);
|
|
headers[CommonHeaders.CACHE_CONTROL] = `s-maxage=${remainingTtl}, stale-while-revalidate=2592000`;
|
|
}
|
|
}
|
|
if (headers[CommonHeaders.NEXT_CACHE] !== "STALE")
|
|
return;
|
|
headers[CommonHeaders.CACHE_CONTROL] = "s-maxage=2, stale-while-revalidate=2592000";
|
|
}
|
|
function createServerResponse(routingResult, headers, responseStream) {
|
|
const internalEvent = routingResult.internalEvent;
|
|
return new OpenNextNodeResponse((_headers) => {
|
|
fixCacheHeaderForHtmlPages(internalEvent, _headers);
|
|
fixSWRCacheHeader(_headers);
|
|
addOpenNextHeader(_headers);
|
|
fixISRHeaders(_headers);
|
|
}, async (_headers) => {
|
|
await revalidateIfRequired(internalEvent.headers.host, internalEvent.rawPath, _headers);
|
|
await invalidateCDNOnRequest(routingResult, _headers);
|
|
}, responseStream, headers, routingResult.rewriteStatusCode);
|
|
}
|
|
async function invalidateCDNOnRequest(params, headers) {
|
|
const { internalEvent, resolvedRoutes, initialURL } = params;
|
|
const initialPath = new URL(initialURL).pathname;
|
|
const isIsrRevalidation = internalEvent.headers["x-isr"] === "1";
|
|
if (!isIsrRevalidation && headers[CommonHeaders.NEXT_CACHE] === "REVALIDATED") {
|
|
await globalThis.cdnInvalidationHandler.invalidatePaths([
|
|
{
|
|
initialPath,
|
|
rawPath: internalEvent.rawPath,
|
|
resolvedRoutes
|
|
}
|
|
]);
|
|
}
|
|
}
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routingHandler.js
|
|
init_logger();
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routing/cacheInterceptor.js
|
|
init_stream();
|
|
|
|
// node_modules/@opennextjs/aws/dist/utils/cache.js
|
|
init_logger();
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routing/cacheInterceptor.js
|
|
init_logger();
|
|
var CACHE_ONE_YEAR = 60 * 60 * 24 * 365;
|
|
var CACHE_ONE_MONTH = 60 * 60 * 24 * 30;
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routing/matcher.js
|
|
init_stream();
|
|
init_logger();
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routing/routeMatcher.js
|
|
var optionalLocalePrefixRegex = `^/(?:${RoutesManifest.locales.map((locale) => `${locale}/?`).join("|")})?`;
|
|
var optionalBasepathPrefixRegex = RoutesManifest.basePath ? `^${RoutesManifest.basePath}/?` : "^/";
|
|
var optionalPrefix = optionalLocalePrefixRegex.replace("^/", optionalBasepathPrefixRegex);
|
|
function routeMatcher(routeDefinitions) {
|
|
const regexp = routeDefinitions.map((route) => ({
|
|
page: route.page,
|
|
regexp: new RegExp(route.regex.replace("^/", optionalPrefix))
|
|
}));
|
|
const appPathsSet = /* @__PURE__ */ new Set();
|
|
const routePathsSet = /* @__PURE__ */ new Set();
|
|
for (const [k, v] of Object.entries(AppPathRoutesManifest)) {
|
|
if (k.endsWith("page")) {
|
|
appPathsSet.add(v);
|
|
} else if (k.endsWith("route")) {
|
|
routePathsSet.add(v);
|
|
}
|
|
}
|
|
return function matchRoute(path2) {
|
|
const foundRoutes = regexp.filter((route) => route.regexp.test(path2));
|
|
return foundRoutes.map((foundRoute) => {
|
|
let routeType = "page";
|
|
if (appPathsSet.has(foundRoute.page)) {
|
|
routeType = "app";
|
|
} else if (routePathsSet.has(foundRoute.page)) {
|
|
routeType = "route";
|
|
}
|
|
return {
|
|
route: foundRoute.page,
|
|
type: routeType
|
|
};
|
|
});
|
|
};
|
|
}
|
|
var staticRouteMatcher = routeMatcher([
|
|
...RoutesManifest.routes.static,
|
|
...getStaticAPIRoutes()
|
|
]);
|
|
var dynamicRouteMatcher = routeMatcher(RoutesManifest.routes.dynamic);
|
|
function getStaticAPIRoutes() {
|
|
const createRouteDefinition = (route) => ({
|
|
page: route,
|
|
regex: `^${route}(?:/)?$`
|
|
});
|
|
const dynamicRoutePages = new Set(RoutesManifest.routes.dynamic.map(({ page }) => page));
|
|
const pagesStaticAPIRoutes = Object.keys(PagesManifest).filter((route) => route.startsWith("/api/") && !dynamicRoutePages.has(route)).map(createRouteDefinition);
|
|
const appPathsStaticAPIRoutes = Object.values(AppPathRoutesManifest).filter((route) => route.startsWith("/api/") || route === "/api" && !dynamicRoutePages.has(route)).map(createRouteDefinition);
|
|
return [...pagesStaticAPIRoutes, ...appPathsStaticAPIRoutes];
|
|
}
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routing/middleware.js
|
|
init_stream();
|
|
init_utils();
|
|
var middlewareManifest = MiddlewareManifest;
|
|
var functionsConfigManifest = FunctionsConfigManifest;
|
|
var middleMatch = getMiddlewareMatch(middlewareManifest, functionsConfigManifest);
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/routingHandler.js
|
|
var MIDDLEWARE_HEADER_PREFIX = "x-middleware-response-";
|
|
var MIDDLEWARE_HEADER_PREFIX_LEN = MIDDLEWARE_HEADER_PREFIX.length;
|
|
var INTERNAL_HEADER_PREFIX = "x-opennext-";
|
|
var INTERNAL_HEADER_INITIAL_URL = `${INTERNAL_HEADER_PREFIX}initial-url`;
|
|
var INTERNAL_HEADER_LOCALE = `${INTERNAL_HEADER_PREFIX}locale`;
|
|
var INTERNAL_HEADER_RESOLVED_ROUTES = `${INTERNAL_HEADER_PREFIX}resolved-routes`;
|
|
var INTERNAL_HEADER_REWRITE_STATUS_CODE = `${INTERNAL_HEADER_PREFIX}rewrite-status-code`;
|
|
var INTERNAL_EVENT_REQUEST_ID = `${INTERNAL_HEADER_PREFIX}request-id`;
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/util.js
|
|
init_logger();
|
|
import NextServer from "next/dist/server/next-server.js";
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/require-hooks.js
|
|
init_logger();
|
|
var mod2 = (init_node_module(), __toCommonJS(node_module_exports));
|
|
var resolveFilename2 = mod2._resolveFilename;
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/util.js
|
|
var cacheHandlerPath = __require.resolve("./cache.cjs");
|
|
var composableCacheHandlerPath = __require.resolve("./composable-cache.cjs");
|
|
var nextServer = new NextServer.default({
|
|
conf: {
|
|
...NextConfig,
|
|
// Next.js compression should be disabled because of a bug in the bundled
|
|
// `compression` package — https://github.com/vercel/next.js/issues/11669
|
|
compress: false,
|
|
// By default, Next.js uses local disk to store ISR cache. We will use
|
|
// our own cache handler to store the cache on S3.
|
|
//#override stableIncrementalCache
|
|
cacheHandler: cacheHandlerPath,
|
|
cacheMaxMemorySize: 0,
|
|
// We need to disable memory cache
|
|
//#endOverride
|
|
experimental: {
|
|
...NextConfig.experimental,
|
|
// This uses the request.headers.host as the URL
|
|
// https://github.com/vercel/next.js/blob/canary/packages/next/src/server/next-server.ts#L1749-L1754
|
|
//#override trustHostHeader
|
|
trustHostHeader: true
|
|
//#endOverride
|
|
}
|
|
},
|
|
customServer: false,
|
|
dev: false,
|
|
dir: __dirname
|
|
});
|
|
var routesLoaded = false;
|
|
globalThis.__next_route_preloader = async (stage) => {
|
|
if (routesLoaded) {
|
|
return;
|
|
}
|
|
const thisFunction = globalThis.fnName ? globalThis.openNextConfig.functions[globalThis.fnName] : globalThis.openNextConfig.default;
|
|
const routePreloadingBehavior = thisFunction?.routePreloadingBehavior ?? "none";
|
|
if (routePreloadingBehavior === "none") {
|
|
routesLoaded = true;
|
|
return;
|
|
}
|
|
if (!("unstable_preloadEntries" in nextServer)) {
|
|
debug("The current version of Next.js does not support route preloading. Skipping route preloading.");
|
|
routesLoaded = true;
|
|
return;
|
|
}
|
|
if (stage === "waitUntil" && routePreloadingBehavior === "withWaitUntil") {
|
|
const waitUntil = globalThis.__openNextAls.getStore()?.waitUntil;
|
|
if (!waitUntil) {
|
|
error("You've tried to use the 'withWaitUntil' route preloading behavior, but the 'waitUntil' function is not available.");
|
|
routesLoaded = true;
|
|
return;
|
|
}
|
|
debug("Preloading entries with waitUntil");
|
|
waitUntil?.(nextServer.unstable_preloadEntries());
|
|
routesLoaded = true;
|
|
} else if (stage === "start" && routePreloadingBehavior === "onStart" || stage === "warmerEvent" && routePreloadingBehavior === "onWarmerEvent" || stage === "onDemand") {
|
|
const startTimestamp = Date.now();
|
|
debug("Preloading entries");
|
|
await nextServer.unstable_preloadEntries();
|
|
debug("Preloading entries took", Date.now() - startTimestamp, "ms");
|
|
routesLoaded = true;
|
|
}
|
|
};
|
|
var requestHandler = (metadata) => "getRequestHandlerWithMetadata" in nextServer ? nextServer.getRequestHandlerWithMetadata(metadata) : nextServer.getRequestHandler();
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/requestHandler.js
|
|
globalThis.__openNextAls = new AsyncLocalStorage();
|
|
async function openNextHandler(internalEvent, options) {
|
|
const initialHeaders = internalEvent.headers;
|
|
const requestId = globalThis.openNextConfig.middleware?.external ? internalEvent.headers[INTERNAL_EVENT_REQUEST_ID] : Math.random().toString(36);
|
|
return runWithOpenNextRequestContext({
|
|
isISRRevalidation: initialHeaders["x-isr"] === "1",
|
|
waitUntil: options?.waitUntil,
|
|
requestId
|
|
}, async () => {
|
|
await globalThis.__next_route_preloader("waitUntil");
|
|
if (initialHeaders["x-forwarded-host"]) {
|
|
initialHeaders.host = initialHeaders["x-forwarded-host"];
|
|
}
|
|
debug("internalEvent", internalEvent);
|
|
const internalHeaders = {
|
|
initialPath: initialHeaders[INTERNAL_HEADER_INITIAL_URL] ?? internalEvent.rawPath,
|
|
resolvedRoutes: initialHeaders[INTERNAL_HEADER_RESOLVED_ROUTES] ? JSON.parse(initialHeaders[INTERNAL_HEADER_RESOLVED_ROUTES]) : [],
|
|
rewriteStatusCode: Number.parseInt(initialHeaders[INTERNAL_HEADER_REWRITE_STATUS_CODE])
|
|
};
|
|
let routingResult = {
|
|
internalEvent,
|
|
isExternalRewrite: false,
|
|
origin: false,
|
|
isISR: false,
|
|
initialURL: internalEvent.url,
|
|
...internalHeaders
|
|
};
|
|
const headers = "type" in routingResult ? routingResult.headers : routingResult.internalEvent.headers;
|
|
const overwrittenResponseHeaders = {};
|
|
for (const [rawKey, value] of Object.entries(headers)) {
|
|
if (!rawKey.startsWith(MIDDLEWARE_HEADER_PREFIX)) {
|
|
continue;
|
|
}
|
|
const key = rawKey.slice(MIDDLEWARE_HEADER_PREFIX_LEN);
|
|
if (key !== "x-middleware-set-cookie") {
|
|
overwrittenResponseHeaders[key] = value;
|
|
}
|
|
headers[key] = value;
|
|
delete headers[rawKey];
|
|
}
|
|
if ("isExternalRewrite" in routingResult && routingResult.isExternalRewrite === true) {
|
|
try {
|
|
routingResult = await globalThis.proxyExternalRequest.proxy(routingResult.internalEvent);
|
|
} catch (e) {
|
|
error("External request failed.", e);
|
|
routingResult = {
|
|
internalEvent: {
|
|
type: "core",
|
|
rawPath: "/500",
|
|
method: "GET",
|
|
headers: {},
|
|
url: constructNextUrl(internalEvent.url, "/500"),
|
|
query: {},
|
|
cookies: {},
|
|
remoteAddress: ""
|
|
},
|
|
// On error we need to rewrite to the 500 page which is an internal rewrite
|
|
isExternalRewrite: false,
|
|
isISR: false,
|
|
origin: false,
|
|
initialURL: internalEvent.url,
|
|
resolvedRoutes: [{ route: "/500", type: "page" }]
|
|
};
|
|
}
|
|
}
|
|
if ("type" in routingResult) {
|
|
if (options?.streamCreator) {
|
|
const response = createServerResponse({
|
|
internalEvent,
|
|
isExternalRewrite: false,
|
|
isISR: false,
|
|
resolvedRoutes: [],
|
|
origin: false,
|
|
initialURL: internalEvent.url
|
|
}, routingResult.headers, options.streamCreator);
|
|
response.statusCode = routingResult.statusCode;
|
|
response.flushHeaders();
|
|
const [bodyToConsume, bodyToReturn] = routingResult.body.tee();
|
|
for await (const chunk of bodyToConsume) {
|
|
response.write(chunk);
|
|
}
|
|
response.end();
|
|
routingResult.body = bodyToReturn;
|
|
}
|
|
return routingResult;
|
|
}
|
|
const preprocessedEvent = routingResult.internalEvent;
|
|
debug("preprocessedEvent", preprocessedEvent);
|
|
const { search, pathname, hash } = new URL(preprocessedEvent.url);
|
|
const reqProps = {
|
|
method: preprocessedEvent.method,
|
|
url: `${pathname}${search}${hash}`,
|
|
//WORKAROUND: We pass this header to the serverless function to mimic a prefetch request which will not trigger revalidation since we handle revalidation differently
|
|
// There is 3 way we can handle revalidation:
|
|
// 1. We could just let the revalidation go as normal, but due to race conditions the revalidation will be unreliable
|
|
// 2. We could alter the lastModified time of our cache to make next believe that the cache is fresh, but this could cause issues with stale data since the cdn will cache the stale data as if it was fresh
|
|
// 3. OUR CHOICE: We could pass a purpose prefetch header to the serverless function to make next believe that the request is a prefetch request and not trigger revalidation (This could potentially break in the future if next changes the behavior of prefetch requests)
|
|
headers: {
|
|
...headers
|
|
},
|
|
body: preprocessedEvent.body,
|
|
remoteAddress: preprocessedEvent.remoteAddress
|
|
};
|
|
const mergeHeadersPriority = globalThis.openNextConfig.dangerous?.headersAndCookiesPriority ? globalThis.openNextConfig.dangerous.headersAndCookiesPriority(preprocessedEvent) : "middleware";
|
|
const store = globalThis.__openNextAls.getStore();
|
|
if (store) {
|
|
store.mergeHeadersPriority = mergeHeadersPriority;
|
|
}
|
|
const req = new IncomingMessage(reqProps);
|
|
const res = createServerResponse(routingResult, overwrittenResponseHeaders, options?.streamCreator);
|
|
await processRequest(req, res, routingResult);
|
|
const { statusCode, headers: responseHeaders, isBase64Encoded, body } = convertRes(res);
|
|
const internalResult = {
|
|
type: internalEvent.type,
|
|
statusCode,
|
|
headers: responseHeaders,
|
|
body,
|
|
isBase64Encoded
|
|
};
|
|
return internalResult;
|
|
});
|
|
}
|
|
async function processRequest(req, res, routingResult) {
|
|
delete req.body;
|
|
const initialURL = new URL(
|
|
// We always assume that only the routing layer can set this header.
|
|
routingResult.internalEvent.headers[INTERNAL_HEADER_INITIAL_URL] ?? routingResult.initialURL
|
|
);
|
|
let invokeStatus;
|
|
if (routingResult.internalEvent.rawPath === "/500") {
|
|
invokeStatus = 500;
|
|
} else if (routingResult.internalEvent.rawPath === "/404") {
|
|
invokeStatus = 404;
|
|
}
|
|
const requestMetadata = {
|
|
isNextDataReq: routingResult.internalEvent.query.__nextDataReq === "1",
|
|
initURL: routingResult.initialURL,
|
|
initQuery: convertToQuery(initialURL.search),
|
|
initProtocol: initialURL.protocol,
|
|
defaultLocale: NextConfig.i18n?.defaultLocale,
|
|
locale: routingResult.locale,
|
|
middlewareInvoke: false,
|
|
// By setting invokePath and invokeQuery we can bypass some of the routing logic in Next.js
|
|
invokePath: routingResult.internalEvent.rawPath,
|
|
invokeQuery: routingResult.internalEvent.query,
|
|
// invokeStatus is only used for error pages
|
|
invokeStatus
|
|
};
|
|
try {
|
|
await requestHandler(requestMetadata)(req, res);
|
|
} catch (e) {
|
|
if (e.constructor.name === "NoFallbackError") {
|
|
await handleNoFallbackError(req, res, routingResult, requestMetadata);
|
|
} else {
|
|
error("NextJS request failed.", e);
|
|
await tryRenderError("500", res, routingResult.internalEvent);
|
|
}
|
|
}
|
|
}
|
|
async function handleNoFallbackError(req, res, routingResult, metadata, index = 1) {
|
|
if (index >= 5) {
|
|
await tryRenderError("500", res, routingResult.internalEvent);
|
|
return;
|
|
}
|
|
if (index >= routingResult.resolvedRoutes.length) {
|
|
await tryRenderError("404", res, routingResult.internalEvent);
|
|
return;
|
|
}
|
|
try {
|
|
await requestHandler({
|
|
...routingResult,
|
|
invokeOutput: routingResult.resolvedRoutes[index].route,
|
|
...metadata
|
|
})(req, res);
|
|
} catch (e) {
|
|
if (e.constructor.name === "NoFallbackError") {
|
|
await handleNoFallbackError(req, res, routingResult, metadata, index + 1);
|
|
} else {
|
|
error("NextJS request failed.", e);
|
|
await tryRenderError("500", res, routingResult.internalEvent);
|
|
}
|
|
}
|
|
}
|
|
async function tryRenderError(type, res, internalEvent) {
|
|
try {
|
|
const _req = new IncomingMessage({
|
|
method: "GET",
|
|
url: `/${type}`,
|
|
headers: internalEvent.headers,
|
|
body: internalEvent.body,
|
|
remoteAddress: internalEvent.remoteAddress
|
|
});
|
|
const requestMetadata = {
|
|
// By setting invokePath and invokeQuery we can bypass some of the routing logic in Next.js
|
|
invokePath: type === "404" ? "/404" : "/500",
|
|
invokeStatus: type === "404" ? 404 : 500,
|
|
middlewareInvoke: false
|
|
};
|
|
await requestHandler(requestMetadata)(_req, res);
|
|
} catch (e) {
|
|
error("NextJS request failed.", e);
|
|
res.statusCode = 500;
|
|
res.setHeader("Content-Type", "application/json");
|
|
res.end(JSON.stringify({
|
|
message: "Server failed to respond.",
|
|
details: e
|
|
}, null, 2));
|
|
}
|
|
}
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/resolve.js
|
|
async function resolveConverter(converter2) {
|
|
if (typeof converter2 === "function") {
|
|
return converter2();
|
|
}
|
|
const m_1 = await Promise.resolve().then(() => (init_edge(), edge_exports));
|
|
return m_1.default;
|
|
}
|
|
async function resolveWrapper(wrapper) {
|
|
if (typeof wrapper === "function") {
|
|
return wrapper();
|
|
}
|
|
const m_1 = await Promise.resolve().then(() => (init_cloudflare_node(), cloudflare_node_exports));
|
|
return m_1.default;
|
|
}
|
|
async function resolveTagCache(tagCache) {
|
|
if (typeof tagCache === "function") {
|
|
return tagCache();
|
|
}
|
|
const m_1 = await Promise.resolve().then(() => (init_dummy(), dummy_exports));
|
|
return m_1.default;
|
|
}
|
|
async function resolveQueue(queue) {
|
|
if (typeof queue === "function") {
|
|
return queue();
|
|
}
|
|
const m_1 = await Promise.resolve().then(() => (init_dummy2(), dummy_exports2));
|
|
return m_1.default;
|
|
}
|
|
async function resolveIncrementalCache(incrementalCache) {
|
|
if (typeof incrementalCache === "function") {
|
|
return incrementalCache();
|
|
}
|
|
const m_1 = await Promise.resolve().then(() => (init_dummy3(), dummy_exports3));
|
|
return m_1.default;
|
|
}
|
|
async function resolveAssetResolver(assetResolver) {
|
|
if (typeof assetResolver === "function") {
|
|
return assetResolver();
|
|
}
|
|
const m_1 = await Promise.resolve().then(() => (init_dummy4(), dummy_exports4));
|
|
return m_1.default;
|
|
}
|
|
async function resolveProxyRequest(proxyRequest) {
|
|
if (typeof proxyRequest === "function") {
|
|
return proxyRequest();
|
|
}
|
|
const m_1 = await Promise.resolve().then(() => (init_fetch(), fetch_exports));
|
|
return m_1.default;
|
|
}
|
|
async function resolveCdnInvalidation(cdnInvalidation) {
|
|
if (typeof cdnInvalidation === "function") {
|
|
return cdnInvalidation();
|
|
}
|
|
const m_1 = await Promise.resolve().then(() => (init_dummy5(), dummy_exports5));
|
|
return m_1.default;
|
|
}
|
|
|
|
// node_modules/@opennextjs/aws/dist/core/createMainHandler.js
|
|
async function createMainHandler() {
|
|
const config = await import("./open-next.config.mjs").then((m) => m.default);
|
|
const thisFunction = globalThis.fnName ? config.functions[globalThis.fnName] : config.default;
|
|
globalThis.serverId = generateUniqueId();
|
|
globalThis.openNextConfig = config;
|
|
await globalThis.__next_route_preloader("start");
|
|
globalThis.queue = await resolveQueue(thisFunction.override?.queue);
|
|
globalThis.incrementalCache = await resolveIncrementalCache(thisFunction.override?.incrementalCache);
|
|
globalThis.tagCache = await resolveTagCache(thisFunction.override?.tagCache);
|
|
if (config.middleware?.external !== true) {
|
|
globalThis.assetResolver = await resolveAssetResolver(globalThis.openNextConfig.middleware?.assetResolver);
|
|
}
|
|
globalThis.proxyExternalRequest = await resolveProxyRequest(thisFunction.override?.proxyExternalRequest);
|
|
globalThis.cdnInvalidationHandler = await resolveCdnInvalidation(thisFunction.override?.cdnInvalidation);
|
|
const converter2 = await resolveConverter(thisFunction.override?.converter);
|
|
const { wrapper, name } = await resolveWrapper(thisFunction.override?.wrapper);
|
|
debug("Using wrapper", name);
|
|
return wrapper(openNextHandler, converter2);
|
|
}
|
|
|
|
// node_modules/@opennextjs/aws/dist/adapters/server-adapter.js
|
|
setNodeEnv();
|
|
setBuildIdEnv();
|
|
setNextjsServerWorkingDirectory();
|
|
globalThis.internalFetch = fetch;
|
|
var handler2 = await createMainHandler();
|
|
function setNextjsServerWorkingDirectory() {
|
|
process.chdir(__dirname);
|
|
}
|
|
function setBuildIdEnv() {
|
|
process.env.NEXT_BUILD_ID = BuildId;
|
|
}
|
|
export {
|
|
handler2 as handler
|
|
};
|