@edgeone/nuxt-pages 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +275 -0
- package/dist/build/content/server.js +18 -0
- package/dist/build/content/static.js +17 -0
- package/dist/build/functions/server.js +19 -0
- package/dist/build/plugin-context.js +18 -0
- package/dist/build/routes.js +18 -0
- package/dist/build/templates/nuxt-handler-backup.js +305 -0
- package/dist/build/templates/nuxt-handler-monorepo.tmpl-ipx_backup.js +511 -0
- package/dist/build/templates/nuxt-handler-monorepo.tmpl.js +243 -0
- package/dist/build/templates/nuxt-handler.tmpl.js +212 -0
- package/dist/esm-chunks/chunk-5YBUNNZ4.js +81 -0
- package/dist/esm-chunks/chunk-6BT4RYQJ.js +43 -0
- package/dist/esm-chunks/chunk-6YERJDAJ.js +208 -0
- package/dist/esm-chunks/chunk-GX4Z7KQX.js +15065 -0
- package/dist/esm-chunks/chunk-HBXUWFGE.js +19 -0
- package/dist/esm-chunks/chunk-HY3HNABZ.js +87 -0
- package/dist/esm-chunks/chunk-KGYBHZC3.js +1467 -0
- package/dist/esm-chunks/chunk-MMMRMLH2.js +132 -0
- package/dist/esm-chunks/chunk-NJ4SUJNF.js +5635 -0
- package/dist/esm-chunks/chunk-QG7JLDXY.js +127 -0
- package/dist/esm-chunks/chunk-RPSYO4VM.js +562 -0
- package/dist/esm-chunks/chunk-UOPC2N5A.js +69 -0
- package/dist/esm-chunks/chunk-V2LFVP3C.js +838 -0
- package/dist/index.js +61 -0
- package/dist/run/config.js +17 -0
- package/dist/run/constants.js +17 -0
- package/dist/run/handlers/cache.cjs +1410 -0
- package/dist/run/handlers/nuxt-cache.cjs +200 -0
- package/dist/run/handlers/nuxt-server.js +156 -0
- package/dist/run/handlers/request-context.cjs +148 -0
- package/dist/run/handlers/server.js +77 -0
- package/dist/run/handlers/tags-handler.cjs +177 -0
- package/dist/run/handlers/tracer.cjs +1004 -0
- package/dist/run/handlers/use-cache-handler.js +220 -0
- package/dist/run/handlers/wait-until.cjs +123 -0
- package/dist/run/headers.js +17 -0
- package/dist/run/revalidate.js +34 -0
- package/dist/run/storage/regional-blob-store.cjs +64 -0
- package/dist/run/storage/request-scoped-in-memory-cache.cjs +1582 -0
- package/dist/run/storage/storage.cjs +191 -0
- package/dist/shared/blob-types.cjs +37 -0
- package/dist/shared/blobkey.js +25 -0
- package/dist/shared/cache-types.cjs +33 -0
- package/dist/shared/nuxt-cache-types.cjs +18 -0
- package/dist/types/options.js +6 -0
- package/dist/utils.js +25 -0
- package/package.json +58 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
|
+
return createRequire(import.meta.url);
|
|
5
|
+
})();
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
getTracer
|
|
9
|
+
} from "../../esm-chunks/chunk-UOPC2N5A.js";
|
|
10
|
+
import "../../esm-chunks/chunk-V2LFVP3C.js";
|
|
11
|
+
import {
|
|
12
|
+
LRUCache,
|
|
13
|
+
getLogger,
|
|
14
|
+
getRequestContext
|
|
15
|
+
} from "../../esm-chunks/chunk-KGYBHZC3.js";
|
|
16
|
+
import "../../esm-chunks/chunk-6BT4RYQJ.js";
|
|
17
|
+
|
|
18
|
+
// src/run/handlers/use-cache-handler.ts
|
|
19
|
+
import { Buffer } from "node:buffer";
|
|
20
|
+
|
|
21
|
+
// package.json
|
|
22
|
+
var name = "@edgeone/nuxt-pages";
|
|
23
|
+
var version = "1.0.0";
|
|
24
|
+
|
|
25
|
+
// src/run/handlers/tags-handler.cts
|
|
26
|
+
var purgeCacheUserAgent = `${name}@${version}`;
|
|
27
|
+
function getCacheTagsFromTagOrTags(tagOrTags) {
|
|
28
|
+
return (Array.isArray(tagOrTags) ? tagOrTags : [tagOrTags]).flatMap((tag) => tag.split(/,|%2c/gi)).filter(Boolean);
|
|
29
|
+
}
|
|
30
|
+
async function purgeEdgeCache(tagOrTags) {
|
|
31
|
+
const tags = getCacheTagsFromTagOrTags(tagOrTags).map((tag) => {
|
|
32
|
+
return tag.replace(/^_N_T_/, "").replace(/\/page|\/layout$/, "");
|
|
33
|
+
});
|
|
34
|
+
if (tags.length === 0) {
|
|
35
|
+
return Promise.resolve();
|
|
36
|
+
}
|
|
37
|
+
getLogger().debug(`[NuxtRuntime] Purging CDN cache for: [${tags.join(", ")}]`);
|
|
38
|
+
const baseUrl = process.env.IS_MAINLAND === "true" ? "https://pages-api.cloud.tencent.com" : "https://pages-api.edgeone.ai";
|
|
39
|
+
const token = process.env.PURGE_TOKEN;
|
|
40
|
+
const requestBody = {
|
|
41
|
+
path: [...tags]
|
|
42
|
+
};
|
|
43
|
+
const res = await fetch(`${baseUrl}/eo/purge`, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: {
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
Authorization: `Bearer ${token}`
|
|
48
|
+
},
|
|
49
|
+
body: JSON.stringify(requestBody)
|
|
50
|
+
});
|
|
51
|
+
const data = await res.json();
|
|
52
|
+
if (data?.error) {
|
|
53
|
+
console.log(`Failed to purge CDN cache: ${data?.error.message}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function doRevalidateTagAndPurgeEdgeCache(tags) {
|
|
57
|
+
getLogger().withFields({ tags }).debug("doRevalidateTagAndPurgeEdgeCache");
|
|
58
|
+
if (tags.length === 0) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const tagManifest = {
|
|
62
|
+
revalidatedAt: Date.now()
|
|
63
|
+
};
|
|
64
|
+
await purgeEdgeCache(tags);
|
|
65
|
+
}
|
|
66
|
+
function markTagsAsStaleAndPurgeEdgeCache(tagOrTags) {
|
|
67
|
+
const tags = getCacheTagsFromTagOrTags(tagOrTags);
|
|
68
|
+
const revalidateTagPromise = doRevalidateTagAndPurgeEdgeCache(tags);
|
|
69
|
+
const requestContext = getRequestContext();
|
|
70
|
+
if (requestContext) {
|
|
71
|
+
requestContext.trackBackgroundWork(revalidateTagPromise);
|
|
72
|
+
}
|
|
73
|
+
return revalidateTagPromise;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// src/run/handlers/use-cache-handler.ts
|
|
77
|
+
var LRU_CACHE_GLOBAL_KEY = Symbol.for("nf-use-cache-handler-lru-cache");
|
|
78
|
+
var PENDING_SETS_GLOBAL_KEY = Symbol.for("nf-use-cache-handler-pending-sets");
|
|
79
|
+
var cacheHandlersSymbol = Symbol.for("@next/cache-handlers");
|
|
80
|
+
var extendedGlobalThis = globalThis;
|
|
81
|
+
function getLRUCache() {
|
|
82
|
+
if (extendedGlobalThis[LRU_CACHE_GLOBAL_KEY]) {
|
|
83
|
+
return extendedGlobalThis[LRU_CACHE_GLOBAL_KEY];
|
|
84
|
+
}
|
|
85
|
+
const lruCache = new LRUCache({
|
|
86
|
+
max: 1e3,
|
|
87
|
+
maxSize: 50 * 1024 * 1024,
|
|
88
|
+
// same as hardcoded default
|
|
89
|
+
sizeCalculation: (value) => value.size
|
|
90
|
+
});
|
|
91
|
+
extendedGlobalThis[LRU_CACHE_GLOBAL_KEY] = lruCache;
|
|
92
|
+
return lruCache;
|
|
93
|
+
}
|
|
94
|
+
function getPendingSets() {
|
|
95
|
+
if (extendedGlobalThis[PENDING_SETS_GLOBAL_KEY]) {
|
|
96
|
+
return extendedGlobalThis[PENDING_SETS_GLOBAL_KEY];
|
|
97
|
+
}
|
|
98
|
+
const pendingSets = /* @__PURE__ */ new Map();
|
|
99
|
+
extendedGlobalThis[PENDING_SETS_GLOBAL_KEY] = pendingSets;
|
|
100
|
+
return pendingSets;
|
|
101
|
+
}
|
|
102
|
+
var tmpResolvePendingBeforeCreatingAPromise = () => {
|
|
103
|
+
};
|
|
104
|
+
var EdgeoneDefaultUseCacheHandler = {
|
|
105
|
+
get(cacheKey) {
|
|
106
|
+
return getTracer().withActiveSpan(
|
|
107
|
+
"DefaultUseCacheHandler.get",
|
|
108
|
+
async (span) => {
|
|
109
|
+
getLogger().withFields({ cacheKey });
|
|
110
|
+
span.setAttributes({
|
|
111
|
+
cacheKey
|
|
112
|
+
});
|
|
113
|
+
const pendingPromise = getPendingSets().get(cacheKey);
|
|
114
|
+
if (pendingPromise) {
|
|
115
|
+
await pendingPromise;
|
|
116
|
+
}
|
|
117
|
+
const privateEntry = getLRUCache().get(cacheKey);
|
|
118
|
+
if (!privateEntry) {
|
|
119
|
+
getLogger().withFields({ cacheKey, status: "MISS" });
|
|
120
|
+
span.setAttributes({
|
|
121
|
+
cacheStatus: "miss"
|
|
122
|
+
});
|
|
123
|
+
return void 0;
|
|
124
|
+
}
|
|
125
|
+
const { entry } = privateEntry;
|
|
126
|
+
const ttl = (entry.timestamp + entry.revalidate * 1e3 - Date.now()) / 1e3;
|
|
127
|
+
if (ttl < 0) {
|
|
128
|
+
getLogger().withFields({ cacheKey, ttl, status: "STALE" });
|
|
129
|
+
span.setAttributes({
|
|
130
|
+
cacheStatus: "expired, discarded",
|
|
131
|
+
ttl
|
|
132
|
+
});
|
|
133
|
+
return void 0;
|
|
134
|
+
}
|
|
135
|
+
const [returnStream, newSaved] = entry.value.tee();
|
|
136
|
+
entry.value = newSaved;
|
|
137
|
+
getLogger().withFields({ cacheKey, ttl, status: "HIT" });
|
|
138
|
+
span.setAttributes({
|
|
139
|
+
cacheStatus: "hit",
|
|
140
|
+
ttl
|
|
141
|
+
});
|
|
142
|
+
return {
|
|
143
|
+
...entry,
|
|
144
|
+
value: returnStream
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
},
|
|
149
|
+
set(cacheKey, pendingEntry) {
|
|
150
|
+
return getTracer().withActiveSpan(
|
|
151
|
+
"DefaultUseCacheHandler.set",
|
|
152
|
+
async (span) => {
|
|
153
|
+
getLogger().withFields({ cacheKey });
|
|
154
|
+
span.setAttributes({
|
|
155
|
+
cacheKey
|
|
156
|
+
});
|
|
157
|
+
let resolvePending = tmpResolvePendingBeforeCreatingAPromise;
|
|
158
|
+
const pendingPromise = new Promise((resolve) => {
|
|
159
|
+
resolvePending = resolve;
|
|
160
|
+
});
|
|
161
|
+
const pendingSets = getPendingSets();
|
|
162
|
+
pendingSets.set(cacheKey, pendingPromise);
|
|
163
|
+
const entry = await pendingEntry;
|
|
164
|
+
span.setAttributes({
|
|
165
|
+
cacheKey
|
|
166
|
+
});
|
|
167
|
+
let size = 0;
|
|
168
|
+
try {
|
|
169
|
+
const [value, clonedValue] = entry.value.tee();
|
|
170
|
+
entry.value = value;
|
|
171
|
+
const reader = clonedValue.getReader();
|
|
172
|
+
for (let chunk; !(chunk = await reader.read()).done; ) {
|
|
173
|
+
size += Buffer.from(chunk.value).byteLength;
|
|
174
|
+
}
|
|
175
|
+
span.setAttributes({
|
|
176
|
+
tags: entry.tags,
|
|
177
|
+
timestamp: entry.timestamp,
|
|
178
|
+
revalidate: entry.revalidate,
|
|
179
|
+
expire: entry.expire
|
|
180
|
+
});
|
|
181
|
+
getLRUCache().set(cacheKey, {
|
|
182
|
+
entry,
|
|
183
|
+
size
|
|
184
|
+
});
|
|
185
|
+
} catch (error) {
|
|
186
|
+
getLogger().withError(error).error("[EdgeoneDefaultUseCacheHandler.set] error");
|
|
187
|
+
} finally {
|
|
188
|
+
resolvePending();
|
|
189
|
+
pendingSets.delete(cacheKey);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
},
|
|
194
|
+
async refreshTags() {
|
|
195
|
+
},
|
|
196
|
+
getExpiration: function(...tags) {
|
|
197
|
+
return Promise.resolve(0);
|
|
198
|
+
},
|
|
199
|
+
expireTags(...tags) {
|
|
200
|
+
return getTracer().withActiveSpan(
|
|
201
|
+
"DefaultUseCacheHandler.expireTags",
|
|
202
|
+
async (span) => {
|
|
203
|
+
getLogger().withFields({ tags });
|
|
204
|
+
span.setAttributes({
|
|
205
|
+
tags
|
|
206
|
+
});
|
|
207
|
+
await markTagsAsStaleAndPurgeEdgeCache(tags);
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
function configureUseCacheHandlers() {
|
|
213
|
+
extendedGlobalThis[cacheHandlersSymbol] = {
|
|
214
|
+
DefaultCache: EdgeoneDefaultUseCacheHandler
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
export {
|
|
218
|
+
EdgeoneDefaultUseCacheHandler,
|
|
219
|
+
configureUseCacheHandlers
|
|
220
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/run/handlers/wait-until.cts
|
|
21
|
+
var wait_until_exports = {};
|
|
22
|
+
__export(wait_until_exports, {
|
|
23
|
+
setupWaitUntil: () => setupWaitUntil
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(wait_until_exports);
|
|
26
|
+
|
|
27
|
+
// src/run/handlers/request-context.cts
|
|
28
|
+
var import_node_async_hooks = require("node:async_hooks");
|
|
29
|
+
|
|
30
|
+
// node_modules/@netlify/functions/dist/internal.js
|
|
31
|
+
var import_process = require("process");
|
|
32
|
+
var systemLogTag = "__nfSystemLog";
|
|
33
|
+
var serializeError = (error) => {
|
|
34
|
+
const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
|
|
35
|
+
return {
|
|
36
|
+
error: error.message,
|
|
37
|
+
error_cause: cause,
|
|
38
|
+
error_stack: error.stack
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
var SystemLogger = class _SystemLogger {
|
|
42
|
+
fields;
|
|
43
|
+
logLevel;
|
|
44
|
+
constructor(fields = {}, logLevel = 2) {
|
|
45
|
+
this.fields = fields;
|
|
46
|
+
this.logLevel = logLevel;
|
|
47
|
+
}
|
|
48
|
+
doLog(logger, message) {
|
|
49
|
+
if (import_process.env.NETLIFY_DEV && !import_process.env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
|
|
53
|
+
}
|
|
54
|
+
log(message) {
|
|
55
|
+
if (this.logLevel > 2) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.doLog(console.log, message);
|
|
59
|
+
}
|
|
60
|
+
debug(message) {
|
|
61
|
+
if (this.logLevel > 1) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.doLog(console.debug, message);
|
|
65
|
+
}
|
|
66
|
+
error(message) {
|
|
67
|
+
if (this.logLevel > 3) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this.doLog(console.error, message);
|
|
71
|
+
}
|
|
72
|
+
withLogLevel(level) {
|
|
73
|
+
return new _SystemLogger(this.fields, level);
|
|
74
|
+
}
|
|
75
|
+
withFields(fields) {
|
|
76
|
+
return new _SystemLogger(
|
|
77
|
+
{
|
|
78
|
+
...this.fields,
|
|
79
|
+
...fields
|
|
80
|
+
},
|
|
81
|
+
this.logLevel
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
withError(error) {
|
|
85
|
+
const fields = error instanceof Error ? serializeError(error) : { error };
|
|
86
|
+
return this.withFields(fields);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
var systemLogger = new SystemLogger();
|
|
90
|
+
|
|
91
|
+
// src/run/handlers/request-context.cts
|
|
92
|
+
var REQUEST_CONTEXT_GLOBAL_KEY = Symbol.for("nf-request-context-async-local-storage");
|
|
93
|
+
var REQUEST_COUNTER_KEY = Symbol.for("nf-request-counter");
|
|
94
|
+
var extendedGlobalThis = globalThis;
|
|
95
|
+
var requestContextAsyncLocalStorage;
|
|
96
|
+
function getRequestContextAsyncLocalStorage() {
|
|
97
|
+
if (requestContextAsyncLocalStorage) {
|
|
98
|
+
return requestContextAsyncLocalStorage;
|
|
99
|
+
}
|
|
100
|
+
if (extendedGlobalThis[REQUEST_CONTEXT_GLOBAL_KEY]) {
|
|
101
|
+
return extendedGlobalThis[REQUEST_CONTEXT_GLOBAL_KEY];
|
|
102
|
+
}
|
|
103
|
+
const storage = new import_node_async_hooks.AsyncLocalStorage();
|
|
104
|
+
requestContextAsyncLocalStorage = storage;
|
|
105
|
+
extendedGlobalThis[REQUEST_CONTEXT_GLOBAL_KEY] = storage;
|
|
106
|
+
return storage;
|
|
107
|
+
}
|
|
108
|
+
var getRequestContext = () => getRequestContextAsyncLocalStorage().getStore();
|
|
109
|
+
|
|
110
|
+
// src/run/handlers/wait-until.cts
|
|
111
|
+
var NEXT_REQUEST_CONTEXT_SYMBOL = Symbol.for("@next/request-context");
|
|
112
|
+
function setupWaitUntil() {
|
|
113
|
+
;
|
|
114
|
+
globalThis[NEXT_REQUEST_CONTEXT_SYMBOL] = {
|
|
115
|
+
get() {
|
|
116
|
+
return { waitUntil: getRequestContext()?.trackBackgroundWork };
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
121
|
+
0 && (module.exports = {
|
|
122
|
+
setupWaitUntil
|
|
123
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
|
+
return createRequire(import.meta.url);
|
|
5
|
+
})();
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
setCacheControlHeaders,
|
|
9
|
+
setCacheStatusHeader,
|
|
10
|
+
setCacheTagsHeaders
|
|
11
|
+
} from "../esm-chunks/chunk-5YBUNNZ4.js";
|
|
12
|
+
import "../esm-chunks/chunk-6BT4RYQJ.js";
|
|
13
|
+
export {
|
|
14
|
+
setCacheControlHeaders,
|
|
15
|
+
setCacheStatusHeader,
|
|
16
|
+
setCacheTagsHeaders
|
|
17
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
|
+
return createRequire(import.meta.url);
|
|
5
|
+
})();
|
|
6
|
+
|
|
7
|
+
import "../esm-chunks/chunk-6BT4RYQJ.js";
|
|
8
|
+
|
|
9
|
+
// src/run/revalidate.ts
|
|
10
|
+
import { isPromise } from "node:util/types";
|
|
11
|
+
function isRevalidateMethod(key, nextResponseField) {
|
|
12
|
+
return key === "revalidate" && typeof nextResponseField === "function";
|
|
13
|
+
}
|
|
14
|
+
var nextResponseProxy = (response, requestContext) => {
|
|
15
|
+
return new Proxy(response, {
|
|
16
|
+
get(target, key) {
|
|
17
|
+
const originalValue = Reflect.get(target, key);
|
|
18
|
+
if (isRevalidateMethod(key, originalValue)) {
|
|
19
|
+
return function newRevalidate(...args) {
|
|
20
|
+
requestContext.didPagesRouterOnDemandRevalidate = true;
|
|
21
|
+
const result = originalValue.apply(target, args);
|
|
22
|
+
if (result && isPromise(result)) {
|
|
23
|
+
requestContext.trackBackgroundWork(result);
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return originalValue;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
nextResponseProxy
|
|
34
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/run/storage/regional-blob-store.cts
|
|
21
|
+
var regional_blob_store_exports = {};
|
|
22
|
+
__export(regional_blob_store_exports, {
|
|
23
|
+
getRegionalBlobStore: () => getRegionalBlobStore,
|
|
24
|
+
setFetchBeforeNuxtPatchedIt: () => setFetchBeforeNuxtPatchedIt
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(regional_blob_store_exports);
|
|
27
|
+
var FETCH_BEFORE_NUXT_PATCHED_IT = Symbol.for("nf-not-patched-fetch");
|
|
28
|
+
var extendedGlobalThis = globalThis;
|
|
29
|
+
function attemptToGetOriginalFetch(fetch) {
|
|
30
|
+
return fetch._nuxtOriginalFetch ?? fetch;
|
|
31
|
+
}
|
|
32
|
+
function forceOptOutOfUsingDataCache(fetch) {
|
|
33
|
+
return (input, init) => {
|
|
34
|
+
return fetch(input, {
|
|
35
|
+
...init,
|
|
36
|
+
next: {
|
|
37
|
+
...init?.next,
|
|
38
|
+
// setting next.internal = true should prevent from trying to use data cache
|
|
39
|
+
// https://github.com/vercel/next.js/blob/fa214c74c1d8023098c0e94e57f917ef9f1afd1a/packages/next/src/server/lib/patch-fetch.ts#L174
|
|
40
|
+
// https://github.com/vercel/next.js/blob/fa214c74c1d8023098c0e94e57f917ef9f1afd1a/packages/next/src/server/lib/patch-fetch.ts#L210-L213
|
|
41
|
+
// this is last line of defense in case we didn't manage to get unpatched fetch that will not affect
|
|
42
|
+
// fetch if it's unpatched so it should be safe to apply always if we aren't sure if we use patched fetch
|
|
43
|
+
// @ts-expect-error - this is an internal field that Next.js doesn't add to its global
|
|
44
|
+
// type overrides for RequestInit type (like `next.revalidate` or `next.tags`)
|
|
45
|
+
internal: true
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
var setFetchBeforeNuxtPatchedIt = (fetch) => {
|
|
51
|
+
extendedGlobalThis[FETCH_BEFORE_NUXT_PATCHED_IT] = forceOptOutOfUsingDataCache(
|
|
52
|
+
attemptToGetOriginalFetch(fetch)
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
var fetchBeforeNuxtPatchedItFallback = forceOptOutOfUsingDataCache(
|
|
56
|
+
attemptToGetOriginalFetch(globalThis.fetch)
|
|
57
|
+
);
|
|
58
|
+
var getRegionalBlobStore = (args = {}) => {
|
|
59
|
+
};
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
getRegionalBlobStore,
|
|
63
|
+
setFetchBeforeNuxtPatchedIt
|
|
64
|
+
});
|