chore: update .gitignore and remove build artifacts
- Enhanced .gitignore with Next.js 15, Cloudflare, and modern tooling patterns - Added comprehensive coverage for .open-next/ and .wrangler/ build directories - Removed accidentally committed build artifacts from version control - Added patterns for Vitest, Supabase, Tanstack Query, and other dependencies
5
.gitignore
vendored
@ -94,13 +94,16 @@ backups/
|
|||||||
|
|
||||||
# wrangler/cloudflare local state (do not commit)
|
# wrangler/cloudflare local state (do not commit)
|
||||||
.wrangler/
|
.wrangler/
|
||||||
|
.wrangler/**
|
||||||
.dev.vars
|
.dev.vars
|
||||||
.mf/
|
.mf/
|
||||||
|
|
||||||
# opennext build files
|
# opennext build files (NEVER commit these - they are build artifacts)
|
||||||
.open-next/
|
.open-next/
|
||||||
|
.open-next/**
|
||||||
.open next/
|
.open next/
|
||||||
.vercel/output/
|
.vercel/output/
|
||||||
|
.vercel/output/**
|
||||||
|
|
||||||
# Cache directories
|
# Cache directories
|
||||||
.cache/
|
.cache/
|
||||||
|
|||||||
@ -1,530 +0,0 @@
|
|||||||
globalThis.disableIncrementalCache = false;globalThis.disableDynamoDBCache = false;globalThis.isNextAfter15 = false;globalThis.openNextDebug = false;globalThis.openNextVersion = "3.7.6";
|
|
||||||
var __defProp = Object.defineProperty;
|
|
||||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
||||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
||||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
||||||
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/adapters/cache.js
|
|
||||||
var cache_exports = {};
|
|
||||||
__export(cache_exports, {
|
|
||||||
SOFT_TAG_PREFIX: () => SOFT_TAG_PREFIX,
|
|
||||||
default: () => Cache
|
|
||||||
});
|
|
||||||
module.exports = __toCommonJS(cache_exports);
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/utils/error.js
|
|
||||||
function isOpenNextError(e) {
|
|
||||||
try {
|
|
||||||
return "__openNextInternal" in e;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/adapters/logger.js
|
|
||||||
function debug(...args) {
|
|
||||||
if (globalThis.openNextDebug) {
|
|
||||||
console.log(...args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function warn(...args) {
|
|
||||||
console.warn(...args);
|
|
||||||
}
|
|
||||||
var DOWNPLAYED_ERROR_LOGS = [
|
|
||||||
{
|
|
||||||
clientName: "S3Client",
|
|
||||||
commandName: "GetObjectCommand",
|
|
||||||
errorName: "NoSuchKey"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
var 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));
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/utils/cache.js
|
|
||||||
async function hasBeenRevalidated(key, tags, cacheEntry) {
|
|
||||||
if (globalThis.openNextConfig.dangerous?.disableTagCache) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const value = cacheEntry.value;
|
|
||||||
if (!value) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if ("type" in cacheEntry && cacheEntry.type === "page") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const lastModified = cacheEntry.lastModified ?? Date.now();
|
|
||||||
if (globalThis.tagCache.mode === "nextMode") {
|
|
||||||
return await globalThis.tagCache.hasBeenRevalidated(tags, lastModified);
|
|
||||||
}
|
|
||||||
const _lastModified = await globalThis.tagCache.getLastModified(key, lastModified);
|
|
||||||
return _lastModified === -1;
|
|
||||||
}
|
|
||||||
function getTagsFromValue(value) {
|
|
||||||
if (!value) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return value.meta?.headers?.["x-next-cache-tags"]?.split(",") ?? [];
|
|
||||||
} catch (e) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function getTagKey(tag) {
|
|
||||||
if (typeof tag === "string") {
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
return JSON.stringify({
|
|
||||||
tag: tag.tag,
|
|
||||||
path: tag.path
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async function writeTags(tags) {
|
|
||||||
const store = globalThis.__openNextAls.getStore();
|
|
||||||
debug("Writing tags", tags, store);
|
|
||||||
if (!store || globalThis.openNextConfig.dangerous?.disableTagCache) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const tagsToWrite = tags.filter((t) => {
|
|
||||||
const tagKey = getTagKey(t);
|
|
||||||
const shouldWrite = !store.writtenTags.has(tagKey);
|
|
||||||
if (shouldWrite) {
|
|
||||||
store.writtenTags.add(tagKey);
|
|
||||||
}
|
|
||||||
return shouldWrite;
|
|
||||||
});
|
|
||||||
if (tagsToWrite.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await globalThis.tagCache.writeTags(tagsToWrite);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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/adapters/cache.js
|
|
||||||
var SOFT_TAG_PREFIX = "_N_T_/";
|
|
||||||
function isFetchCache(options) {
|
|
||||||
if (typeof options === "boolean") {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
if (typeof options === "object") {
|
|
||||||
return options.kindHint === "fetch" || options.fetchCache || options.kind === "FETCH";
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var Cache = class {
|
|
||||||
async get(key, options) {
|
|
||||||
if (globalThis.openNextConfig.dangerous?.disableIncrementalCache) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const softTags = typeof options === "object" ? options.softTags : [];
|
|
||||||
const tags = typeof options === "object" ? options.tags : [];
|
|
||||||
return isFetchCache(options) ? this.getFetchCache(key, softTags, tags) : this.getIncrementalCache(key);
|
|
||||||
}
|
|
||||||
async getFetchCache(key, softTags, tags) {
|
|
||||||
debug("get fetch cache", { key, softTags, tags });
|
|
||||||
try {
|
|
||||||
const cachedEntry = await globalThis.incrementalCache.get(key, "fetch");
|
|
||||||
if (cachedEntry?.value === void 0)
|
|
||||||
return null;
|
|
||||||
const _tags = [...tags ?? [], ...softTags ?? []];
|
|
||||||
const _lastModified = cachedEntry.lastModified ?? Date.now();
|
|
||||||
const _hasBeenRevalidated = cachedEntry.shouldBypassTagCache ? false : await hasBeenRevalidated(key, _tags, cachedEntry);
|
|
||||||
if (_hasBeenRevalidated)
|
|
||||||
return null;
|
|
||||||
if ((tags ?? []).length === 0) {
|
|
||||||
const path = softTags?.find((tag) => tag.startsWith(SOFT_TAG_PREFIX) && !tag.endsWith("layout") && !tag.endsWith("page"));
|
|
||||||
if (path) {
|
|
||||||
const hasPathBeenUpdated = cachedEntry.shouldBypassTagCache ? false : await hasBeenRevalidated(path.replace(SOFT_TAG_PREFIX, ""), [], cachedEntry);
|
|
||||||
if (hasPathBeenUpdated) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
lastModified: _lastModified,
|
|
||||||
value: cachedEntry.value
|
|
||||||
};
|
|
||||||
} catch (e) {
|
|
||||||
debug("Failed to get fetch cache", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async getIncrementalCache(key) {
|
|
||||||
try {
|
|
||||||
const cachedEntry = await globalThis.incrementalCache.get(key, "cache");
|
|
||||||
if (!cachedEntry?.value) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const cacheData = cachedEntry.value;
|
|
||||||
const meta = cacheData.meta;
|
|
||||||
const tags = getTagsFromValue(cacheData);
|
|
||||||
const _lastModified = cachedEntry.lastModified ?? Date.now();
|
|
||||||
const _hasBeenRevalidated = cachedEntry.shouldBypassTagCache ? false : await hasBeenRevalidated(key, tags, cachedEntry);
|
|
||||||
if (_hasBeenRevalidated)
|
|
||||||
return null;
|
|
||||||
const store = globalThis.__openNextAls.getStore();
|
|
||||||
if (store) {
|
|
||||||
store.lastModified = _lastModified;
|
|
||||||
}
|
|
||||||
if (cacheData?.type === "route") {
|
|
||||||
return {
|
|
||||||
lastModified: _lastModified,
|
|
||||||
value: {
|
|
||||||
kind: globalThis.isNextAfter15 ? "APP_ROUTE" : "ROUTE",
|
|
||||||
body: Buffer.from(cacheData.body ?? Buffer.alloc(0), isBinaryContentType(String(meta?.headers?.["content-type"])) ? "base64" : "utf8"),
|
|
||||||
status: meta?.status,
|
|
||||||
headers: meta?.headers
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (cacheData?.type === "page" || cacheData?.type === "app") {
|
|
||||||
if (globalThis.isNextAfter15 && cacheData?.type === "app") {
|
|
||||||
return {
|
|
||||||
lastModified: _lastModified,
|
|
||||||
value: {
|
|
||||||
kind: "APP_PAGE",
|
|
||||||
html: cacheData.html,
|
|
||||||
rscData: Buffer.from(cacheData.rsc),
|
|
||||||
status: meta?.status,
|
|
||||||
headers: meta?.headers,
|
|
||||||
postponed: meta?.postponed
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
lastModified: _lastModified,
|
|
||||||
value: {
|
|
||||||
kind: globalThis.isNextAfter15 ? "PAGES" : "PAGE",
|
|
||||||
html: cacheData.html,
|
|
||||||
pageData: cacheData.type === "page" ? cacheData.json : cacheData.rsc,
|
|
||||||
status: meta?.status,
|
|
||||||
headers: meta?.headers
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (cacheData?.type === "redirect") {
|
|
||||||
return {
|
|
||||||
lastModified: _lastModified,
|
|
||||||
value: {
|
|
||||||
kind: "REDIRECT",
|
|
||||||
props: cacheData.props
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
warn("Unknown cache type", cacheData);
|
|
||||||
return null;
|
|
||||||
} catch (e) {
|
|
||||||
debug("Failed to get body cache", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async set(key, data, ctx) {
|
|
||||||
if (globalThis.openNextConfig.dangerous?.disableIncrementalCache) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const detachedPromise = globalThis.__openNextAls.getStore()?.pendingPromiseRunner.withResolvers();
|
|
||||||
try {
|
|
||||||
if (data === null || data === void 0) {
|
|
||||||
await globalThis.incrementalCache.delete(key);
|
|
||||||
} else {
|
|
||||||
const revalidate = this.extractRevalidateForSet(ctx);
|
|
||||||
switch (data.kind) {
|
|
||||||
case "ROUTE":
|
|
||||||
case "APP_ROUTE": {
|
|
||||||
const { body, status, headers } = data;
|
|
||||||
await globalThis.incrementalCache.set(key, {
|
|
||||||
type: "route",
|
|
||||||
body: body.toString(isBinaryContentType(String(headers["content-type"])) ? "base64" : "utf8"),
|
|
||||||
meta: {
|
|
||||||
status,
|
|
||||||
headers
|
|
||||||
},
|
|
||||||
revalidate
|
|
||||||
}, "cache");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "PAGE":
|
|
||||||
case "PAGES": {
|
|
||||||
const { html, pageData, status, headers } = data;
|
|
||||||
const isAppPath = typeof pageData === "string";
|
|
||||||
if (isAppPath) {
|
|
||||||
await globalThis.incrementalCache.set(key, {
|
|
||||||
type: "app",
|
|
||||||
html,
|
|
||||||
rsc: pageData,
|
|
||||||
meta: {
|
|
||||||
status,
|
|
||||||
headers
|
|
||||||
},
|
|
||||||
revalidate
|
|
||||||
}, "cache");
|
|
||||||
} else {
|
|
||||||
await globalThis.incrementalCache.set(key, {
|
|
||||||
type: "page",
|
|
||||||
html,
|
|
||||||
json: pageData,
|
|
||||||
revalidate
|
|
||||||
}, "cache");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "APP_PAGE": {
|
|
||||||
const { html, rscData, headers, status } = data;
|
|
||||||
await globalThis.incrementalCache.set(key, {
|
|
||||||
type: "app",
|
|
||||||
html,
|
|
||||||
rsc: rscData.toString("utf8"),
|
|
||||||
meta: {
|
|
||||||
status,
|
|
||||||
headers
|
|
||||||
},
|
|
||||||
revalidate
|
|
||||||
}, "cache");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "FETCH":
|
|
||||||
await globalThis.incrementalCache.set(key, data, "fetch");
|
|
||||||
break;
|
|
||||||
case "REDIRECT":
|
|
||||||
await globalThis.incrementalCache.set(key, {
|
|
||||||
type: "redirect",
|
|
||||||
props: data.props,
|
|
||||||
revalidate
|
|
||||||
}, "cache");
|
|
||||||
break;
|
|
||||||
case "IMAGE":
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await this.updateTagsOnSet(key, data, ctx);
|
|
||||||
debug("Finished setting cache");
|
|
||||||
} catch (e) {
|
|
||||||
error("Failed to set cache", e);
|
|
||||||
} finally {
|
|
||||||
detachedPromise?.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async revalidateTag(tags) {
|
|
||||||
const config = globalThis.openNextConfig.dangerous;
|
|
||||||
if (config?.disableTagCache || config?.disableIncrementalCache) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const _tags = Array.isArray(tags) ? tags : [tags];
|
|
||||||
if (_tags.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (globalThis.tagCache.mode === "nextMode") {
|
|
||||||
const paths = await globalThis.tagCache.getPathsByTags?.(_tags) ?? [];
|
|
||||||
await writeTags(_tags);
|
|
||||||
if (paths.length > 0) {
|
|
||||||
await globalThis.cdnInvalidationHandler.invalidatePaths(paths.map((path) => ({
|
|
||||||
initialPath: path,
|
|
||||||
rawPath: path,
|
|
||||||
resolvedRoutes: [
|
|
||||||
{
|
|
||||||
route: path,
|
|
||||||
// TODO: ideally here we should check if it's an app router page or route
|
|
||||||
type: "app"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (const tag of _tags) {
|
|
||||||
debug("revalidateTag", tag);
|
|
||||||
const paths = await globalThis.tagCache.getByTag(tag);
|
|
||||||
debug("Items", paths);
|
|
||||||
const toInsert = paths.map((path) => ({
|
|
||||||
path,
|
|
||||||
tag
|
|
||||||
}));
|
|
||||||
if (tag.startsWith(SOFT_TAG_PREFIX)) {
|
|
||||||
for (const path of paths) {
|
|
||||||
const _tags2 = await globalThis.tagCache.getByPath(path);
|
|
||||||
const hardTags = _tags2.filter((t) => !t.startsWith(SOFT_TAG_PREFIX));
|
|
||||||
for (const hardTag of hardTags) {
|
|
||||||
const _paths = await globalThis.tagCache.getByTag(hardTag);
|
|
||||||
debug({ hardTag, _paths });
|
|
||||||
toInsert.push(..._paths.map((path2) => ({
|
|
||||||
path: path2,
|
|
||||||
tag: hardTag
|
|
||||||
})));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await writeTags(toInsert);
|
|
||||||
const uniquePaths = Array.from(new Set(toInsert.filter((t) => t.tag.startsWith(SOFT_TAG_PREFIX)).map((t) => `/${t.path}`)));
|
|
||||||
if (uniquePaths.length > 0) {
|
|
||||||
await globalThis.cdnInvalidationHandler.invalidatePaths(uniquePaths.map((path) => ({
|
|
||||||
initialPath: path,
|
|
||||||
rawPath: path,
|
|
||||||
resolvedRoutes: [
|
|
||||||
{
|
|
||||||
route: path,
|
|
||||||
// TODO: ideally here we should check if it's an app router page or route
|
|
||||||
type: "app"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
error("Failed to revalidate tag", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// TODO: We should delete/update tags in this method
|
|
||||||
// This will require an update to the tag cache interface
|
|
||||||
async updateTagsOnSet(key, data, ctx) {
|
|
||||||
if (globalThis.openNextConfig.dangerous?.disableTagCache || globalThis.tagCache.mode === "nextMode" || // Here it means it's a delete
|
|
||||||
!data) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const derivedTags = data?.kind === "FETCH" ? (
|
|
||||||
//@ts-expect-error - On older versions of next, ctx was a number, but for these cases we use data?.data?.tags
|
|
||||||
ctx?.tags ?? data?.data?.tags ?? []
|
|
||||||
) : data?.kind === "PAGE" ? data.headers?.["x-next-cache-tags"]?.split(",") ?? [] : [];
|
|
||||||
debug("derivedTags", derivedTags);
|
|
||||||
const storedTags = await globalThis.tagCache.getByPath(key);
|
|
||||||
const tagsToWrite = derivedTags.filter((tag) => !storedTags.includes(tag));
|
|
||||||
if (tagsToWrite.length > 0) {
|
|
||||||
await writeTags(tagsToWrite.map((tag) => ({
|
|
||||||
path: key,
|
|
||||||
tag,
|
|
||||||
// In case the tags are not there we just need to create them
|
|
||||||
// but we don't want them to return from `getLastModified` as they are not stale
|
|
||||||
revalidatedAt: 1
|
|
||||||
})));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
extractRevalidateForSet(ctx) {
|
|
||||||
if (ctx === void 0) {
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
if (typeof ctx === "number" || ctx === false) {
|
|
||||||
return ctx;
|
|
||||||
}
|
|
||||||
if ("revalidate" in ctx) {
|
|
||||||
return ctx.revalidate;
|
|
||||||
}
|
|
||||||
if ("cacheControl" in ctx) {
|
|
||||||
return ctx.cacheControl?.revalidate;
|
|
||||||
}
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// Annotate the CommonJS export names for ESM import in node:
|
|
||||||
0 && (module.exports = {
|
|
||||||
SOFT_TAG_PREFIX
|
|
||||||
});
|
|
||||||
@ -1,178 +0,0 @@
|
|||||||
globalThis.disableIncrementalCache = false;globalThis.disableDynamoDBCache = false;globalThis.isNextAfter15 = false;globalThis.openNextDebug = false;globalThis.openNextVersion = "3.7.6";
|
|
||||||
var __defProp = Object.defineProperty;
|
|
||||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
||||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
||||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
||||||
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/adapters/composable-cache.js
|
|
||||||
var composable_cache_exports = {};
|
|
||||||
__export(composable_cache_exports, {
|
|
||||||
default: () => composable_cache_default
|
|
||||||
});
|
|
||||||
module.exports = __toCommonJS(composable_cache_exports);
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/adapters/logger.js
|
|
||||||
function debug(...args) {
|
|
||||||
if (globalThis.openNextDebug) {
|
|
||||||
console.log(...args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/utils/cache.js
|
|
||||||
function getTagKey(tag) {
|
|
||||||
if (typeof tag === "string") {
|
|
||||||
return tag;
|
|
||||||
}
|
|
||||||
return JSON.stringify({
|
|
||||||
tag: tag.tag,
|
|
||||||
path: tag.path
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async function writeTags(tags) {
|
|
||||||
const store = globalThis.__openNextAls.getStore();
|
|
||||||
debug("Writing tags", tags, store);
|
|
||||||
if (!store || globalThis.openNextConfig.dangerous?.disableTagCache) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const tagsToWrite = tags.filter((t) => {
|
|
||||||
const tagKey = getTagKey(t);
|
|
||||||
const shouldWrite = !store.writtenTags.has(tagKey);
|
|
||||||
if (shouldWrite) {
|
|
||||||
store.writtenTags.add(tagKey);
|
|
||||||
}
|
|
||||||
return shouldWrite;
|
|
||||||
});
|
|
||||||
if (tagsToWrite.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await globalThis.tagCache.writeTags(tagsToWrite);
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/utils/stream.js
|
|
||||||
var import_node_stream = require("node:stream");
|
|
||||||
function fromReadableStream(stream, base64) {
|
|
||||||
const reader = stream.getReader();
|
|
||||||
const chunks = [];
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
function pump() {
|
|
||||||
reader.read().then(({ done, value }) => {
|
|
||||||
if (done) {
|
|
||||||
resolve(Buffer.concat(chunks).toString(base64 ? "base64" : "utf8"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
chunks.push(value);
|
|
||||||
pump();
|
|
||||||
}).catch(reject);
|
|
||||||
}
|
|
||||||
pump();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function toReadableStream(value, isBase64) {
|
|
||||||
return import_node_stream.Readable.toWeb(import_node_stream.Readable.from(Buffer.from(value, isBase64 ? "base64" : "utf8")));
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/adapters/composable-cache.js
|
|
||||||
var pendingWritePromiseMap = /* @__PURE__ */ new Map();
|
|
||||||
var composable_cache_default = {
|
|
||||||
async get(cacheKey) {
|
|
||||||
try {
|
|
||||||
if (pendingWritePromiseMap.has(cacheKey)) {
|
|
||||||
const stored = pendingWritePromiseMap.get(cacheKey);
|
|
||||||
if (stored) {
|
|
||||||
return stored.then((entry) => ({
|
|
||||||
...entry,
|
|
||||||
value: toReadableStream(entry.value)
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const result = await globalThis.incrementalCache.get(cacheKey, "composable");
|
|
||||||
if (!result?.value?.value) {
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
debug("composable cache result", result);
|
|
||||||
if (globalThis.tagCache.mode === "nextMode" && result.value.tags.length > 0) {
|
|
||||||
const hasBeenRevalidated = result.shouldBypassTagCache ? false : await globalThis.tagCache.hasBeenRevalidated(result.value.tags, result.lastModified);
|
|
||||||
if (hasBeenRevalidated)
|
|
||||||
return void 0;
|
|
||||||
} else if (globalThis.tagCache.mode === "original" || globalThis.tagCache.mode === void 0) {
|
|
||||||
const hasBeenRevalidated = result.shouldBypassTagCache ? false : await globalThis.tagCache.getLastModified(cacheKey, result.lastModified) === -1;
|
|
||||||
if (hasBeenRevalidated)
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
...result.value,
|
|
||||||
value: toReadableStream(result.value.value)
|
|
||||||
};
|
|
||||||
} catch (e) {
|
|
||||||
debug("Cannot read composable cache entry");
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async set(cacheKey, pendingEntry) {
|
|
||||||
const promiseEntry = pendingEntry.then(async (entry2) => ({
|
|
||||||
...entry2,
|
|
||||||
value: await fromReadableStream(entry2.value)
|
|
||||||
}));
|
|
||||||
pendingWritePromiseMap.set(cacheKey, promiseEntry);
|
|
||||||
const entry = await promiseEntry.finally(() => {
|
|
||||||
pendingWritePromiseMap.delete(cacheKey);
|
|
||||||
});
|
|
||||||
await globalThis.incrementalCache.set(cacheKey, {
|
|
||||||
...entry,
|
|
||||||
value: entry.value
|
|
||||||
}, "composable");
|
|
||||||
if (globalThis.tagCache.mode === "original") {
|
|
||||||
const storedTags = await globalThis.tagCache.getByPath(cacheKey);
|
|
||||||
const tagsToWrite = entry.tags.filter((tag) => !storedTags.includes(tag));
|
|
||||||
if (tagsToWrite.length > 0) {
|
|
||||||
await writeTags(tagsToWrite.map((tag) => ({ tag, path: cacheKey })));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async refreshTags() {
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
async getExpiration(...tags) {
|
|
||||||
if (globalThis.tagCache.mode === "nextMode") {
|
|
||||||
return globalThis.tagCache.getLastRevalidated(tags);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
},
|
|
||||||
async expireTags(...tags) {
|
|
||||||
if (globalThis.tagCache.mode === "nextMode") {
|
|
||||||
return writeTags(tags);
|
|
||||||
}
|
|
||||||
const tagCache = globalThis.tagCache;
|
|
||||||
const revalidatedAt = Date.now();
|
|
||||||
const pathsToUpdate = await Promise.all(tags.map(async (tag) => {
|
|
||||||
const paths = await tagCache.getByTag(tag);
|
|
||||||
return paths.map((path) => ({
|
|
||||||
path,
|
|
||||||
tag,
|
|
||||||
revalidatedAt
|
|
||||||
}));
|
|
||||||
}));
|
|
||||||
const setToWrite = /* @__PURE__ */ new Set();
|
|
||||||
for (const entry of pathsToUpdate.flat()) {
|
|
||||||
setToWrite.add(entry);
|
|
||||||
}
|
|
||||||
await writeTags(Array.from(setToWrite));
|
|
||||||
},
|
|
||||||
// This one is necessary for older versions of next
|
|
||||||
async receiveExpiredTags(...tags) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,169 +0,0 @@
|
|||||||
globalThis.openNextDebug = false;globalThis.openNextVersion = "3.7.6";
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/durable-objects/bucket-cache-purge.js
|
|
||||||
import { DurableObject } from "cloudflare:workers";
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/utils/error.js
|
|
||||||
function isOpenNextError(e) {
|
|
||||||
try {
|
|
||||||
return "__openNextInternal" in e;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/adapters/logger.js
|
|
||||||
function debug(...args) {
|
|
||||||
if (globalThis.openNextDebug) {
|
|
||||||
console.log(...args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function warn(...args) {
|
|
||||||
console.warn(...args);
|
|
||||||
}
|
|
||||||
var DOWNPLAYED_ERROR_LOGS = [
|
|
||||||
{
|
|
||||||
clientName: "S3Client",
|
|
||||||
commandName: "GetObjectCommand",
|
|
||||||
errorName: "NoSuchKey"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
var 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));
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/cloudflare-context.js
|
|
||||||
var cloudflareContextSymbol = Symbol.for("__cloudflare-context__");
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/overrides/internal.js
|
|
||||||
var debugCache = (name, ...args) => {
|
|
||||||
if (process.env.NEXT_PRIVATE_DEBUG_CACHE) {
|
|
||||||
console.log(`[${name}] `, ...args);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
async function internalPurgeCacheByTags(env, tags) {
|
|
||||||
if (!env.CACHE_PURGE_ZONE_ID || !env.CACHE_PURGE_API_TOKEN) {
|
|
||||||
error("No cache zone ID or API token provided. Skipping cache purge.");
|
|
||||||
return "missing-credentials";
|
|
||||||
}
|
|
||||||
let response;
|
|
||||||
try {
|
|
||||||
response = await fetch(`https://api.cloudflare.com/client/v4/zones/${env.CACHE_PURGE_ZONE_ID}/purge_cache`, {
|
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${env.CACHE_PURGE_API_TOKEN}`,
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
},
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({
|
|
||||||
tags
|
|
||||||
})
|
|
||||||
});
|
|
||||||
if (response.status === 429) {
|
|
||||||
error("purgeCacheByTags: Rate limit exceeded. Skipping cache purge.");
|
|
||||||
return "rate-limit-exceeded";
|
|
||||||
}
|
|
||||||
const bodyResponse = await response.json();
|
|
||||||
if (!bodyResponse.success) {
|
|
||||||
error("purgeCacheByTags: Cache purge failed. Errors:", bodyResponse.errors.map((error2) => `${error2.code}: ${error2.message}`));
|
|
||||||
return "purge-failed";
|
|
||||||
}
|
|
||||||
debugCache("purgeCacheByTags", "Cache purged successfully for tags:", tags);
|
|
||||||
return "purge-success";
|
|
||||||
} catch (error2) {
|
|
||||||
console.error("Error purging cache by tags:", error2);
|
|
||||||
return "purge-failed";
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
await response?.body?.cancel();
|
|
||||||
} catch {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/durable-objects/bucket-cache-purge.js
|
|
||||||
var DEFAULT_BUFFER_TIME_IN_SECONDS = 5;
|
|
||||||
var MAX_NUMBER_OF_TAGS_PER_PURGE = 100;
|
|
||||||
var BucketCachePurge = class extends DurableObject {
|
|
||||||
bufferTimeInSeconds;
|
|
||||||
constructor(state, env) {
|
|
||||||
super(state, env);
|
|
||||||
this.bufferTimeInSeconds = env.NEXT_CACHE_DO_PURGE_BUFFER_TIME_IN_SECONDS ? parseInt(env.NEXT_CACHE_DO_PURGE_BUFFER_TIME_IN_SECONDS) : DEFAULT_BUFFER_TIME_IN_SECONDS;
|
|
||||||
state.blockConcurrencyWhile(async () => {
|
|
||||||
state.storage.sql.exec(`
|
|
||||||
CREATE TABLE IF NOT EXISTS cache_purge (
|
|
||||||
tag TEXT NOT NULL
|
|
||||||
);
|
|
||||||
CREATE UNIQUE INDEX IF NOT EXISTS tag_index ON cache_purge (tag);
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async purgeCacheByTags(tags) {
|
|
||||||
for (const tag of tags) {
|
|
||||||
this.ctx.storage.sql.exec(`
|
|
||||||
INSERT OR REPLACE INTO cache_purge (tag)
|
|
||||||
VALUES (?)`, [tag]);
|
|
||||||
}
|
|
||||||
const nextAlarm = await this.ctx.storage.getAlarm();
|
|
||||||
if (!nextAlarm) {
|
|
||||||
this.ctx.storage.setAlarm(Date.now() + this.bufferTimeInSeconds * 1e3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async alarm() {
|
|
||||||
let tags = this.ctx.storage.sql.exec(`
|
|
||||||
SELECT * FROM cache_purge LIMIT ${MAX_NUMBER_OF_TAGS_PER_PURGE}
|
|
||||||
`).toArray();
|
|
||||||
do {
|
|
||||||
if (tags.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const result = await internalPurgeCacheByTags(this.env, tags.map((row) => row.tag));
|
|
||||||
if (result === "rate-limit-exceeded") {
|
|
||||||
throw new Error("Rate limit exceeded");
|
|
||||||
}
|
|
||||||
this.ctx.storage.sql.exec(`
|
|
||||||
DELETE FROM cache_purge
|
|
||||||
WHERE tag IN (${tags.map(() => "?").join(",")})
|
|
||||||
`, tags.map((row) => row.tag));
|
|
||||||
if (tags.length < MAX_NUMBER_OF_TAGS_PER_PURGE) {
|
|
||||||
tags = [];
|
|
||||||
} else {
|
|
||||||
tags = this.ctx.storage.sql.exec(`
|
|
||||||
SELECT * FROM cache_purge LIMIT ${MAX_NUMBER_OF_TAGS_PER_PURGE}
|
|
||||||
`).toArray();
|
|
||||||
}
|
|
||||||
} while (tags.length >= 0);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
BucketCachePurge
|
|
||||||
};
|
|
||||||
@ -1,283 +0,0 @@
|
|||||||
globalThis.openNextDebug = false;globalThis.openNextVersion = "3.7.6";
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/utils/error.js
|
|
||||||
var IgnorableError = class extends Error {
|
|
||||||
__openNextInternal = true;
|
|
||||||
canIgnore = true;
|
|
||||||
logLevel = 0;
|
|
||||||
constructor(message) {
|
|
||||||
super(message);
|
|
||||||
this.name = "IgnorableError";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var RecoverableError = class extends Error {
|
|
||||||
__openNextInternal = true;
|
|
||||||
canIgnore = true;
|
|
||||||
logLevel = 1;
|
|
||||||
constructor(message) {
|
|
||||||
super(message);
|
|
||||||
this.name = "RecoverableError";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var FatalError = class extends Error {
|
|
||||||
__openNextInternal = true;
|
|
||||||
canIgnore = false;
|
|
||||||
logLevel = 2;
|
|
||||||
constructor(message) {
|
|
||||||
super(message);
|
|
||||||
this.name = "FatalError";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function isOpenNextError(e) {
|
|
||||||
try {
|
|
||||||
return "__openNextInternal" in e;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/adapters/logger.js
|
|
||||||
function debug(...args) {
|
|
||||||
if (globalThis.openNextDebug) {
|
|
||||||
console.log(...args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function warn(...args) {
|
|
||||||
console.warn(...args);
|
|
||||||
}
|
|
||||||
var DOWNPLAYED_ERROR_LOGS = [
|
|
||||||
{
|
|
||||||
clientName: "S3Client",
|
|
||||||
commandName: "GetObjectCommand",
|
|
||||||
errorName: "NoSuchKey"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
var 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));
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/durable-objects/queue.js
|
|
||||||
import { DurableObject } from "cloudflare:workers";
|
|
||||||
var DEFAULT_MAX_REVALIDATION = 5;
|
|
||||||
var DEFAULT_REVALIDATION_TIMEOUT_MS = 1e4;
|
|
||||||
var DEFAULT_RETRY_INTERVAL_MS = 2e3;
|
|
||||||
var DEFAULT_MAX_RETRIES = 6;
|
|
||||||
var DOQueueHandler = class extends DurableObject {
|
|
||||||
// Ongoing revalidations are deduped by the deduplication id
|
|
||||||
// Since this is running in waitUntil, we expect the durable object state to persist this during the duration of the revalidation
|
|
||||||
// TODO: handle incremental cache with only eventual consistency (i.e. KV or R2/D1 with the optional cache layer on top)
|
|
||||||
ongoingRevalidations = /* @__PURE__ */ new Map();
|
|
||||||
sql;
|
|
||||||
routeInFailedState = /* @__PURE__ */ new Map();
|
|
||||||
service;
|
|
||||||
// Configurable params
|
|
||||||
maxRevalidations;
|
|
||||||
revalidationTimeout;
|
|
||||||
revalidationRetryInterval;
|
|
||||||
maxRetries;
|
|
||||||
disableSQLite;
|
|
||||||
constructor(ctx, env) {
|
|
||||||
super(ctx, env);
|
|
||||||
this.service = env.WORKER_SELF_REFERENCE;
|
|
||||||
if (!this.service)
|
|
||||||
throw new IgnorableError("No service binding for cache revalidation worker");
|
|
||||||
this.sql = ctx.storage.sql;
|
|
||||||
this.maxRevalidations = env.NEXT_CACHE_DO_QUEUE_MAX_REVALIDATION ? parseInt(env.NEXT_CACHE_DO_QUEUE_MAX_REVALIDATION) : DEFAULT_MAX_REVALIDATION;
|
|
||||||
this.revalidationTimeout = env.NEXT_CACHE_DO_QUEUE_REVALIDATION_TIMEOUT_MS ? parseInt(env.NEXT_CACHE_DO_QUEUE_REVALIDATION_TIMEOUT_MS) : DEFAULT_REVALIDATION_TIMEOUT_MS;
|
|
||||||
this.revalidationRetryInterval = env.NEXT_CACHE_DO_QUEUE_RETRY_INTERVAL_MS ? parseInt(env.NEXT_CACHE_DO_QUEUE_RETRY_INTERVAL_MS) : DEFAULT_RETRY_INTERVAL_MS;
|
|
||||||
this.maxRetries = env.NEXT_CACHE_DO_QUEUE_MAX_RETRIES ? parseInt(env.NEXT_CACHE_DO_QUEUE_MAX_RETRIES) : DEFAULT_MAX_RETRIES;
|
|
||||||
this.disableSQLite = env.NEXT_CACHE_DO_QUEUE_DISABLE_SQLITE === "true";
|
|
||||||
ctx.blockConcurrencyWhile(async () => {
|
|
||||||
debug(`Restoring the state of the durable object`);
|
|
||||||
await this.initState();
|
|
||||||
});
|
|
||||||
debug(`Durable object initialized`);
|
|
||||||
}
|
|
||||||
async revalidate(msg) {
|
|
||||||
if (this.ongoingRevalidations.size > 2 * this.maxRevalidations) {
|
|
||||||
warn(`Your durable object has 2 times the maximum number of revalidations (${this.maxRevalidations}) in progress. If this happens often, you should consider increasing the NEXT_CACHE_DO_QUEUE_MAX_REVALIDATION or the number of durable objects with the MAX_REVALIDATE_CONCURRENCY env var.`);
|
|
||||||
}
|
|
||||||
if (this.ongoingRevalidations.has(msg.MessageDeduplicationId))
|
|
||||||
return;
|
|
||||||
if (this.routeInFailedState.has(msg.MessageDeduplicationId))
|
|
||||||
return;
|
|
||||||
if (this.checkSyncTable(msg))
|
|
||||||
return;
|
|
||||||
if (this.ongoingRevalidations.size >= this.maxRevalidations) {
|
|
||||||
debug(`The maximum number of revalidations (${this.maxRevalidations}) is reached. Blocking until one of the revalidations finishes.`);
|
|
||||||
while (this.ongoingRevalidations.size >= this.maxRevalidations) {
|
|
||||||
const ongoingRevalidations = this.ongoingRevalidations.values();
|
|
||||||
debug(`Waiting for one of the revalidations to finish`);
|
|
||||||
await Promise.race(ongoingRevalidations);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const revalidationPromise = this.executeRevalidation(msg);
|
|
||||||
this.ongoingRevalidations.set(msg.MessageDeduplicationId, revalidationPromise);
|
|
||||||
this.ctx.waitUntil(revalidationPromise);
|
|
||||||
}
|
|
||||||
async executeRevalidation(msg) {
|
|
||||||
let response;
|
|
||||||
try {
|
|
||||||
debug(`Revalidating ${msg.MessageBody.host}${msg.MessageBody.url}`);
|
|
||||||
const { MessageBody: { host, url } } = msg;
|
|
||||||
const protocol = host.includes("localhost") ? "http" : "https";
|
|
||||||
response = await this.service.fetch(`${protocol}://${host}${url}`, {
|
|
||||||
method: "HEAD",
|
|
||||||
headers: {
|
|
||||||
// This is defined during build
|
|
||||||
"x-prerender-revalidate": "55cfb8bce98f34386492e3e3013b3def",
|
|
||||||
"x-isr": "1"
|
|
||||||
},
|
|
||||||
// This one is kind of problematic, it will always show the wall time of the revalidation to `this.revalidationTimeout`
|
|
||||||
signal: AbortSignal.timeout(this.revalidationTimeout)
|
|
||||||
});
|
|
||||||
if (response.status === 200 && response.headers.get("x-nextjs-cache") !== "REVALIDATED") {
|
|
||||||
this.routeInFailedState.delete(msg.MessageDeduplicationId);
|
|
||||||
throw new FatalError(`The revalidation for ${host}${url} cannot be done. This error should never happen.`);
|
|
||||||
} else if (response.status === 404) {
|
|
||||||
this.routeInFailedState.delete(msg.MessageDeduplicationId);
|
|
||||||
throw new IgnorableError(`The revalidation for ${host}${url} cannot be done because the page is not found. It's either expected or an error in user code itself`);
|
|
||||||
} else if (response.status === 500) {
|
|
||||||
await this.addToFailedState(msg);
|
|
||||||
throw new IgnorableError(`Something went wrong while revalidating ${host}${url}`);
|
|
||||||
} else if (response.status !== 200) {
|
|
||||||
await this.addToFailedState(msg);
|
|
||||||
throw new RecoverableError(`An unknown error occurred while revalidating ${host}${url}`);
|
|
||||||
}
|
|
||||||
if (!this.disableSQLite) {
|
|
||||||
this.sql.exec(
|
|
||||||
"INSERT OR REPLACE INTO sync (id, lastSuccess, buildId) VALUES (?, unixepoch(), ?)",
|
|
||||||
// We cannot use the deduplication id because it's not unique per route - every time a route is revalidated, the deduplication id is different.
|
|
||||||
`${host}${url}`,
|
|
||||||
"YY7sC6MVxKHFhQ9os9EJ-"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.routeInFailedState.delete(msg.MessageDeduplicationId);
|
|
||||||
} catch (e) {
|
|
||||||
if (!isOpenNextError(e)) {
|
|
||||||
await this.addToFailedState(msg);
|
|
||||||
}
|
|
||||||
error(e);
|
|
||||||
} finally {
|
|
||||||
this.ongoingRevalidations.delete(msg.MessageDeduplicationId);
|
|
||||||
try {
|
|
||||||
await response?.body?.cancel();
|
|
||||||
} catch {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async alarm() {
|
|
||||||
const currentDateTime = Date.now();
|
|
||||||
const nextEventToRetry = Array.from(this.routeInFailedState.values()).filter(({ nextAlarmMs }) => nextAlarmMs > currentDateTime).sort(({ nextAlarmMs: a }, { nextAlarmMs: b }) => a - b)[0];
|
|
||||||
const expiredEvents = Array.from(this.routeInFailedState.values()).filter(({ nextAlarmMs }) => nextAlarmMs <= currentDateTime);
|
|
||||||
const allEventsToRetry = nextEventToRetry ? [nextEventToRetry, ...expiredEvents] : expiredEvents;
|
|
||||||
for (const event of allEventsToRetry) {
|
|
||||||
debug(`Retrying revalidation for ${event.msg.MessageBody.host}${event.msg.MessageBody.url}`);
|
|
||||||
await this.executeRevalidation(event.msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async addToFailedState(msg) {
|
|
||||||
debug(`Adding ${msg.MessageBody.host}${msg.MessageBody.url} to the failed state`);
|
|
||||||
const existingFailedState = this.routeInFailedState.get(msg.MessageDeduplicationId);
|
|
||||||
let updatedFailedState;
|
|
||||||
if (existingFailedState) {
|
|
||||||
if (existingFailedState.retryCount >= this.maxRetries) {
|
|
||||||
error(`The revalidation for ${msg.MessageBody.host}${msg.MessageBody.url} has failed after ${this.maxRetries} retries. It will not be tried again, but subsequent ISR requests will retry.`);
|
|
||||||
this.routeInFailedState.delete(msg.MessageDeduplicationId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const nextAlarmMs = Date.now() + Math.pow(2, existingFailedState.retryCount + 1) * this.revalidationRetryInterval;
|
|
||||||
updatedFailedState = {
|
|
||||||
...existingFailedState,
|
|
||||||
retryCount: existingFailedState.retryCount + 1,
|
|
||||||
nextAlarmMs
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
updatedFailedState = {
|
|
||||||
msg,
|
|
||||||
retryCount: 1,
|
|
||||||
nextAlarmMs: Date.now() + 2e3
|
|
||||||
};
|
|
||||||
}
|
|
||||||
this.routeInFailedState.set(msg.MessageDeduplicationId, updatedFailedState);
|
|
||||||
if (!this.disableSQLite) {
|
|
||||||
this.sql.exec("INSERT OR REPLACE INTO failed_state (id, data, buildId) VALUES (?, ?, ?)", msg.MessageDeduplicationId, JSON.stringify(updatedFailedState), "YY7sC6MVxKHFhQ9os9EJ-");
|
|
||||||
}
|
|
||||||
await this.addAlarm();
|
|
||||||
}
|
|
||||||
async addAlarm() {
|
|
||||||
const existingAlarm = await this.ctx.storage.getAlarm({ allowConcurrency: false });
|
|
||||||
if (existingAlarm)
|
|
||||||
return;
|
|
||||||
if (this.routeInFailedState.size === 0)
|
|
||||||
return;
|
|
||||||
let nextAlarmToSetup = Math.min(...Array.from(this.routeInFailedState.values()).map(({ nextAlarmMs }) => nextAlarmMs));
|
|
||||||
if (nextAlarmToSetup < Date.now()) {
|
|
||||||
nextAlarmToSetup = Date.now() + this.revalidationRetryInterval;
|
|
||||||
}
|
|
||||||
await this.ctx.storage.setAlarm(nextAlarmToSetup);
|
|
||||||
}
|
|
||||||
// This function is used to restore the state of the durable object
|
|
||||||
// We don't restore the ongoing revalidations because we cannot know in which state they are
|
|
||||||
// We only restore the failed state and the alarm
|
|
||||||
async initState() {
|
|
||||||
if (this.disableSQLite)
|
|
||||||
return;
|
|
||||||
this.sql.exec("CREATE TABLE IF NOT EXISTS failed_state (id TEXT PRIMARY KEY, data TEXT, buildId TEXT)");
|
|
||||||
this.sql.exec("CREATE TABLE IF NOT EXISTS sync (id TEXT PRIMARY KEY, lastSuccess INTEGER, buildId TEXT)");
|
|
||||||
this.sql.exec("DELETE FROM failed_state WHERE buildId != ?", "YY7sC6MVxKHFhQ9os9EJ-");
|
|
||||||
this.sql.exec("DELETE FROM sync WHERE buildId != ?", "YY7sC6MVxKHFhQ9os9EJ-");
|
|
||||||
const failedStateCursor = this.sql.exec("SELECT * FROM failed_state");
|
|
||||||
for (const row of failedStateCursor) {
|
|
||||||
this.routeInFailedState.set(row.id, JSON.parse(row.data));
|
|
||||||
}
|
|
||||||
await this.addAlarm();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param msg
|
|
||||||
* @returns `true` if the route has been revalidated since the lastModified from the message, `false` otherwise
|
|
||||||
*/
|
|
||||||
checkSyncTable(msg) {
|
|
||||||
try {
|
|
||||||
if (this.disableSQLite)
|
|
||||||
return false;
|
|
||||||
return this.sql.exec("SELECT 1 FROM sync WHERE id = ? AND lastSuccess > ? LIMIT 1", `${msg.MessageBody.host}${msg.MessageBody.url}`, Math.round(msg.MessageBody.lastModified / 1e3)).toArray().length > 0;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
DOQueueHandler
|
|
||||||
};
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
globalThis.openNextDebug = false;globalThis.openNextVersion = "3.7.6";
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/durable-objects/sharded-tag-cache.js
|
|
||||||
import { DurableObject } from "cloudflare:workers";
|
|
||||||
var DOShardedTagCache = class extends DurableObject {
|
|
||||||
sql;
|
|
||||||
constructor(state, env) {
|
|
||||||
super(state, env);
|
|
||||||
this.sql = state.storage.sql;
|
|
||||||
state.blockConcurrencyWhile(async () => {
|
|
||||||
this.sql.exec(`CREATE TABLE IF NOT EXISTS revalidations (tag TEXT PRIMARY KEY, revalidatedAt INTEGER)`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async getLastRevalidated(tags) {
|
|
||||||
try {
|
|
||||||
const result = this.sql.exec(`SELECT MAX(revalidatedAt) AS time FROM revalidations WHERE tag IN (${tags.map(() => "?").join(", ")})`, ...tags).toArray();
|
|
||||||
if (result.length === 0)
|
|
||||||
return 0;
|
|
||||||
return result[0]?.time;
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async hasBeenRevalidated(tags, lastModified) {
|
|
||||||
return this.sql.exec(`SELECT 1 FROM revalidations WHERE tag IN (${tags.map(() => "?").join(", ")}) AND revalidatedAt > ? LIMIT 1`, ...tags, lastModified ?? Date.now()).toArray().length > 0;
|
|
||||||
}
|
|
||||||
async writeTags(tags, lastModified) {
|
|
||||||
tags.forEach((tag) => {
|
|
||||||
this.sql.exec(`INSERT OR REPLACE INTO revalidations (tag, revalidatedAt) VALUES (?, ?)`, tag, lastModified);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async getRevalidationTimes(tags) {
|
|
||||||
const result = this.sql.exec(`SELECT tag, revalidatedAt FROM revalidations WHERE tag IN (${tags.map(() => "?").join(", ")})`, ...tags).toArray();
|
|
||||||
return Object.fromEntries(result.map((row) => [row.tag, row.revalidatedAt]));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
DOShardedTagCache
|
|
||||||
};
|
|
||||||
@ -1,353 +0,0 @@
|
|||||||
var __defProp = Object.defineProperty;
|
|
||||||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
||||||
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/cloudflare-context.js
|
|
||||||
var cloudflareContextSymbol = Symbol.for("__cloudflare-context__");
|
|
||||||
function getCloudflareContext(options = { async: false }) {
|
|
||||||
return options.async ? getCloudflareContextAsync() : getCloudflareContextSync();
|
|
||||||
}
|
|
||||||
function getCloudflareContextFromGlobalScope() {
|
|
||||||
const global = globalThis;
|
|
||||||
return global[cloudflareContextSymbol];
|
|
||||||
}
|
|
||||||
function inSSG() {
|
|
||||||
const global = globalThis;
|
|
||||||
return global.__NEXT_DATA__?.nextExport === true;
|
|
||||||
}
|
|
||||||
function getCloudflareContextSync() {
|
|
||||||
const cloudflareContext = getCloudflareContextFromGlobalScope();
|
|
||||||
if (cloudflareContext) {
|
|
||||||
return cloudflareContext;
|
|
||||||
}
|
|
||||||
if (inSSG()) {
|
|
||||||
throw new Error(`
|
|
||||||
|
|
||||||
ERROR: \`getCloudflareContext\` has been called in sync mode in either a static route or at the top level of a non-static one, both cases are not allowed but can be solved by either:
|
|
||||||
- make sure that the call is not at the top level and that the route is not static
|
|
||||||
- call \`getCloudflareContext({async: true})\` to use the \`async\` mode
|
|
||||||
- avoid calling \`getCloudflareContext\` in the route
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
throw new Error(initOpenNextCloudflareForDevErrorMsg);
|
|
||||||
}
|
|
||||||
async function getCloudflareContextAsync() {
|
|
||||||
const cloudflareContext = getCloudflareContextFromGlobalScope();
|
|
||||||
if (cloudflareContext) {
|
|
||||||
return cloudflareContext;
|
|
||||||
}
|
|
||||||
const inNodejsRuntime = process.env.NEXT_RUNTIME === "nodejs";
|
|
||||||
if (inNodejsRuntime || inSSG()) {
|
|
||||||
const cloudflareContext2 = await getCloudflareContextFromWrangler();
|
|
||||||
addCloudflareContextToNodejsGlobal(cloudflareContext2);
|
|
||||||
return cloudflareContext2;
|
|
||||||
}
|
|
||||||
throw new Error(initOpenNextCloudflareForDevErrorMsg);
|
|
||||||
}
|
|
||||||
function addCloudflareContextToNodejsGlobal(cloudflareContext) {
|
|
||||||
const global = globalThis;
|
|
||||||
global[cloudflareContextSymbol] = cloudflareContext;
|
|
||||||
}
|
|
||||||
async function getCloudflareContextFromWrangler(options) {
|
|
||||||
const { getPlatformProxy } = await import(
|
|
||||||
/* webpackIgnore: true */
|
|
||||||
`${"__wrangler".replaceAll("_", "")}`
|
|
||||||
);
|
|
||||||
const environment = options?.environment ?? process.env.NEXT_DEV_WRANGLER_ENV;
|
|
||||||
const { env, cf, ctx } = await getPlatformProxy({
|
|
||||||
...options,
|
|
||||||
environment
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
env,
|
|
||||||
cf,
|
|
||||||
ctx
|
|
||||||
};
|
|
||||||
}
|
|
||||||
var initOpenNextCloudflareForDevErrorMsg = `
|
|
||||||
|
|
||||||
ERROR: \`getCloudflareContext\` has been called without having called \`initOpenNextCloudflareForDev\` from the Next.js config file.
|
|
||||||
You should update your Next.js config file as shown below:
|
|
||||||
|
|
||||||
\`\`\`
|
|
||||||
// next.config.mjs
|
|
||||||
|
|
||||||
import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";
|
|
||||||
|
|
||||||
initOpenNextCloudflareForDev();
|
|
||||||
|
|
||||||
const nextConfig = { ... };
|
|
||||||
export default nextConfig;
|
|
||||||
\`\`\`
|
|
||||||
|
|
||||||
`;
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/overrides/asset-resolver/index.js
|
|
||||||
var resolver = {
|
|
||||||
name: "cloudflare-asset-resolver",
|
|
||||||
async maybeGetAssetResult(event) {
|
|
||||||
const { ASSETS } = getCloudflareContext().env;
|
|
||||||
if (!ASSETS || !isUserWorkerFirst(globalThis.__ASSETS_RUN_WORKER_FIRST__, event.rawPath)) {
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
const { method, headers } = event;
|
|
||||||
if (method !== "GET" && method != "HEAD") {
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
const url = new URL(event.rawPath, "https://assets.local");
|
|
||||||
const response = await ASSETS.fetch(url, {
|
|
||||||
headers,
|
|
||||||
method
|
|
||||||
});
|
|
||||||
if (response.status === 404) {
|
|
||||||
await response.body?.cancel();
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
type: "core",
|
|
||||||
statusCode: response.status,
|
|
||||||
headers: Object.fromEntries(response.headers.entries()),
|
|
||||||
// Workers and Node types differ.
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
body: response.body || new ReadableStream(),
|
|
||||||
isBase64Encoded: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function isUserWorkerFirst(runWorkerFirst, pathname) {
|
|
||||||
if (!Array.isArray(runWorkerFirst)) {
|
|
||||||
return runWorkerFirst ?? false;
|
|
||||||
}
|
|
||||||
let hasPositiveMatch = false;
|
|
||||||
for (let rule of runWorkerFirst) {
|
|
||||||
let isPositiveRule = true;
|
|
||||||
if (rule.startsWith("!")) {
|
|
||||||
rule = rule.slice(1);
|
|
||||||
isPositiveRule = false;
|
|
||||||
} else if (hasPositiveMatch) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const match = new RegExp(`^${rule.replace(/([[\]().*+?^$|{}\\])/g, "\\$1").replace("\\*", ".*")}$`).test(pathname);
|
|
||||||
if (match) {
|
|
||||||
if (isPositiveRule) {
|
|
||||||
hasPositiveMatch = true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hasPositiveMatch;
|
|
||||||
}
|
|
||||||
var asset_resolver_default = resolver;
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/config.js
|
|
||||||
function defineCloudflareConfig(config = {}) {
|
|
||||||
const { incrementalCache, tagCache, queue, cachePurge, enableCacheInterception = false, routePreloadingBehavior = "none" } = config;
|
|
||||||
return {
|
|
||||||
default: {
|
|
||||||
override: {
|
|
||||||
wrapper: "cloudflare-node",
|
|
||||||
converter: "edge",
|
|
||||||
proxyExternalRequest: "fetch",
|
|
||||||
incrementalCache: resolveIncrementalCache(incrementalCache),
|
|
||||||
tagCache: resolveTagCache(tagCache),
|
|
||||||
queue: resolveQueue(queue),
|
|
||||||
cdnInvalidation: resolveCdnInvalidation(cachePurge)
|
|
||||||
},
|
|
||||||
routePreloadingBehavior
|
|
||||||
},
|
|
||||||
// node:crypto is used to compute cache keys
|
|
||||||
edgeExternals: ["node:crypto"],
|
|
||||||
cloudflare: {
|
|
||||||
useWorkerdCondition: true
|
|
||||||
},
|
|
||||||
dangerous: {
|
|
||||||
enableCacheInterception
|
|
||||||
},
|
|
||||||
middleware: {
|
|
||||||
external: true,
|
|
||||||
override: {
|
|
||||||
wrapper: "cloudflare-edge",
|
|
||||||
converter: "edge",
|
|
||||||
proxyExternalRequest: "fetch",
|
|
||||||
incrementalCache: resolveIncrementalCache(incrementalCache),
|
|
||||||
tagCache: resolveTagCache(tagCache),
|
|
||||||
queue: resolveQueue(queue)
|
|
||||||
},
|
|
||||||
assetResolver: () => asset_resolver_default
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function resolveIncrementalCache(value = "dummy") {
|
|
||||||
if (typeof value === "string") {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
return typeof value === "function" ? value : () => value;
|
|
||||||
}
|
|
||||||
function resolveTagCache(value = "dummy") {
|
|
||||||
if (typeof value === "string") {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
return typeof value === "function" ? value : () => value;
|
|
||||||
}
|
|
||||||
function resolveQueue(value = "dummy") {
|
|
||||||
if (typeof value === "string") {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
return typeof value === "function" ? value : () => value;
|
|
||||||
}
|
|
||||||
function resolveCdnInvalidation(value = "dummy") {
|
|
||||||
if (typeof value === "string") {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
return typeof value === "function" ? value : () => value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/utils/error.js
|
|
||||||
var IgnorableError = class extends Error {
|
|
||||||
constructor(message) {
|
|
||||||
super(message);
|
|
||||||
__publicField(this, "__openNextInternal", true);
|
|
||||||
__publicField(this, "canIgnore", true);
|
|
||||||
__publicField(this, "logLevel", 0);
|
|
||||||
this.name = "IgnorableError";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function isOpenNextError(e) {
|
|
||||||
try {
|
|
||||||
return "__openNextInternal" in e;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/adapters/logger.js
|
|
||||||
function debug(...args) {
|
|
||||||
if (globalThis.openNextDebug) {
|
|
||||||
console.log(...args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function warn(...args) {
|
|
||||||
console.warn(...args);
|
|
||||||
}
|
|
||||||
var DOWNPLAYED_ERROR_LOGS = [
|
|
||||||
{
|
|
||||||
clientName: "S3Client",
|
|
||||||
commandName: "GetObjectCommand",
|
|
||||||
errorName: "NoSuchKey"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
var 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));
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/overrides/internal.js
|
|
||||||
import { createHash } from "node:crypto";
|
|
||||||
var debugCache = (name, ...args) => {
|
|
||||||
if (process.env.NEXT_PRIVATE_DEBUG_CACHE) {
|
|
||||||
console.log(`[${name}] `, ...args);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var FALLBACK_BUILD_ID = "no-build-id";
|
|
||||||
var DEFAULT_PREFIX = "incremental-cache";
|
|
||||||
function computeCacheKey(key, options) {
|
|
||||||
const { cacheType = "cache", prefix = DEFAULT_PREFIX, buildId = FALLBACK_BUILD_ID } = options;
|
|
||||||
const hash = createHash("sha256").update(key).digest("hex");
|
|
||||||
return `${prefix}/${buildId}/${hash}.${cacheType}`.replace(/\/+/g, "/");
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/overrides/incremental-cache/r2-incremental-cache.js
|
|
||||||
var NAME = "cf-r2-incremental-cache";
|
|
||||||
var BINDING_NAME = "NEXT_INC_CACHE_R2_BUCKET";
|
|
||||||
var PREFIX_ENV_NAME = "NEXT_INC_CACHE_R2_PREFIX";
|
|
||||||
var R2IncrementalCache = class {
|
|
||||||
constructor() {
|
|
||||||
__publicField(this, "name", NAME);
|
|
||||||
}
|
|
||||||
async get(key, cacheType) {
|
|
||||||
const r2 = getCloudflareContext().env[BINDING_NAME];
|
|
||||||
if (!r2)
|
|
||||||
throw new IgnorableError("No R2 bucket");
|
|
||||||
debugCache(`Get ${key}`);
|
|
||||||
try {
|
|
||||||
const r2Object = await r2.get(this.getR2Key(key, cacheType));
|
|
||||||
if (!r2Object)
|
|
||||||
return null;
|
|
||||||
return {
|
|
||||||
value: await r2Object.json(),
|
|
||||||
lastModified: r2Object.uploaded.getTime()
|
|
||||||
};
|
|
||||||
} catch (e) {
|
|
||||||
error("Failed to get from cache", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async set(key, value, cacheType) {
|
|
||||||
const r2 = getCloudflareContext().env[BINDING_NAME];
|
|
||||||
if (!r2)
|
|
||||||
throw new IgnorableError("No R2 bucket");
|
|
||||||
debugCache(`Set ${key}`);
|
|
||||||
try {
|
|
||||||
await r2.put(this.getR2Key(key, cacheType), JSON.stringify(value));
|
|
||||||
} catch (e) {
|
|
||||||
error("Failed to set to cache", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async delete(key) {
|
|
||||||
const r2 = getCloudflareContext().env[BINDING_NAME];
|
|
||||||
if (!r2)
|
|
||||||
throw new IgnorableError("No R2 bucket");
|
|
||||||
debugCache(`Delete ${key}`);
|
|
||||||
try {
|
|
||||||
await r2.delete(this.getR2Key(key));
|
|
||||||
} catch (e) {
|
|
||||||
error("Failed to delete from cache", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getR2Key(key, cacheType) {
|
|
||||||
return computeCacheKey(key, {
|
|
||||||
prefix: getCloudflareContext().env[PREFIX_ENV_NAME],
|
|
||||||
buildId: process.env.NEXT_BUILD_ID,
|
|
||||||
cacheType
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var r2_incremental_cache_default = new R2IncrementalCache();
|
|
||||||
|
|
||||||
// open-next.config.ts
|
|
||||||
var open_next_config_default = defineCloudflareConfig({
|
|
||||||
incrementalCache: r2_incremental_cache_default
|
|
||||||
});
|
|
||||||
export {
|
|
||||||
open_next_config_default as default
|
|
||||||
};
|
|
||||||
@ -1,349 +0,0 @@
|
|||||||
import { createRequire as topLevelCreateRequire } from 'module';const require = topLevelCreateRequire(import.meta.url);import bannerUrl from 'url';const __dirname = bannerUrl.fileURLToPath(new URL('.', import.meta.url));
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/cloudflare-context.js
|
|
||||||
var cloudflareContextSymbol = Symbol.for("__cloudflare-context__");
|
|
||||||
function getCloudflareContext(options = { async: false }) {
|
|
||||||
return options.async ? getCloudflareContextAsync() : getCloudflareContextSync();
|
|
||||||
}
|
|
||||||
function getCloudflareContextFromGlobalScope() {
|
|
||||||
const global = globalThis;
|
|
||||||
return global[cloudflareContextSymbol];
|
|
||||||
}
|
|
||||||
function inSSG() {
|
|
||||||
const global = globalThis;
|
|
||||||
return global.__NEXT_DATA__?.nextExport === true;
|
|
||||||
}
|
|
||||||
function getCloudflareContextSync() {
|
|
||||||
const cloudflareContext = getCloudflareContextFromGlobalScope();
|
|
||||||
if (cloudflareContext) {
|
|
||||||
return cloudflareContext;
|
|
||||||
}
|
|
||||||
if (inSSG()) {
|
|
||||||
throw new Error(`
|
|
||||||
|
|
||||||
ERROR: \`getCloudflareContext\` has been called in sync mode in either a static route or at the top level of a non-static one, both cases are not allowed but can be solved by either:
|
|
||||||
- make sure that the call is not at the top level and that the route is not static
|
|
||||||
- call \`getCloudflareContext({async: true})\` to use the \`async\` mode
|
|
||||||
- avoid calling \`getCloudflareContext\` in the route
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
throw new Error(initOpenNextCloudflareForDevErrorMsg);
|
|
||||||
}
|
|
||||||
async function getCloudflareContextAsync() {
|
|
||||||
const cloudflareContext = getCloudflareContextFromGlobalScope();
|
|
||||||
if (cloudflareContext) {
|
|
||||||
return cloudflareContext;
|
|
||||||
}
|
|
||||||
const inNodejsRuntime = process.env.NEXT_RUNTIME === "nodejs";
|
|
||||||
if (inNodejsRuntime || inSSG()) {
|
|
||||||
const cloudflareContext2 = await getCloudflareContextFromWrangler();
|
|
||||||
addCloudflareContextToNodejsGlobal(cloudflareContext2);
|
|
||||||
return cloudflareContext2;
|
|
||||||
}
|
|
||||||
throw new Error(initOpenNextCloudflareForDevErrorMsg);
|
|
||||||
}
|
|
||||||
function addCloudflareContextToNodejsGlobal(cloudflareContext) {
|
|
||||||
const global = globalThis;
|
|
||||||
global[cloudflareContextSymbol] = cloudflareContext;
|
|
||||||
}
|
|
||||||
async function getCloudflareContextFromWrangler(options) {
|
|
||||||
const { getPlatformProxy } = await import(
|
|
||||||
/* webpackIgnore: true */
|
|
||||||
`${"__wrangler".replaceAll("_", "")}`
|
|
||||||
);
|
|
||||||
const environment = options?.environment ?? process.env.NEXT_DEV_WRANGLER_ENV;
|
|
||||||
const { env, cf, ctx } = await getPlatformProxy({
|
|
||||||
...options,
|
|
||||||
environment
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
env,
|
|
||||||
cf,
|
|
||||||
ctx
|
|
||||||
};
|
|
||||||
}
|
|
||||||
var initOpenNextCloudflareForDevErrorMsg = `
|
|
||||||
|
|
||||||
ERROR: \`getCloudflareContext\` has been called without having called \`initOpenNextCloudflareForDev\` from the Next.js config file.
|
|
||||||
You should update your Next.js config file as shown below:
|
|
||||||
|
|
||||||
\`\`\`
|
|
||||||
// next.config.mjs
|
|
||||||
|
|
||||||
import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";
|
|
||||||
|
|
||||||
initOpenNextCloudflareForDev();
|
|
||||||
|
|
||||||
const nextConfig = { ... };
|
|
||||||
export default nextConfig;
|
|
||||||
\`\`\`
|
|
||||||
|
|
||||||
`;
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/overrides/asset-resolver/index.js
|
|
||||||
var resolver = {
|
|
||||||
name: "cloudflare-asset-resolver",
|
|
||||||
async maybeGetAssetResult(event) {
|
|
||||||
const { ASSETS } = getCloudflareContext().env;
|
|
||||||
if (!ASSETS || !isUserWorkerFirst(globalThis.__ASSETS_RUN_WORKER_FIRST__, event.rawPath)) {
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
const { method, headers } = event;
|
|
||||||
if (method !== "GET" && method != "HEAD") {
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
const url = new URL(event.rawPath, "https://assets.local");
|
|
||||||
const response = await ASSETS.fetch(url, {
|
|
||||||
headers,
|
|
||||||
method
|
|
||||||
});
|
|
||||||
if (response.status === 404) {
|
|
||||||
await response.body?.cancel();
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
type: "core",
|
|
||||||
statusCode: response.status,
|
|
||||||
headers: Object.fromEntries(response.headers.entries()),
|
|
||||||
// Workers and Node types differ.
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
body: response.body || new ReadableStream(),
|
|
||||||
isBase64Encoded: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function isUserWorkerFirst(runWorkerFirst, pathname) {
|
|
||||||
if (!Array.isArray(runWorkerFirst)) {
|
|
||||||
return runWorkerFirst ?? false;
|
|
||||||
}
|
|
||||||
let hasPositiveMatch = false;
|
|
||||||
for (let rule of runWorkerFirst) {
|
|
||||||
let isPositiveRule = true;
|
|
||||||
if (rule.startsWith("!")) {
|
|
||||||
rule = rule.slice(1);
|
|
||||||
isPositiveRule = false;
|
|
||||||
} else if (hasPositiveMatch) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const match = new RegExp(`^${rule.replace(/([[\]().*+?^$|{}\\])/g, "\\$1").replace("\\*", ".*")}$`).test(pathname);
|
|
||||||
if (match) {
|
|
||||||
if (isPositiveRule) {
|
|
||||||
hasPositiveMatch = true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hasPositiveMatch;
|
|
||||||
}
|
|
||||||
var asset_resolver_default = resolver;
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/config.js
|
|
||||||
function defineCloudflareConfig(config = {}) {
|
|
||||||
const { incrementalCache, tagCache, queue, cachePurge, enableCacheInterception = false, routePreloadingBehavior = "none" } = config;
|
|
||||||
return {
|
|
||||||
default: {
|
|
||||||
override: {
|
|
||||||
wrapper: "cloudflare-node",
|
|
||||||
converter: "edge",
|
|
||||||
proxyExternalRequest: "fetch",
|
|
||||||
incrementalCache: resolveIncrementalCache(incrementalCache),
|
|
||||||
tagCache: resolveTagCache(tagCache),
|
|
||||||
queue: resolveQueue(queue),
|
|
||||||
cdnInvalidation: resolveCdnInvalidation(cachePurge)
|
|
||||||
},
|
|
||||||
routePreloadingBehavior
|
|
||||||
},
|
|
||||||
// node:crypto is used to compute cache keys
|
|
||||||
edgeExternals: ["node:crypto"],
|
|
||||||
cloudflare: {
|
|
||||||
useWorkerdCondition: true
|
|
||||||
},
|
|
||||||
dangerous: {
|
|
||||||
enableCacheInterception
|
|
||||||
},
|
|
||||||
middleware: {
|
|
||||||
external: true,
|
|
||||||
override: {
|
|
||||||
wrapper: "cloudflare-edge",
|
|
||||||
converter: "edge",
|
|
||||||
proxyExternalRequest: "fetch",
|
|
||||||
incrementalCache: resolveIncrementalCache(incrementalCache),
|
|
||||||
tagCache: resolveTagCache(tagCache),
|
|
||||||
queue: resolveQueue(queue)
|
|
||||||
},
|
|
||||||
assetResolver: () => asset_resolver_default
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function resolveIncrementalCache(value = "dummy") {
|
|
||||||
if (typeof value === "string") {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
return typeof value === "function" ? value : () => value;
|
|
||||||
}
|
|
||||||
function resolveTagCache(value = "dummy") {
|
|
||||||
if (typeof value === "string") {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
return typeof value === "function" ? value : () => value;
|
|
||||||
}
|
|
||||||
function resolveQueue(value = "dummy") {
|
|
||||||
if (typeof value === "string") {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
return typeof value === "function" ? value : () => value;
|
|
||||||
}
|
|
||||||
function resolveCdnInvalidation(value = "dummy") {
|
|
||||||
if (typeof value === "string") {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
return typeof value === "function" ? value : () => value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/utils/error.js
|
|
||||||
var IgnorableError = class extends Error {
|
|
||||||
__openNextInternal = true;
|
|
||||||
canIgnore = true;
|
|
||||||
logLevel = 0;
|
|
||||||
constructor(message) {
|
|
||||||
super(message);
|
|
||||||
this.name = "IgnorableError";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function isOpenNextError(e) {
|
|
||||||
try {
|
|
||||||
return "__openNextInternal" in e;
|
|
||||||
} catch {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/aws/dist/adapters/logger.js
|
|
||||||
function debug(...args) {
|
|
||||||
if (globalThis.openNextDebug) {
|
|
||||||
console.log(...args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function warn(...args) {
|
|
||||||
console.warn(...args);
|
|
||||||
}
|
|
||||||
var DOWNPLAYED_ERROR_LOGS = [
|
|
||||||
{
|
|
||||||
clientName: "S3Client",
|
|
||||||
commandName: "GetObjectCommand",
|
|
||||||
errorName: "NoSuchKey"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
var 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));
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/overrides/internal.js
|
|
||||||
import { createHash } from "node:crypto";
|
|
||||||
var debugCache = (name, ...args) => {
|
|
||||||
if (process.env.NEXT_PRIVATE_DEBUG_CACHE) {
|
|
||||||
console.log(`[${name}] `, ...args);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var FALLBACK_BUILD_ID = "no-build-id";
|
|
||||||
var DEFAULT_PREFIX = "incremental-cache";
|
|
||||||
function computeCacheKey(key, options) {
|
|
||||||
const { cacheType = "cache", prefix = DEFAULT_PREFIX, buildId = FALLBACK_BUILD_ID } = options;
|
|
||||||
const hash = createHash("sha256").update(key).digest("hex");
|
|
||||||
return `${prefix}/${buildId}/${hash}.${cacheType}`.replace(/\/+/g, "/");
|
|
||||||
}
|
|
||||||
|
|
||||||
// node_modules/@opennextjs/cloudflare/dist/api/overrides/incremental-cache/r2-incremental-cache.js
|
|
||||||
var NAME = "cf-r2-incremental-cache";
|
|
||||||
var BINDING_NAME = "NEXT_INC_CACHE_R2_BUCKET";
|
|
||||||
var PREFIX_ENV_NAME = "NEXT_INC_CACHE_R2_PREFIX";
|
|
||||||
var R2IncrementalCache = class {
|
|
||||||
name = NAME;
|
|
||||||
async get(key, cacheType) {
|
|
||||||
const r2 = getCloudflareContext().env[BINDING_NAME];
|
|
||||||
if (!r2)
|
|
||||||
throw new IgnorableError("No R2 bucket");
|
|
||||||
debugCache(`Get ${key}`);
|
|
||||||
try {
|
|
||||||
const r2Object = await r2.get(this.getR2Key(key, cacheType));
|
|
||||||
if (!r2Object)
|
|
||||||
return null;
|
|
||||||
return {
|
|
||||||
value: await r2Object.json(),
|
|
||||||
lastModified: r2Object.uploaded.getTime()
|
|
||||||
};
|
|
||||||
} catch (e) {
|
|
||||||
error("Failed to get from cache", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async set(key, value, cacheType) {
|
|
||||||
const r2 = getCloudflareContext().env[BINDING_NAME];
|
|
||||||
if (!r2)
|
|
||||||
throw new IgnorableError("No R2 bucket");
|
|
||||||
debugCache(`Set ${key}`);
|
|
||||||
try {
|
|
||||||
await r2.put(this.getR2Key(key, cacheType), JSON.stringify(value));
|
|
||||||
} catch (e) {
|
|
||||||
error("Failed to set to cache", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async delete(key) {
|
|
||||||
const r2 = getCloudflareContext().env[BINDING_NAME];
|
|
||||||
if (!r2)
|
|
||||||
throw new IgnorableError("No R2 bucket");
|
|
||||||
debugCache(`Delete ${key}`);
|
|
||||||
try {
|
|
||||||
await r2.delete(this.getR2Key(key));
|
|
||||||
} catch (e) {
|
|
||||||
error("Failed to delete from cache", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getR2Key(key, cacheType) {
|
|
||||||
return computeCacheKey(key, {
|
|
||||||
prefix: getCloudflareContext().env[PREFIX_ENV_NAME],
|
|
||||||
buildId: process.env.NEXT_BUILD_ID,
|
|
||||||
cacheType
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var r2_incremental_cache_default = new R2IncrementalCache();
|
|
||||||
|
|
||||||
// open-next.config.ts
|
|
||||||
var open_next_config_default = defineCloudflareConfig({
|
|
||||||
incrementalCache: r2_incremental_cache_default
|
|
||||||
});
|
|
||||||
export {
|
|
||||||
open_next_config_default as default
|
|
||||||
};
|
|
||||||
@ -1 +0,0 @@
|
|||||||
YY7sC6MVxKHFhQ9os9EJ-
|
|
||||||
@ -1 +0,0 @@
|
|||||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8668],{46611:function(t,e,n){Promise.resolve().then(n.bind(n,12339))},12339:function(t,e,n){"use strict";n.d(e,{Tabs:function(){return i},TabsContent:function(){return c},TabsList:function(){return o},TabsTrigger:function(){return u}});var r=n(57437);n(2265);var s=n(200),a=n(94508);function i(t){let{className:e,...n}=t;return(0,r.jsx)(s.fC,{"data-slot":"tabs",className:(0,a.cn)("flex flex-col gap-2",e),...n})}function o(t){let{className:e,...n}=t;return(0,r.jsx)(s.aV,{"data-slot":"tabs-list",className:(0,a.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...n})}function u(t){let{className:e,...n}=t;return(0,r.jsx)(s.xz,{"data-slot":"tabs-trigger",className:(0,a.cn)("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function c(t){let{className:e,...n}=t;return(0,r.jsx)(s.VY,{"data-slot":"tabs-content",className:(0,a.cn)("flex-1 outline-none",e),...n})}},94508:function(t,e,n){"use strict";n.d(e,{cn:function(){return a}});var r=n(61994),s=n(53335);function a(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return(0,s.m6)((0,r.W)(e))}}},function(t){t.O(0,[6137,200,2971,2117,1744],function(){return t(t.s=46611)}),_N_E=t.O()}]);
|
|
||||||
@ -1 +0,0 @@
|
|||||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7601],{11603:function(e,n,t){Promise.resolve().then(t.bind(t,13490))},13490:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return c}});var r=t(57437),s=t(2265);function c(e){let{error:n,reset:t}=e;return(0,s.useEffect)(()=>{console.error(n)},[n]),(0,r.jsx)("div",{className:"min-h-[50vh] flex items-center justify-center p-8",children:(0,r.jsxs)("div",{className:"text-center space-y-3",children:[(0,r.jsx)("h2",{className:"text-xl font-semibold",children:"Something went wrong"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:(null==n?void 0:n.message)||"An unexpected error occurred."}),(0,r.jsx)("button",{onClick:()=>t(),className:"inline-flex items-center rounded-md border px-3 py-1.5 text-sm hover:bg-accent",children:"Try again"})]})})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=11603)}),_N_E=e.O()}]);
|
|
||||||
@ -1 +0,0 @@
|
|||||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9160],{16062:function(e,n,t){Promise.resolve().then(t.bind(t,85447))},85447:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return r}});var s=t(57437);function r(){return(0,s.jsx)("div",{className:"min-h-[50vh] flex items-center justify-center p-8",children:(0,s.jsxs)("div",{className:"text-center space-y-3",children:[(0,s.jsx)("h2",{className:"text-xl font-semibold",children:"404 - Page Not Found"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"The page you are looking for does not exist or has been moved."}),(0,s.jsx)("a",{href:"/",className:"inline-flex items-center rounded-md border px-3 py-1.5 text-sm hover:bg-accent",children:"Go home"})]})})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=16062)}),_N_E=e.O()}]);
|
|
||||||
@ -1 +0,0 @@
|
|||||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1744],{82914:function(e,n,t){Promise.resolve().then(t.t.bind(t,12846,23)),Promise.resolve().then(t.t.bind(t,19107,23)),Promise.resolve().then(t.t.bind(t,61060,23)),Promise.resolve().then(t.t.bind(t,4707,23)),Promise.resolve().then(t.t.bind(t,80,23)),Promise.resolve().then(t.t.bind(t,36423,23))}},function(e){var n=function(n){return e(e.s=n)};e.O(0,[2971,2117],function(){return n(54278),n(82914)}),_N_E=e.O()}]);
|
|
||||||
@ -1 +0,0 @@
|
|||||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2888],{41597:function(n,_,u){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return u(48141)}])}},function(n){var _=function(_){return n(n.s=_)};n.O(0,[9774,179],function(){return _(41597),_(37253)}),_N_E=n.O()}]);
|
|
||||||
@ -1 +0,0 @@
|
|||||||
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4820],{81981:function(n,_,u){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_error",function(){return u(18529)}])}},function(n){n.O(0,[2888,9774,179],function(){return n(n.s=81981)}),_N_E=n.O()}]);
|
|
||||||
@ -1 +0,0 @@
|
|||||||
!function(){"use strict";var e,t,n,r,o,u,i,c,f,a={},l={};function d(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={id:e,loaded:!1,exports:{}},r=!0;try{a[e].call(n.exports,n,n.exports,d),r=!1}finally{r&&delete l[e]}return n.loaded=!0,n.exports}d.m=a,e=[],d.O=function(t,n,r,o){if(n){o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[n,r,o];return}for(var i=1/0,u=0;u<e.length;u++){for(var n=e[u][0],r=e[u][1],o=e[u][2],c=!0,f=0;f<n.length;f++)i>=o&&Object.keys(d.O).every(function(e){return d.O[e](n[f])})?n.splice(f--,1):(c=!1,o<i&&(i=o));if(c){e.splice(u--,1);var a=r();void 0!==a&&(t=a)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);d.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(function(t){u[t]=function(){return e[t]}});return u.default=function(){return e},d.d(o,u),o},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return"static/chunks/"+e+".bcfc212dff336e3c.js"},d.miniCssF=function(e){},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",d.l=function(e,t,n,u){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var i,c,f=document.getElementsByTagName("script"),a=0;a<f.length;a++){var l=f[a];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+n){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,d.nc&&i.setAttribute("nonce",d.nc),i.setAttribute("data-webpack",o+n),i.src=d.tu(e)),r[e]=[t];var s=function(t,n){i.onerror=i.onload=null,clearTimeout(p);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=s.bind(null,i.onerror),i.onload=s.bind(null,i.onload),c&&document.head.appendChild(i)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},d.tt=function(){return void 0===u&&(u={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(u=trustedTypes.createPolicy("nextjs#bundler",u))),u},d.tu=function(e){return d.tt().createScriptURL(e)},d.p="/_next/",i={2272:0,3587:0,3773:0,1834:0},d.f.j=function(e,t){var n=d.o(i,e)?i[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(/^(1834|2272|3587|3773)$/.test(e))i[e]=0;else{var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=d.p+d.u(e),u=Error();d.l(o,function(t){if(d.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",u.name="ChunkLoadError",u.type=r,u.request=o,n[1](u)}},"chunk-"+e,e)}}},d.O.j=function(e){return 0===i[e]},c=function(e,t){var n,r,o=t[0],u=t[1],c=t[2],f=0;if(o.some(function(e){return 0!==i[e]})){for(n in u)d.o(u,n)&&(d.m[n]=u[n]);if(c)var a=c(d)}for(e&&e(t);f<o.length;f++)r=o[f],d.o(i,r)&&i[r]&&i[r][0](),i[r]=0;return d.O(a)},(f=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(c.bind(null,0)),f.push=c.bind(null,f.push.bind(f)),d.nc=void 0}();
|
|
||||||
@ -1 +0,0 @@
|
|||||||
@font-face{font-family:__Playfair_Display_0a80b4;font-style:normal;font-weight:400 900;font-display:swap;src:url(/_next/static/media/47f136985ef5b5cb-s.woff2) format("woff2");unicode-range:u+0301,u+0400-045f,u+0490-0491,u+04b0-04b1,u+2116}@font-face{font-family:__Playfair_Display_0a80b4;font-style:normal;font-weight:400 900;font-display:swap;src:url(/_next/static/media/4ead58c4dcc3f285-s.woff2) format("woff2");unicode-range:u+0102-0103,u+0110-0111,u+0128-0129,u+0168-0169,u+01a0-01a1,u+01af-01b0,u+0300-0301,u+0303-0304,u+0308-0309,u+0323,u+0329,u+1ea0-1ef9,u+20ab}@font-face{font-family:__Playfair_Display_0a80b4;font-style:normal;font-weight:400 900;font-display:swap;src:url(/_next/static/media/28a2004cf8372660-s.woff2) format("woff2");unicode-range:u+0100-02ba,u+02bd-02c5,u+02c7-02cc,u+02ce-02d7,u+02dd-02ff,u+0304,u+0308,u+0329,u+1d00-1dbf,u+1e00-1e9f,u+1ef2-1eff,u+2020,u+20a0-20ab,u+20ad-20c0,u+2113,u+2c60-2c7f,u+a720-a7ff}@font-face{font-family:__Playfair_Display_0a80b4;font-style:normal;font-weight:400 900;font-display:swap;src:url(/_next/static/media/eaead17c7dbfcd5d-s.p.woff2) format("woff2");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+0304,u+0308,u+0329,u+2000-206f,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}@font-face{font-family:__Playfair_Display_Fallback_0a80b4;src:local("Times New Roman");ascent-override:97.25%;descent-override:22.56%;line-gap-override:0.00%;size-adjust:111.26%}.__className_0a80b4{font-family:__Playfair_Display_0a80b4,__Playfair_Display_Fallback_0a80b4;font-style:normal}.__variable_0a80b4{--font-playfair:"__Playfair_Display_0a80b4","__Playfair_Display_Fallback_0a80b4"}@font-face{font-family:__Source_Sans_3_1fdbab;font-style:normal;font-weight:200 900;font-display:swap;src:url(/_next/static/media/88da59c891d37117-s.woff2) format("woff2");unicode-range:u+0460-052f,u+1c80-1c8a,u+20b4,u+2de0-2dff,u+a640-a69f,u+fe2e-fe2f}@font-face{font-family:__Source_Sans_3_1fdbab;font-style:normal;font-weight:200 900;font-display:swap;src:url(/_next/static/media/1e377d93cbdd6b44-s.woff2) format("woff2");unicode-range:u+0301,u+0400-045f,u+0490-0491,u+04b0-04b1,u+2116}@font-face{font-family:__Source_Sans_3_1fdbab;font-style:normal;font-weight:200 900;font-display:swap;src:url(/_next/static/media/36d711d427a06e51-s.woff2) format("woff2");unicode-range:u+1f??}@font-face{font-family:__Source_Sans_3_1fdbab;font-style:normal;font-weight:200 900;font-display:swap;src:url(/_next/static/media/f1f7cdf240180e28-s.woff2) format("woff2");unicode-range:u+0370-0377,u+037a-037f,u+0384-038a,u+038c,u+038e-03a1,u+03a3-03ff}@font-face{font-family:__Source_Sans_3_1fdbab;font-style:normal;font-weight:200 900;font-display:swap;src:url(/_next/static/media/55fbdf033607a0e1-s.woff2) format("woff2");unicode-range:u+0102-0103,u+0110-0111,u+0128-0129,u+0168-0169,u+01a0-01a1,u+01af-01b0,u+0300-0301,u+0303-0304,u+0308-0309,u+0323,u+0329,u+1ea0-1ef9,u+20ab}@font-face{font-family:__Source_Sans_3_1fdbab;font-style:normal;font-weight:200 900;font-display:swap;src:url(/_next/static/media/b6a6f0b43d027304-s.woff2) format("woff2");unicode-range:u+0100-02ba,u+02bd-02c5,u+02c7-02cc,u+02ce-02d7,u+02dd-02ff,u+0304,u+0308,u+0329,u+1d00-1dbf,u+1e00-1e9f,u+1ef2-1eff,u+2020,u+20a0-20ab,u+20ad-20c0,u+2113,u+2c60-2c7f,u+a720-a7ff}@font-face{font-family:__Source_Sans_3_1fdbab;font-style:normal;font-weight:200 900;font-display:swap;src:url(/_next/static/media/9cf9c6e84ed13b5e-s.p.woff2) format("woff2");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+0304,u+0308,u+0329,u+2000-206f,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}@font-face{font-family:__Source_Sans_3_Fallback_1fdbab;src:local("Arial");ascent-override:109.21%;descent-override:42.66%;line-gap-override:0.00%;size-adjust:93.76%}.__className_1fdbab{font-family:__Source_Sans_3_1fdbab,__Source_Sans_3_Fallback_1fdbab;font-style:normal}.__variable_1fdbab{--font-source-sans:"__Source_Sans_3_1fdbab","__Source_Sans_3_Fallback_1fdbab"}
|
|
||||||
|
Before Width: | Height: | Size: 660 KiB |
|
Before Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 402 KiB |
|
Before Width: | Height: | Size: 447 KiB |
|
Before Width: | Height: | Size: 148 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 585 KiB |
|
Before Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 107 KiB |
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 257 KiB |
|
Before Width: | Height: | Size: 189 KiB |
|
Before Width: | Height: | Size: 210 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 377 KiB |
|
Before Width: | Height: | Size: 162 KiB |
|
Before Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 165 KiB |
|
Before Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 228 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 632 KiB |
|
Before Width: | Height: | Size: 917 KiB |
|
Before Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 455 KiB |
|
Before Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 138 KiB |
|
Before Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 403 KiB |
|
Before Width: | Height: | Size: 162 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 226 KiB |
|
Before Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 148 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 178 KiB |
|
Before Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 166 KiB |
|
Before Width: | Height: | Size: 93 KiB |
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 166 KiB |